1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Support running tests through valgrind

This commit is contained in:
Darshit Shah 2014-07-23 18:42:43 +05:30
parent 6cb857502f
commit be78cba9e5
4 changed files with 25 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2014-07-23 Darshit Shah <darnir@gmail.com>
* test/base_test.py (BaseTest.gen_cmd_line): Add support for running all
tests through valgrind if the relevant environment variable is set
* conf/expected_ret_code (ExpectedRetCode.__call__): Valgrind returns error
code 45 when it detects a memory leak.
* Readme: Update with details about valgrind tests
2014-07-22 Darshit Shah <darnir@gmail.com>
* (README): Remove old TODO and document SERVER_WAIT variable

View File

@ -93,6 +93,8 @@ Environment Variables:
valgrind.
* NO_CLEANUP: Do not remove the temporary files created by the test.
This will prevent the ${testname}-test directory from being deleted
* VALGRIND_TESTS: If this variable is set, the test suite will execute all the
tests through valgrind's memcheck tool.
File Structure:
@ -271,7 +273,9 @@ Makefile.am. This way the Test will be executed on running a 'make check'.
If a Test is expected to fail on the current master branch, then the Test should
also be added to the XFAIL_TESTS variable. This will allow expected failures to
pass through. If a test mentioned in the XFAIL_TESTS variable passes, it gets
red-flagged as a XPASS.
red-flagged as a XPASS. Currently, tests expected to fail under valgrind are not
explicitly marked as XFAIL. Tests failing under valgrind must always be
considered a blocking error.
Remember to always name the Test correctly using the TEST_NAME variable. This
is essential since a directory with the Test Name is created and this can

View File

@ -9,8 +9,11 @@ class ExpectedRetCode:
def __call__(self, test_obj):
if test_obj.ret_code != self.expected_ret_code:
failure = "Return codes do not match.\n" \
"Expected: %s\n" \
"Actual: %s" % (self.expected_ret_code,
test_obj.ret_code)
if test_obj.ret_code == 45:
failure = "Memory Leak Found by Valgrind"
else:
failure = "Return codes do not match.\n" \
"Expected: %s\n" \
"Actual: %s" % (self.expected_ret_code,
test_obj.ret_code)
raise TestFailed(failure)

View File

@ -99,7 +99,11 @@ class BaseTest:
wget_path = os.path.abspath(os.path.join(test_path,
"..", '..', 'src', "wget"))
cmd_line = '%s %s ' % (wget_path, self.wget_options)
if os.getenv("VALGRIND_TESTS"):
valgrind_test = "valgrind --error-exitcode=301 --leak-check=full"
else:
valgrind_test = ""
cmd_line = '%s %s %s ' % (valgrind_test, wget_path, self.wget_options)
for protocol, urls, domain in zip(self.protocols,
self.urls,
self.domains):