diff options
author | Nathan Rossi <nathan@nathanrossi.com> | 2019-09-03 16:56:41 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-09-06 12:45:47 +0100 |
commit | 9d00c56d5bb7d13485c68ebb17c9f493218860ca (patch) | |
tree | 1506ab736f6355d2a9712520edd96b312b4dfaf5 /meta/recipes-devtools/binutils/binutils-cross-testsuite_2.32.bb | |
parent | f7194f29ce1b94782f9eae376456b149e2648e77 (diff) | |
download | poky-9d00c56d5bb7d13485c68ebb17c9f493218860ca.tar.gz |
binutils-cross-testsuite: Create recipe for test suite execution
Create the do_check task in a new recipe 'binutils-cross-testsuite'.
This recipe is built within a target recipe (not -cross) to ensure
correct testing against target specific libraries/etc. The do_check task
is used to execute the binutils test suite for the cross target
binutils. By default this executes tests for binutils, gas and ld. This
can however be changed by setting CHECK_TARGETS to the desired test
suite target (e.g. 'gas').
The binutils test suites do not require any target execution, as such
the check task can be run without QEMU or a target device. However
since the binutils tests do rely on a C compiler there is dependence on
both gcc and libc in order to run the tests.
(From OE-Core rev: 1fb98bfdccb82474176fe8fca616aea84475942e)
Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils-cross-testsuite_2.32.bb')
-rw-r--r-- | meta/recipes-devtools/binutils/binutils-cross-testsuite_2.32.bb | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.32.bb b/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.32.bb new file mode 100644 index 0000000000..e62e64e8ae --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.32.bb | |||
@@ -0,0 +1,83 @@ | |||
1 | require binutils.inc | ||
2 | require binutils-${PV}.inc | ||
3 | |||
4 | BPN = "binutils" | ||
5 | |||
6 | DEPENDS += "dejagnu-native expect-native" | ||
7 | DEPENDS += "binutils-native" | ||
8 | |||
9 | deltask do_compile | ||
10 | deltask do_install | ||
11 | |||
12 | do_configure[dirs] += "${B}/ld ${B}/bfd" | ||
13 | do_configure() { | ||
14 | # create config.h, oe enables initfini-array by default | ||
15 | echo "#define HAVE_INITFINI_ARRAY" > ${B}/ld/config.h | ||
16 | # use the bfd_stdint.h from binutils-native, this is the same of the one | ||
17 | # generated by binutils-cross | ||
18 | cp ${RECIPE_SYSROOT_NATIVE}/usr/include/bfd_stdint.h ${B}/bfd/ | ||
19 | } | ||
20 | |||
21 | # target depends | ||
22 | DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}binutils" | ||
23 | DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}gcc" | ||
24 | DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs" | ||
25 | DEPENDS += "virtual/${MLPREFIX}libc" | ||
26 | |||
27 | python check_prepare() { | ||
28 | def suffix_sys(sys): | ||
29 | if sys.endswith("-linux"): | ||
30 | return sys + "-gnu" | ||
31 | return sys | ||
32 | |||
33 | def generate_site_exp(d, suite): | ||
34 | content = [] | ||
35 | content.append('set srcdir "{0}/{1}"'.format(d.getVar("S"), suite)) | ||
36 | content.append('set objdir "{0}/{1}"'.format(d.getVar("B"), suite)) | ||
37 | content.append('set build_alias "{0}"'.format(d.getVar("BUILD_SYS"))) | ||
38 | content.append('set build_triplet {0}'.format(d.getVar("BUILD_SYS"))) | ||
39 | # use BUILD here since HOST=TARGET | ||
40 | content.append('set host_alias "{0}"'.format(d.getVar("BUILD_SYS"))) | ||
41 | content.append('set host_triplet {0}'.format(d.getVar("BUILD_SYS"))) | ||
42 | content.append('set target_alias "{0}"'.format(d.getVar("TARGET_SYS"))) | ||
43 | content.append('set target_triplet {0}'.format(suffix_sys(d.getVar("TARGET_SYS")))) | ||
44 | content.append("set development true") | ||
45 | content.append("set experimental false") | ||
46 | |||
47 | content.append(d.expand('set CXXFILT "${TARGET_PREFIX}c++filt"')) | ||
48 | content.append(d.expand('set CC "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"')) | ||
49 | content.append(d.expand('set CXX "${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"')) | ||
50 | content.append(d.expand('set CFLAGS_FOR_TARGET "--sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"')) | ||
51 | |||
52 | if suite == "ld" and d.getVar("TUNE_ARCH") == "mips64": | ||
53 | # oe patches binutils to have the default mips64 abi as 64bit, but | ||
54 | # skips gas causing issues with the ld test suite (which uses gas) | ||
55 | content.append('set ASFLAGS "-64"') | ||
56 | |||
57 | return "\n".join(content) | ||
58 | |||
59 | for i in ["binutils", "gas", "ld"]: | ||
60 | builddir = os.path.join(d.getVar("B"), i) | ||
61 | if not os.path.isdir(builddir): | ||
62 | os.makedirs(builddir) | ||
63 | with open(os.path.join(builddir, "site.exp"), "w") as f: | ||
64 | f.write(generate_site_exp(d, i)) | ||
65 | } | ||
66 | |||
67 | CHECK_TARGETS ??= "binutils gas ld" | ||
68 | |||
69 | do_check[dirs] = "${B} ${B}/binutils ${B}/gas ${B}/ld" | ||
70 | do_check[prefuncs] += "check_prepare" | ||
71 | do_check[nostamp] = "1" | ||
72 | do_check() { | ||
73 | export LC_ALL=C | ||
74 | for i in ${CHECK_TARGETS}; do | ||
75 | (cd ${B}/$i; runtest \ | ||
76 | --tool $i \ | ||
77 | --srcdir ${S}/$i/testsuite \ | ||
78 | --ignore 'plugin.exp' \ | ||
79 | || true) | ||
80 | done | ||
81 | } | ||
82 | addtask check after do_configure | ||
83 | |||