From: Waldemar Kozaczuk <
jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <
jwkoz...@gmail.com>
Branch: master
tests: enhance test.py to run tests with Linux dynamic linker
This patch modifies scripts/test.py to support new option '--linux_ld'.
This new option instructs test.py to launch unit tests with Linux dynamic linker
by prepending '/lib64/ld-linux-x86-64.so.2 ' to the command line.
In order to run a test with Linux dynamic linker one has to build
the image tests-with-linux-ld as explained in the previous patch
and run test.py like so:
scripts/test.py -m modules/tests-with-linux-ld/usr.manifest --linux_ld -n tst-seek
Please note that some tests do not pass when running with Linux dynamic linker
for all kinds of reasons which will be addressed by following commits.
This command to run all unit tests that pass:
dl=linux ./scripts/build image=tests-with-linux-ld fs=rofs
scripts/test.py -v --linux_ld -m modules/tests-with-linux-ld/usr.manifest \
-d tst-ctype \
-d tst-console \
-d tst-dlfcn \
-d tst-dns-resolver \
-d tst-fread \
-d tst-futimesat \
-d tst-ifaddrs \
-d tst-kill \
-d tst-mmap \
-d tst-net_if_test \
-d tst-netlink \
-d tst-pipe \
-d tst-pthread-barrier \
-d tst-pthread-clock \
-d tst-realloc \
-d tst-reloc \
-d tst-semaphore \
-d tst-shm \
-d tst-sigaction \
-d tst-sigwait \
-d tst-stdio-rofs \
-d tst-string \
-d tst-symlink \
-d tst-symlink-rofs \
-d tst-time \
-d tst-truncate \
-d tst-ttyname \
-d tst-uio \
-d tst-utimensat \
-d tst-utimes \
-d tst-wctype
Signed-off-by: Waldemar Kozaczuk <
jwkoz...@gmail.com>
---
diff --git a/modules/java-tests/Makefile b/modules/java-tests/Makefile
--- a/modules/java-tests/Makefile
+++ b/modules/java-tests/Makefile
@@ -70,8 +70,8 @@ java_isolated_cmd := 'java_isolated: /java_isolated.so -cp /tests/java/tests.jar
-Disolates.jar=/tests/java/isolates.jar org.junit.runner.JUnitCore io.osv.AllTestsThatTestIsolatedApp'
java_non_isolated_cmd := 'java_non_isolated: /java.so -cp /tests/java/tests.jar:/tests/java/isolates.jar \
-Disolates.jar=/tests/java/isolates.jar org.junit.runner.JUnitCore io.osv.AllTestsThatTestNonIsolatedApp'
-java_no_wrapper_cmd := 'java_no_wrapper: /usr/bin/java -cp /tests/java/tests.jar org.junit.runner.JUnitCore io.osv.BasicTests !'
-java_perms_cmd := 'java-perms: /usr/bin/java -cp /tests/java/tests.jar io.osv.TestDomainPermissions !'
+java_no_wrapper_cmd := 'java_no_wrapper: /usr/lib/jvm/java/bin/java -cp /tests/java/tests.jar org.junit.runner.JUnitCore io.osv.BasicTests !'
+java_perms_cmd := 'java-perms: /usr/lib/jvm/java/bin/java -cp /tests/java/tests.jar io.osv.TestDomainPermissions !'
.PHONY: test_commands
diff --git a/modules/tests-with-linux-ld/Makefile b/modules/tests-with-linux-ld/Makefile
--- a/modules/tests-with-linux-ld/Makefile
+++ b/modules/tests-with-linux-ld/Makefile
@@ -171,7 +171,7 @@ usr.manifest: build_all_tests $(lastword $(MAKEFILE_LIST)) usr.manifest.skel FOR
@cat $@.skel > $@
@case "$(CROSS_PREFIX)" in \
"aarch64"*) ../tests/add_aarch64_boost_libraries.sh $(OSV_BASE) >> $@ ;; \
- *) LD_LIBRARY_PATH=$(boost-lib-dir) ldd $(addprefix $(out)/tests-with-linux-ld/,$(boost-tests)) $(addprefix $(out)/tests-with-linux-ld/,$(boost-program-options-tests)) | grep libboost | sed 's/ *[^ ] *\(.*\) => \(.*\) .*/\/lib\/x86_64-linux-gnu\/\1: \2/' | sort | uniq >> $@ ;; \
+ *) LD_LIBRARY_PATH=$(boost-lib-dir) ldd $(addprefix $(out)/tests-with-linux-ld/,$(boost-tests)) $(addprefix $(out)/tests-with-linux-ld/,$(boost-program-options-tests)) | grep libboost | sed 's/ *[^ ] *\(.*\) => \(.*\) .*/\/usr\/lib64\/\1: \2/' | sort | uniq >> $@ ;; \
esac
@echo $(all_tests) | tr ' ' '\n' | grep -v "tests-with-linux-ld/rofs/tst-.*" | awk '{print "/" $$0 ": ./" $$0}' | sed 's/^\/tests-with-linux-ld/\/tests/' >> $@
@echo $(all_tests) | tr ' ' '\n' | grep "tests-with-linux-ld/rofs/tst-.*" | awk 'BEGIN { FS = "/" } ; { print "/tests/" $$3 "-rofs: ./tests-with-linux-ld/" $$2 "/" $$3 ""}' >> $@
@@ -185,7 +185,7 @@ common.manifest: build_all_tests $(lastword $(MAKEFILE_LIST)) usr.manifest.skel
@cat usr.manifest.skel > $@
@case "$(CROSS_PREFIX)" in \
"aarch64"*) ../tests/add_aarch64_boost_libraries.sh $(OSV_BASE) >> $@ ;; \
- *) LD_LIBRARY_PATH=$(boost-lib-dir) ldd $(addprefix $(out)/tests-with-linux-ld/,$(boost-tests)) $(addprefix $(out)/tests-with-linux-ld/,$(boost-program-options-tests)) | grep libboost | sed 's/ *[^ ] *\(.*\) => \(.*\) .*/\/lib\/x86_64-linux-gnu\/\1: \2/' | sort | uniq >> $@ ;; \
+ *) LD_LIBRARY_PATH=$(boost-lib-dir) ldd $(addprefix $(out)/tests-with-linux-ld/,$(boost-tests)) $(addprefix $(out)/tests-with-linux-ld/,$(boost-program-options-tests)) | grep libboost | sed 's/ *[^ ] *\(.*\) => \(.*\) .*/\/usr/\/lib64\/\1: \2/' | sort | uniq >> $@ ;; \
esac
@echo $(common-tests) | tr ' ' '\n' | awk '{print "/tests/" $$0 ": ./tests/" $$0}' >> $@
diff --git a/scripts/test.py b/scripts/test.py
--- a/scripts/test.py
+++ b/scripts/test.py
@@ -31,16 +31,24 @@
"tcp_close_without_reading_on_qemu"
]
+linux_ld_disabled_list= [
+ "tracing_smoke_test",
+ "tcp_close_without_reading_on_fc",
+ "tcp_close_without_reading_on_qemu"
+]
+
+linux_ld = '/lib64/ld-linux-x86-64.so.2 '
+
class TestRunnerTest(SingleCommandTest):
def __init__(self, name):
- super(TestRunnerTest, self).__init__(name, '/tests/%s' % name)
+ super(TestRunnerTest, self).__init__(name, '%s/tests/%s' % (linux_ld if cmdargs.linux_ld else '', name))
# 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")
+is_test = re.compile("^/tests/tst-.*")
def running_with_kvm_on(arch, hypervisor):
if os.path.exists('/dev/kvm') and arch == host_arch and hypervisor in ['qemu', 'qemu_microvm', 'firecracker']:
@@ -71,7 +79,7 @@ def collect_java_tests():
components = line.split(": ", 2);
test_name = components[0].strip();
test_command = components[1].strip()
- add_tests([SingleCommandTest(test_name, test_command)])
+ add_tests([SingleCommandTest(test_name, linux_ld + test_command if cmdargs.linux_ld else test_command)])
def run_test(test):
sys.stdout.write(" TEST %-35s" %
test.name)
@@ -160,6 +168,7 @@ def main():
parser.add_argument("-d", "--disabled_list", action="append", help="test to be disabled", default=[])
parser.add_argument("--arch", action="store", choices=["x86_64","aarch64"], default=host_arch,
help="specify QEMU architecture: x86_64, aarch64")
+ parser.add_argument("--linux_ld", action="store_true", help="launch tests with Linux dynamic linker")
cmdargs = parser.parse_args()
set_verbose_output(cmdargs.verbose)
@@ -176,6 +185,9 @@ def main():
else:
disabled_list.extend(qemu_disabled_list)
+ if cmdargs.linux_ld:
+ disabled_list.extend(linux_ld_disabled_list)
+
if cmdargs.arch == 'aarch64':
if host_arch != cmdargs.arch:
#Until the issue #1143 is resolved, we need to force running with 2 CPUs in TCG mode