diff options
Diffstat (limited to 'meta/recipes-core/glibc')
-rw-r--r-- | meta/recipes-core/glibc/glibc-testsuite_2.30.bb | 51 | ||||
-rw-r--r-- | meta/recipes-core/glibc/glibc/check-test-wrapper | 71 |
2 files changed, 122 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/glibc-testsuite_2.30.bb b/meta/recipes-core/glibc/glibc-testsuite_2.30.bb new file mode 100644 index 0000000000..88764d9e2b --- /dev/null +++ b/meta/recipes-core/glibc/glibc-testsuite_2.30.bb | |||
@@ -0,0 +1,51 @@ | |||
1 | require glibc_${PV}.bb | ||
2 | |||
3 | # handle PN differences | ||
4 | FILESEXTRAPATHS_prepend := "${THISDIR}/glibc:" | ||
5 | |||
6 | # strip provides | ||
7 | PROVIDES = "" | ||
8 | # setup depends | ||
9 | INHIBIT_DEFAULT_DEPS = "" | ||
10 | |||
11 | DEPENDS += "glibc-locale libgcc gcc-runtime" | ||
12 | |||
13 | # remove the initial depends | ||
14 | DEPENDS_remove = "libgcc-initial" | ||
15 | |||
16 | inherit qemu | ||
17 | |||
18 | SRC_URI += "file://check-test-wrapper" | ||
19 | |||
20 | DEPENDS += "${@'qemu-native' if d.getVar('TOOLCHAIN_TEST_TARGET') == 'user' else ''}" | ||
21 | |||
22 | TOOLCHAIN_TEST_TARGET ??= "user" | ||
23 | TOOLCHAIN_TEST_HOST ??= "localhost" | ||
24 | TOOLCHAIN_TEST_HOST_USER ??= "root" | ||
25 | TOOLCHAIN_TEST_HOST_PORT ??= "2222" | ||
26 | |||
27 | do_check[dirs] += "${B}" | ||
28 | do_check[nostamp] = "1" | ||
29 | do_check () { | ||
30 | chmod 0755 ${WORKDIR}/check-test-wrapper | ||
31 | |||
32 | # clean out previous test results | ||
33 | oe_runmake tests-clean | ||
34 | # makefiles don't clean entirely (and also sometimes fails due to too many args) | ||
35 | find ${B} -type f -name "*.out" -delete | ||
36 | find ${B} -type f -name "*.test-result" -delete | ||
37 | find ${B}/catgets -name "*.cat" -delete | ||
38 | find ${B}/conform -name "symlist-*" -delete | ||
39 | [ ! -e ${B}/timezone/testdata ] || rm -rf ${B}/timezone/testdata | ||
40 | |||
41 | oe_runmake -i \ | ||
42 | QEMU_SYSROOT="${RECIPE_SYSROOT}" \ | ||
43 | QEMU_OPTIONS="${@qemu_target_binary(d)} ${QEMU_OPTIONS}" \ | ||
44 | SSH_HOST="${TOOLCHAIN_TEST_HOST}" \ | ||
45 | SSH_HOST_USER="${TOOLCHAIN_TEST_HOST_USER}" \ | ||
46 | SSH_HOST_PORT="${TOOLCHAIN_TEST_HOST_PORT}" \ | ||
47 | test-wrapper="${WORKDIR}/check-test-wrapper ${TOOLCHAIN_TEST_TARGET}" \ | ||
48 | check | ||
49 | } | ||
50 | addtask do_check after do_compile | ||
51 | |||
diff --git a/meta/recipes-core/glibc/glibc/check-test-wrapper b/meta/recipes-core/glibc/glibc/check-test-wrapper new file mode 100644 index 0000000000..f8e04e02d2 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/check-test-wrapper | |||
@@ -0,0 +1,71 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | import sys | ||
3 | import os | ||
4 | import subprocess | ||
5 | |||
6 | env = os.environ.copy() | ||
7 | args = sys.argv[1:] | ||
8 | targettype = args.pop(0) | ||
9 | |||
10 | if targettype == "user": | ||
11 | qemuargs = os.environ.get("QEMU_OPTIONS", "").split() | ||
12 | if not os.path.exists(qemuargs[0]): | ||
13 | # ensure qemu args has a valid absolute path | ||
14 | for i in os.environ.get("PATH", "").split(":"): | ||
15 | if os.path.exists(os.path.join(i, qemuargs[0])): | ||
16 | qemuargs[0] = os.path.join(i, qemuargs[0]) | ||
17 | break | ||
18 | sysroot = os.environ.get("QEMU_SYSROOT", None) | ||
19 | if not sysroot: | ||
20 | sys.exit(-1) | ||
21 | libpaths = [sysroot + "/usr/lib", sysroot + "/lib"] | ||
22 | |||
23 | if args[0] == "env": | ||
24 | args.pop(0) | ||
25 | if len(args) == 0: | ||
26 | args = ["env"] | ||
27 | else: | ||
28 | # process options | ||
29 | while args[0].startswith("-"): | ||
30 | opt = args.pop(0).lstrip("-") | ||
31 | if "i" in opt: | ||
32 | env.clear() | ||
33 | # process environment vars | ||
34 | while "=" in args[0]: | ||
35 | key, val = args.pop(0).split("=", 1) | ||
36 | if key == "LD_LIBRARY_PATH": | ||
37 | libpaths += val.split(":") | ||
38 | else: | ||
39 | env[key] = val | ||
40 | if args[0] == "cp": | ||
41 | # ignore copies, the filesystem is the same | ||
42 | sys.exit(0) | ||
43 | |||
44 | qemuargs += ["-L", sysroot] | ||
45 | qemuargs += ["-E", "LD_LIBRARY_PATH={}".format(":".join(libpaths))] | ||
46 | command = qemuargs + args | ||
47 | elif targettype == "ssh": | ||
48 | host = os.environ.get("SSH_HOST", None) | ||
49 | user = os.environ.get("SSH_HOST_USER", None) | ||
50 | port = os.environ.get("SSH_HOST_PORT", None) | ||
51 | |||
52 | command = ["ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no"] | ||
53 | if port: | ||
54 | command += ["-p", str(port)] | ||
55 | if not host: | ||
56 | sys.exit(-1) | ||
57 | command += ["{}@{}".format(user, host) if user else host] | ||
58 | |||
59 | # wrap and replace quotes for correct transformation on ssh | ||
60 | wrapped = " ".join(["'{0}'".format(i.replace("'", r"'\''")) for i in ["cd", os.getcwd()]]) + "; " | ||
61 | wrapped += " ".join(["'{0}'".format(i.replace("'", r"'\''")) for i in args]) | ||
62 | command += ["sh", "-c", "\"{}\"".format(wrapped)] | ||
63 | else: | ||
64 | sys.exit(-1) | ||
65 | |||
66 | try: | ||
67 | r = subprocess.run(command, timeout = 1800, env = env) | ||
68 | sys.exit(r.returncode) | ||
69 | except subprocess.TimeoutExpired: | ||
70 | sys.exit(-1) | ||
71 | |||