summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2019-09-03 16:56:41 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-06 12:45:47 +0100
commit9d00c56d5bb7d13485c68ebb17c9f493218860ca (patch)
tree1506ab736f6355d2a9712520edd96b312b4dfaf5 /meta/recipes-devtools/binutils
parentf7194f29ce1b94782f9eae376456b149e2648e77 (diff)
downloadpoky-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')
-rw-r--r--meta/recipes-devtools/binutils/binutils-cross-testsuite_2.32.bb83
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 @@
1require binutils.inc
2require binutils-${PV}.inc
3
4BPN = "binutils"
5
6DEPENDS += "dejagnu-native expect-native"
7DEPENDS += "binutils-native"
8
9deltask do_compile
10deltask do_install
11
12do_configure[dirs] += "${B}/ld ${B}/bfd"
13do_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
22DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}binutils"
23DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}gcc"
24DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs"
25DEPENDS += "virtual/${MLPREFIX}libc"
26
27python 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
67CHECK_TARGETS ??= "binutils gas ld"
68
69do_check[dirs] = "${B} ${B}/binutils ${B}/gas ${B}/ld"
70do_check[prefuncs] += "check_prepare"
71do_check[nostamp] = "1"
72do_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}
82addtask check after do_configure
83