diff options
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc-runtime.inc | 42 | ||||
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc-testsuite.inc | 106 |
2 files changed, 148 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc index 22c1d78dd1..2da3c02ef0 100644 --- a/meta/recipes-devtools/gcc/gcc-runtime.inc +++ b/meta/recipes-devtools/gcc/gcc-runtime.inc | |||
| @@ -277,3 +277,45 @@ FILES_libitm-dev = "\ | |||
| 277 | SUMMARY_libitm-dev = "GNU transactional memory support library - development files" | 277 | SUMMARY_libitm-dev = "GNU transactional memory support library - development files" |
| 278 | FILES_libitm-staticdev = "${libdir}/libitm.a" | 278 | FILES_libitm-staticdev = "${libdir}/libitm.a" |
| 279 | SUMMARY_libitm-staticdev = "GNU transactional memory support library - static development files" | 279 | SUMMARY_libitm-staticdev = "GNU transactional memory support library - static development files" |
| 280 | |||
| 281 | require gcc-testsuite.inc | ||
| 282 | |||
| 283 | EXTRA_OEMAKE_prepend_task-check = "${PARALLEL_MAKE} " | ||
| 284 | |||
| 285 | MAKE_CHECK_TARGETS ??= "check-gcc ${@" ".join("check-target-" + i for i in d.getVar("RUNTIMETARGET").split())}" | ||
| 286 | # prettyprinters and xmethods require gdb tooling | ||
| 287 | MAKE_CHECK_IGNORE ??= "prettyprinters.exp xmethods.exp" | ||
| 288 | MAKE_CHECK_RUNTESTFLAGS ??= "${MAKE_CHECK_BOARDARGS} --ignore '${MAKE_CHECK_IGNORE}'" | ||
| 289 | |||
| 290 | # specific host and target dependencies required for test suite running | ||
| 291 | do_check[depends] += "dejagnu-native:do_populate_sysroot expect-native:do_populate_sysroot" | ||
| 292 | do_check[depends] += "virtual/libc:do_populate_sysroot" | ||
| 293 | # only depend on qemu if targeting linux user execution | ||
| 294 | do_check[depends] += "${@'qemu-native:do_populate_sysroot' if "user" in d.getVar('TOOLCHAIN_TEST_TARGET') else ''}" | ||
| 295 | # extend the recipe sysroot to include the built libraries (for qemu usermode) | ||
| 296 | do_check[prefuncs] += "extend_recipe_sysroot" | ||
| 297 | do_check[prefuncs] += "check_prepare" | ||
| 298 | do_check[dirs] = "${WORKDIR}/dejagnu ${B}" | ||
| 299 | do_check[nostamp] = "1" | ||
| 300 | do_check() { | ||
| 301 | export DEJAGNU="${WORKDIR}/dejagnu/site.exp" | ||
| 302 | |||
| 303 | # HACK: this works around the configure setting CXX with -nostd* args | ||
| 304 | sed -i 's/-nostdinc++ -nostdlib++//g' $(find ${B} -name testsuite_flags | head -1) | ||
| 305 | # HACK: this works around the de-stashing changes to configargs.h, as well as recipe-sysroot changing the content | ||
| 306 | sed -i '/static const char configuration_arguments/d' ${B}/gcc/configargs.h | ||
| 307 | ${CC} -v 2>&1 | grep "^Configured with:" | \ | ||
| 308 | sed 's/Configured with: \(.*\)/static const char configuration_arguments[] = "\1";/g' >> ${B}/gcc/configargs.h | ||
| 309 | |||
| 310 | if [ "${TOOLCHAIN_TEST_TARGET}" = "user" ]; then | ||
| 311 | # qemu user has issues allocating large amounts of memory | ||
| 312 | export G_SLICE=always-malloc | ||
| 313 | # no test should need more that 10G of memory, this prevents tests like pthread7-rope from leaking memory | ||
| 314 | ulimit -m 4194304 | ||
| 315 | ulimit -v 10485760 | ||
| 316 | fi | ||
| 317 | |||
| 318 | oe_runmake -i ${MAKE_CHECK_TARGETS} RUNTESTFLAGS="${MAKE_CHECK_RUNTESTFLAGS}" | ||
| 319 | } | ||
| 320 | addtask check after do_compile do_populate_sysroot | ||
| 321 | |||
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 @@ | |||
| 1 | inherit qemu | ||
| 2 | |||
| 3 | TOOLCHAIN_TEST_TARGET ??= "user" | ||
| 4 | TOOLCHAIN_TEST_HOST ??= "localhost" | ||
| 5 | TOOLCHAIN_TEST_HOST_USER ??= "root" | ||
| 6 | TOOLCHAIN_TEST_HOST_PORT ??= "2222" | ||
| 7 | |||
| 8 | MAKE_CHECK_BOARDFLAGS ??= "" | ||
| 9 | MAKE_CHECK_BOARDARGS ??= "--target_board=${TOOLCHAIN_TEST_TARGET}${MAKE_CHECK_BOARDFLAGS}" | ||
| 10 | |||
| 11 | python () { | ||
| 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 | |||
| 36 | python 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 | |||
