All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing
@ 2019-06-25 14:52 Ross Burton
  2019-06-25 14:52 ` [PATCH v2 2/2] oeqa/buildoptions: check that Fortran code actually cross-compiles Ross Burton
  2019-07-31  5:10 ` [PATCH v2 1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing Khem Raj
  0 siblings, 2 replies; 4+ messages in thread
From: Ross Burton @ 2019-06-25 14:52 UTC (permalink / raw)
  To: openembedded-core

For future runtime testing something more complex is preferred but this is
sufficient to exercise the cross compiler.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 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

diff --git a/meta-selftest/recipes-test/fortran/files/hello.f95 b/meta-selftest/recipes-test/fortran/files/hello.f95
new file mode 100644
index 00000000000..a0745fc64d7
--- /dev/null
+++ b/meta-selftest/recipes-test/fortran/files/hello.f95
@@ -0,0 +1,5 @@
+program helloworld
+
+      print * , "Hello World!"
+
+end program helloworld
diff --git a/meta-selftest/recipes-test/fortran/fortran-helloworld.bb b/meta-selftest/recipes-test/fortran/fortran-helloworld.bb
new file mode 100644
index 00000000000..97313d7e249
--- /dev/null
+++ b/meta-selftest/recipes-test/fortran/fortran-helloworld.bb
@@ -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")
+}
\ No newline at end of file
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] oeqa/buildoptions: check that Fortran code actually cross-compiles
  2019-06-25 14:52 [PATCH v2 1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing Ross Burton
@ 2019-06-25 14:52 ` Ross Burton
  2019-07-31  5:10 ` [PATCH v2 1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing Khem Raj
  1 sibling, 0 replies; 4+ messages in thread
From: Ross Burton @ 2019-06-25 14:52 UTC (permalink / raw)
  To: openembedded-core

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.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/lib/oeqa/selftest/cases/buildoptions.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/buildoptions.py b/meta/lib/oeqa/selftest/cases/buildoptions.py
index 3ad65b40341..6a5378d3ff6 100644
--- a/meta/lib/oeqa/selftest/cases/buildoptions.py
+++ b/meta/lib/oeqa/selftest/cases/buildoptions.py
@@ -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
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing
  2019-06-25 14:52 [PATCH v2 1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing Ross Burton
  2019-06-25 14:52 ` [PATCH v2 2/2] oeqa/buildoptions: check that Fortran code actually cross-compiles Ross Burton
@ 2019-07-31  5:10 ` Khem Raj
  2019-07-31 11:37   ` Ross Burton
  1 sibling, 1 reply; 4+ messages in thread
From: Khem Raj @ 2019-07-31  5:10 UTC (permalink / raw)
  To: Ross Burton; +Cc: Patches and discussions about the oe-core layer

On Tue, Jun 25, 2019 at 7:52 AM Ross Burton <ross.burton@intel.com> wrote:
>
> For future runtime testing something more complex is preferred but this is
> sufficient to exercise the cross compiler.
>
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
>  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
>
> diff --git a/meta-selftest/recipes-test/fortran/files/hello.f95 b/meta-selftest/recipes-test/fortran/files/hello.f95
> new file mode 100644
> index 00000000000..a0745fc64d7
> --- /dev/null
> +++ b/meta-selftest/recipes-test/fortran/files/hello.f95
> @@ -0,0 +1,5 @@
> +program helloworld
> +
> +      print * , "Hello World!"
> +
> +end program helloworld
> diff --git a/meta-selftest/recipes-test/fortran/fortran-helloworld.bb b/meta-selftest/recipes-test/fortran/fortran-helloworld.bb
> new file mode 100644
> index 00000000000..97313d7e249
> --- /dev/null
> +++ b/meta-selftest/recipes-test/fortran/fortran-helloworld.bb
> @@ -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

perhaps we can use ${FC} variable here.
> +}
> +
> +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

> +}
> +
> +python () {
> +    if not d.getVar("FORTRAN"):
> +        raise bb.parse.SkipRecipe("Fortran isn't enabled")
> +}
> \ No newline at end of file
> --
> 2.11.0
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing
  2019-07-31  5:10 ` [PATCH v2 1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing Khem Raj
@ 2019-07-31 11:37   ` Ross Burton
  0 siblings, 0 replies; 4+ messages in thread
From: Ross Burton @ 2019-07-31 11:37 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer

On 31/07/2019 06:10, Khem Raj wrote:
>> +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.

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-31 11:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 14:52 [PATCH v2 1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing Ross Burton
2019-06-25 14:52 ` [PATCH v2 2/2] oeqa/buildoptions: check that Fortran code actually cross-compiles Ross Burton
2019-07-31  5:10 ` [PATCH v2 1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing Khem Raj
2019-07-31 11:37   ` Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.