fortran-helloworld: add a very dumb Fortran Hello World for testing
PATCH 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 | 23 ++++++++++++++++++++++ 2 files changed, 28 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 +23 -0
@@ -0,0 +1,23 @@ +SUMMARY = "Fortran Hello World" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +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 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.
--- 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
Re: [PATCH 2/2] oeqa/buildoptions: check that Fortran code actually cross-compiles
Quoted 15 lines · Ross Burton
Don't just test that we can build the cross-compiler, but test that it actually can cross-compile some Fortran.
Signed-off-by Ross Burton <[email protected]>--- meta/lib/oeqa/selftest/cases/buildoptions.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)meta/lib/oeqa/selftest/cases/buildoptions.py +0
-0@@ -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)
meta/lib/oeqa/selftest/cases/buildoptions.py class ArchiverTest(OESelftestTestCase): · line 172
Quoted 10 lines
meta/lib/oeqa/selftest/cases/buildoptions.py +1
-3class 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'
Please don't remove that. We need to check libquadmath builds.
meta/lib/oeqa/selftest/cases/buildoptions.py class ArchiverTest(OESelftestTestCase): · line 172
Quoted 4 lines
meta/lib/oeqa/selftest/cases/buildoptions.py +1
-2self.write_config(features) - - bitbake('gcc-runtime libgfortran') + bitbake('fortran-helloworld')
Doesn't this stop testing libgfortran builds too?
Cheers,
Richard
Re: [PATCH 2/2] oeqa/buildoptions: check that Fortran code actually cross-compiles
Quoted 3 lines · Richard Purdie
Quoted 1 line
- features += 'RUNTIMETARGET_append_pn-gcc-runtime = " libquadmath"\n'
Please don't remove that. We need to check libquadmath builds.
From gcc-runtime.inc:
RUNTIMETARGET = "${RUNTIMELIBSSP} libstdc++-v3 libgomp libatomic
${RUNTIMELIBITM} \
${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'],'libquadmath', '', d)} \
"
So this is redundant?
Quoted 6 lines
meta/lib/oeqa/selftest/cases/buildoptions.py class ArchiverTest(OESelftestTestCase): · line 172
Quoted 4 lines
self.write_config(features)meta/lib/oeqa/selftest/cases/buildoptions.py +1
-2- - bitbake('gcc-runtime libgfortran') + bitbake('fortran-helloworld')Doesn't this stop testing libgfortran builds too?
Possibly. I admit I don't know what libgfortran is for considering my test builds apparently without it. :)
Ross
Re: [PATCH 2/2] oeqa/buildoptions: check that Fortran code actually cross-compiles
Quoted 9 lines · Ross
Quoted 4 lines · Richard Purdie
Quoted 2 lines
- features += 'RUNTIMETARGET_append_pn-gcc-runtime = "
libquadmath"\n'Please don't remove that. We need to check libquadmath builds.
From gcc-runtime.inc:
Quoted 7 lines
RUNTIMETARGET = "${RUNTIMELIBSSP} libstdc++-v3 libgomp libatomic
${RUNTIMELIBITM} \ ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'],'libquadmath', '', d)} \
"So this is redundant?
Yes, that was indeed fixed properly.
meta/conf/local.conf.sample.extended needs the same fix.
Quoted 9 lines
Quoted 6 lines
meta/lib/oeqa/selftest/cases/buildoptions.py class ArchiverTest(OESelftestTestCase): · line 172
Quoted 4 lines
self.write_config(features)meta/lib/oeqa/selftest/cases/buildoptions.py +1
-2- - bitbake('gcc-runtime libgfortran') + bitbake('fortran-helloworld')Doesn't this stop testing libgfortran builds too?
Possibly. I admit I don't know what libgfortran is for considering my test builds apparently without it. :)
That maybe but I'd still like to test that it builds given it was added due to problems where it stopped building and people got upset...
Cheers,
Richard
Re: [PATCH 2/2] oeqa/buildoptions: check that Fortran code actually cross-compiles
Quoted 2 lines · On Mon, 24 Jun 2019 at 17:25, <[email protected]> wrote:
That maybe but I'd still like to test that it builds given it was added due to problems where it stopped building and people got upset...
v2 sent.
Ross