summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-testsuite.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-testsuite.inc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-testsuite.inc106
1 files changed, 106 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-testsuite.inc b/meta/recipes-devtools/gcc/gcc-testsuite.inc
new file mode 100644
index 0000000000..b383a358d8
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-testsuite.inc
@@ -0,0 +1,106 @@
1inherit qemu
2
3TOOLCHAIN_TEST_TARGET ??= "user"
4TOOLCHAIN_TEST_HOST ??= "localhost"
5TOOLCHAIN_TEST_HOST_USER ??= "root"
6TOOLCHAIN_TEST_HOST_PORT ??= "2222"
7
8MAKE_CHECK_BOARDFLAGS ??= ""
9MAKE_CHECK_BOARDARGS ??= "--target_board=${TOOLCHAIN_TEST_TARGET}${MAKE_CHECK_BOARDFLAGS}"
10
11python () {
12 # Provide the targets compiler args via targets options. This allows dejagnu to
13 # correctly mark incompatible tests as UNSUPPORTED (e.g. needs soft-float
14 # but running on hard-float target).
15 #
16 # These options are called "multilib_flags" within the gcc test suite. Most
17 # architectures handle these options in a sensible way such that tests that
18 # are incompatible with the provided multilib are marked as UNSUPPORTED.
19 #
20 # Note: multilib flags are added to the compile command after the args
21 # provided by any test (through dg-options), CFLAGS_FOR_TARGET is always
22 # added to the compile command before any other args but is not interpted
23 # as options like multilib flags.
24 #
25 # i686, x86-64 and aarch64 are special, since most toolchains built for
26 # these targets don't do multilib the tests do not get correctly marked as
27 # UNSUPPORTED. More importantly the test suite itself does not handle
28 # overriding the multilib flags where it could (like other archs do). As
29 # such do not pass the target compiler args for these targets.
30 args = d.getVar("TUNE_CCARGS").split()
31 if d.getVar("TUNE_ARCH") in ["i686", "x86_64", "aarch64"]:
32 args = []
33 d.setVar("MAKE_CHECK_BOARDFLAGS", ("/" + "/".join(args)) if len(args) != 0 else "")
34}
35
36python check_prepare() {
37 def generate_qemu_linux_user_config(d):
38 content = []
39 content.append('load_generic_config "sim"')
40 content.append('load_base_board_description "basic-sim"')
41 content.append('process_multilib_options ""')
42
43 # qemu args
44 qemu_binary = qemu_target_binary(d)
45 if not qemu_binary:
46 bb.fatal("Missing target qemu linux-user binary")
47
48 args = []
49 # QEMU_OPTIONS is not always valid due to -cross recipe
50 args += ["-r", d.getVar("OLDEST_KERNEL")]
51 # enable all valid instructions, since the test suite itself does not
52 # limit itself to the target cpu options.
53 # - valid for x86*, powerpc, arm, arm64
54 if qemu_binary.lstrip("qemu-") in ["x86_64", "i386", "ppc", "arm", "aarch64"]:
55 args += ["-cpu", "max"]
56
57 sysroot = d.getVar("RECIPE_SYSROOT")
58 args += ["-L", sysroot]
59 # lib paths are static here instead of using $libdir since this is used by a -cross recipe
60 libpaths = [sysroot + "/usr/lib", sysroot + "/lib"]
61 args += ["-E", "LD_LIBRARY_PATH={0}".format(":".join(libpaths))]
62
63 content.append('set_board_info is_simulator 1')
64 content.append('set_board_info sim "{0}"'.format(qemu_binary))
65 content.append('set_board_info sim,options "{0}"'.format(" ".join(args)))
66
67 # target build/test config
68 content.append('set_board_info target_install {%s}' % d.getVar("TARGET_SYS"))
69 content.append('set_board_info ldscript ""')
70 #content.append('set_board_info needs_status_wrapper 1') # qemu-linux-user return codes work, and abort works fine
71 content.append('set_board_info gcc,stack_size 16834')
72 content.append('set_board_info gdb,nosignals 1')
73 content.append('set_board_info gcc,timeout 60')
74
75 return "\n".join(content)
76
77 def generate_remote_ssh_linux_config(d):
78 content = []
79 content.append('load_generic_config "unix"')
80 content.append("set_board_info hostname {0}".format(d.getVar("TOOLCHAIN_TEST_HOST")))
81 content.append("set_board_info username {0}".format(d.getVar("TOOLCHAIN_TEST_HOST_USER")))
82
83 port = d.getVar("TOOLCHAIN_TEST_HOST_PORT")
84 content.append("set_board_info rsh_prog \"/usr/bin/ssh -p {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\"".format(port))
85 content.append("set_board_info rcp_prog \"/usr/bin/scp -P {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\"".format(port))
86
87 return "\n".join(content)
88
89 dejagnudir = d.expand("${WORKDIR}/dejagnu")
90 if not os.path.isdir(dejagnudir):
91 os.makedirs(dejagnudir)
92
93 # write out target qemu board config
94 with open(os.path.join(dejagnudir, "user.exp"), "w") as f:
95 f.write(generate_qemu_linux_user_config(d))
96
97 # write out target ssh board config
98 with open(os.path.join(dejagnudir, "ssh.exp"), "w") as f:
99 f.write(generate_remote_ssh_linux_config(d))
100
101 # generate site.exp to provide boards
102 with open(os.path.join(dejagnudir, "site.exp"), "w") as f:
103 f.write("lappend boards_dir {0}\n".format(dejagnudir))
104 f.write("set CFLAGS_FOR_TARGET \"{0}\"\n".format(d.getVar("TOOLCHAIN_OPTIONS")))
105}
106