From: Nadav Har'El <[email protected]>
Committer: Nadav Har'El <[email protected]>
Branch: master
scripts/test.py: forgive old files in build directory
This patch fixes a failure report in our Jenkins build machine, which
includes a build directory that hasn't been "make clean"ed in 6 months:
test.py currently finds the list of tests to run by listing the files
in build/release/tests. But the test image Makefile (modules/tests/Makefile)
doesn't actually put everything in that directory into the test image -
rather it has a list of tests, and only those tests get listed in the
usr.manifest and therefore put into the image. If we decide to delete one
of the tests (as happened in commit
78854b4f0d32740f222869d4111461680f42ba3b)
and we do not "make clean", the old compiled test will remain in
build/release/tests - but not get included in the image, and test.py will
fail when it tries to run it.
Until commit 785e57e60969e25c19c87ad1b922ad9b66428c0e this problem was
benign, because test.py used to ignore missing object files. Because it
no longer does, we need to solve this problem.
The solution is for test.py to take the list of tests in the image from the
same usr.manifest which was used to build it.
Signed-off-by: Nadav Har'El <[email protected]>
---
diff --git a/scripts/test.py b/scripts/test.py
--- a/scripts/test.py
+++ b/scripts/test.py
@@ -33,7 +33,21 @@ class TestRunnerTest(SingleCommandTest):
def __init__(self, name):
super(TestRunnerTest, self).__init__(name, '/tests/%s' % name)
-test_files = set(glob.glob('build/release/tests/tst-*.so')) -
set(glob.glob('build/release/tests/*-stripped.so'))
+# Not all files in build/release/tests/tst-*.so may be on the test image
+# (e.g., some may have actually remain there from old builds) - so lets
take
+# the list of tests actually in the image form the image's manifest file.
+test_files = []
+is_comment = re.compile("^[ \t]*(|#.*|\[manifest])$")
+is_test = re.compile("^/tests/tst-.*.so")
+with open('modules/tests/usr.manifest', 'r') as f:
+ for line in f:
+ line = line.rstrip();
+ if is_comment.match(line): continue;
+ components = line.split(": ", 2);
+ guestpath = components[0].strip();
+ hostpath = components[1].strip()
+ if is_test.match(guestpath):
+ test_files.append(guestpath);
add_tests((TestRunnerTest(os.path.basename(x)) for x in test_files))
def run_test(test):
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.