Hello. I would like to reuse upstream tests in testenv/ for testing official Fedora build of wget, installed on the system. Currently tests hardcode path to wget binary to ../src/wget. I added option to set WGET_PATH environment variable to path to a wget binary, which is then used when running tests. This is completely optional, and if not specified, tests work as they did before. However if specified e.g. to "/usr/bin/wget", the distribution-specific build of wget is tested instead.
Regards, Tomas -- Tomas Hozza Associate Manager, Software Engineering - EMEA ENG Core Services PGP: 1D9F3C2D UTC+2 (CEST) Red Hat Inc. http://cz.redhat.com
>From a4118276892baa8ed8c92624e0acce92b6761bab Mon Sep 17 00:00:00 2001 From: Tomas Hozza <[email protected]> Date: Wed, 6 Nov 2019 15:40:29 +0100 Subject: [PATCH] testenv: enable running tests on different wget binary Previously tests in testenv/ directory were run only on wget binary which was built from sources in src/ directory. However as a wget maintainer in a Linux distribution, I would like to be able to run upstream tests on the wget binary distributed with the distribution. This change enables one to define WGET_PATH environment variable to a path to wget binary which should be used by tests. Signed-off-by: Tomas Hozza <[email protected]> --- testenv/README | 4 ++++ testenv/test/base_test.py | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/testenv/README b/testenv/README index e734b55f..d4fabddd 100644 --- a/testenv/README +++ b/testenv/README @@ -99,6 +99,10 @@ Environment Variables: If it is set to "1", valgrind memcheck is enabled with hard coded options. This variable is set by ./configure --enable-valgrind-tests. * SSL_TESTS: This must be set to run any https tests. +* WGET_PATH: Set this environment variable to a path to wget binary on which you + want to run tests. This is useful for OS distributions, which want to reuse + upstream tests for testing wget build that they distribute. If the variable is + not set, the "../src/wget" binary is used by tests. File Structure: diff --git a/testenv/test/base_test.py b/testenv/test/base_test.py index db099137..04a6f748 100644 --- a/testenv/test/base_test.py +++ b/testenv/test/base_test.py @@ -115,8 +115,12 @@ class BaseTest: def gen_cmd_line(self): test_path = os.path.abspath(".") - wget_path = os.path.abspath(os.path.join(test_path, - "..", '..', 'src', "wget")) + if os.getenv("WGET_PATH"): + wget_path = os.path.abspath(os.getenv("WGET_PATH")) + else: + wget_path = os.path.abspath(os.path.join(test_path, + "..", '..', 'src', + "wget")) wget_options = '--debug --no-config %s' % self.wget_options valgrind = os.getenv("VALGRIND_TESTS", "") -- 2.21.0
