fortran-helloworld: add a very dumb Fortran Hello World for testing
PATCH v2 1/2 fortran-helloworld: add a very dumb Fortran Hello World for testing
For future runtime testing something more complex is preferred but this is sufficient to exercise the cross compiler.
--- meta-selftest/recipes-test/fortran/files/hello.f95 | 5 +++++ .../recipes-test/fortran/fortran-helloworld.bb | 25 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 meta-selftest/recipes-test/fortran/files/hello.f95 create mode 100644 meta-selftest/recipes-test/fortran/fortran-helloworld.bb
meta-selftest/recipes-test/fortran/files/hello.f95 new file +5 -0
@@ -0,0 +1,5 @@ +program helloworld + + print * , "Hello World!" + +end program helloworld
meta-selftest/recipes-test/fortran/fortran-helloworld.bb new file +25 -0
@@ -0,0 +1,25 @@ +SUMMARY = "Fortran Hello World" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +DEPENDS = "libgfortran" + +SRC_URI = "file://hello.f95" + +# These set flags that Fortran doesn't support +SECURITY_CFLAGS = "" +SECURITY_LDFLAGS = "" + +do_compile() { + ${HOST_PREFIX}gfortran ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS} ${WORKDIR}/hello.f95 -o ${B}/fortran-hello +} + +do_install() { + install -d ${D}${bindir} + install ${B}/fortran-hello ${D}${bindir} +} + +python () { + if not d.getVar("FORTRAN"): + raise bb.parse.SkipRecipe("Fortran isn't enabled") +}
Signature · 1 line
2.11.0
PATCH v2 2/2 oeqa/buildoptions: check that Fortran code actually cross-compiles
Don't just test that we can build the cross-compiler, but test that it actually can cross-compile some Fortran.
The quadmath dependency is now handled in gcc-runtime and isn't needed in this test (as per local.conf.sample.extended changes).
There's also no need to build libgfortran explicitly, as fortran-helloworld depends on it.
--- meta/lib/oeqa/selftest/cases/buildoptions.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
meta/lib/oeqa/selftest/cases/buildoptions.py +2 -5
@@ -162,17 +162,14 @@ class ArchiverTest(OESelftestTestCase): self.assertTrue((g.glob(src_file_glob) and g.glob(tar_file_glob)), "Couldn't find .src.rpm and .tar.gz files under %s/allarch*/xcursor*" % deploy_dir_src) class ToolchainOptions(OESelftestTestCase): - def test_toolchain_fortran(self): """ - Test whether we can enable and build fortran and its supporting libraries + Test that Fortran works by building a Hello, World binary. """ features = 'FORTRAN_forcevariable = ",fortran"\n' - features += 'RUNTIMETARGET_append_pn-gcc-runtime = " libquadmath"\n' self.write_config(features) - - bitbake('gcc-runtime libgfortran') + bitbake('fortran-helloworld') class SourceMirroring(OESelftestTestCase): # Can we download everything from the Yocto Sources Mirror over http only
Signature · 1 line
2.11.0
Quoted 33 lines · Ross Burton
For future runtime testing something more complex is preferred but this is sufficient to exercise the cross compiler.
Signed-off-by Ross Burton <[email protected]>--- meta-selftest/recipes-test/fortran/files/hello.f95 | 5 +++++ .../recipes-test/fortran/fortran-helloworld.bb | 25 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 meta-selftest/recipes-test/fortran/files/hello.f95 create mode 100644 meta-selftest/recipes-test/fortran/fortran-helloworld.bbmeta-selftest/recipes-test/fortran/files/hello.f95 new file +5
-0@@ -0,0 +1,5 @@ +program helloworld + + print * , "Hello World!" + +end program helloworldmeta-selftest/recipes-test/fortran/fortran-helloworld.bb new file +4
-0@@ -0,0 +1,25 @@ +SUMMARY = "Fortran Hello World" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +
meta-selftest/recipes-test/fortran/fortran-helloworld.bb line 14
Quoted 10 lines
meta-selftest/recipes-test/fortran/fortran-helloworld.bb new file +10
-0+DEPENDS = "libgfortran" + +SRC_URI = "file://hello.f95" + +# These set flags that Fortran doesn't support +SECURITY_CFLAGS = "" +SECURITY_LDFLAGS = "" + +do_compile() { + ${HOST_PREFIX}gfortran ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS} ${WORKDIR}/hello.f95 -o ${B}/fortran-hello
perhaps we can use ${FC} variable here.
meta-selftest/recipes-test/fortran/fortran-helloworld.bb line 19
Quoted 5 lines
meta-selftest/recipes-test/fortran/fortran-helloworld.bb new file +5
-0+} + +do_install() { + install -d ${D}${bindir} + install ${B}/fortran-hello ${D}${bindir}
Just do install -D -m 0755 install ${B}/fortran-hello ${D}${bindir}/fortran-hello
Quoted 15 lines
meta-selftest/recipes-test/fortran/fortran-helloworld.bb new file +6
-1+} + +python () { + if not d.getVar("FORTRAN"): + raise bb.parse.SkipRecipe("Fortran isn't enabled") +} --2.11.0
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 4 lines · Khem Raj
meta-selftest/recipes-test/fortran/fortran-helloworld.bb line 14
Quoted 2 lines
meta-selftest/recipes-test/fortran/fortran-helloworld.bb new file +2
-0+do_compile() { + ${HOST_PREFIX}gfortran ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS} ${WORKDIR}/hello.f95 -o ${B}/fortran-helloperhaps we can use ${FC} variable here.
Yes, not sure how I didn't spot that!
Patch incoming.
Ross
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.