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 <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2019-11-06 15:40:29 +01:00 committed by Tim Rühsen
parent 1e4262e98d
commit bac6fbab6c
2 changed files with 10 additions and 2 deletions

View File

@ -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:

View File

@ -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", "")