From bac6fbab6cbdde47f8fb69d74875bacb2f736c50 Mon Sep 17 00:00:00 2001 From: Tomas Hozza Date: Wed, 6 Nov 2019 15:40:29 +0100 Subject: [PATCH] testenv: enable running tests on different wget binary * testenv/README: Document $WGET_PATH * testenv/test/base_test.py: Use $WGET_PATH instead ../src/wget if set 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 --- 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 6580bc99..aca8cdda 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 1e1eb181..dbf4678f 100644 --- a/testenv/test/base_test.py +++ b/testenv/test/base_test.py @@ -111,8 +111,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", "")