[oe-commits] [openembedded-core] 04/15: binutils-cross-testsuite: Create recipe for test suite execution

git at git.openembedded.org git at git.openembedded.org
Tue Sep 3 21:28:35 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit baf60914949e0e47fd4e888d38721faf7d6a20e5
Author: Nathan Rossi <nathan at nathanrossi.com>
AuthorDate: Tue Sep 3 16:56:41 2019 +0000

    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.
    
    Signed-off-by: Nathan Rossi <nathan at nathanrossi.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 .../binutils/binutils-cross-testsuite_2.32.bb      | 83 ++++++++++++++++++++++
 1 file changed, 83 insertions(+)

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 0000000..e62e64e
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.32.bb
@@ -0,0 +1,83 @@
+require binutils.inc
+require binutils-${PV}.inc
+
+BPN = "binutils"
+
+DEPENDS += "dejagnu-native expect-native"
+DEPENDS += "binutils-native"
+
+deltask do_compile
+deltask do_install
+
+do_configure[dirs] += "${B}/ld ${B}/bfd"
+do_configure() {
+    # create config.h, oe enables initfini-array by default
+    echo "#define HAVE_INITFINI_ARRAY" > ${B}/ld/config.h
+    # use the bfd_stdint.h from binutils-native, this is the same of the one
+    # generated by binutils-cross
+    cp ${RECIPE_SYSROOT_NATIVE}/usr/include/bfd_stdint.h ${B}/bfd/
+}
+
+# target depends
+DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}binutils"
+DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}gcc"
+DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs"
+DEPENDS += "virtual/${MLPREFIX}libc"
+
+python check_prepare() {
+    def suffix_sys(sys):
+        if sys.endswith("-linux"):
+            return sys + "-gnu"
+        return sys
+
+    def generate_site_exp(d, suite):
+        content = []
+        content.append('set srcdir "{0}/{1}"'.format(d.getVar("S"), suite))
+        content.append('set objdir "{0}/{1}"'.format(d.getVar("B"), suite))
+        content.append('set build_alias "{0}"'.format(d.getVar("BUILD_SYS")))
+        content.append('set build_triplet {0}'.format(d.getVar("BUILD_SYS")))
+        # use BUILD here since HOST=TARGET
+        content.append('set host_alias "{0}"'.format(d.getVar("BUILD_SYS")))
+        content.append('set host_triplet {0}'.format(d.getVar("BUILD_SYS")))
+        content.append('set target_alias "{0}"'.format(d.getVar("TARGET_SYS")))
+        content.append('set target_triplet {0}'.format(suffix_sys(d.getVar("TARGET_SYS"))))
+        content.append("set development true")
+        content.append("set experimental false")
+
+        content.append(d.expand('set CXXFILT "${TARGET_PREFIX}c++filt"'))
+        content.append(d.expand('set CC "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
+        content.append(d.expand('set CXX "${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
+        content.append(d.expand('set CFLAGS_FOR_TARGET "--sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
+
+        if suite == "ld" and d.getVar("TUNE_ARCH") == "mips64":
+            # oe patches binutils to have the default mips64 abi as 64bit, but
+            # skips gas causing issues with the ld test suite (which uses gas)
+            content.append('set ASFLAGS "-64"')
+
+        return "\n".join(content)
+
+    for i in ["binutils", "gas", "ld"]:
+        builddir = os.path.join(d.getVar("B"), i)
+        if not os.path.isdir(builddir):
+            os.makedirs(builddir)
+        with open(os.path.join(builddir, "site.exp"), "w") as f:
+            f.write(generate_site_exp(d, i))
+}
+
+CHECK_TARGETS ??= "binutils gas ld"
+
+do_check[dirs] = "${B} ${B}/binutils ${B}/gas ${B}/ld"
+do_check[prefuncs] += "check_prepare"
+do_check[nostamp] = "1"
+do_check() {
+    export LC_ALL=C
+    for i in ${CHECK_TARGETS}; do
+        (cd ${B}/$i; runtest \
+            --tool $i \
+            --srcdir ${S}/$i/testsuite \
+            --ignore 'plugin.exp' \
+            || true)
+    done
+}
+addtask check after do_configure
+

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list