From 48d9d59fc67c495327fce54b0cbebefca183f2b2 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 3 Jun 2026 13:26:27 -0300 Subject: [PATCH] Add a new test for flang Build and run 2 simple Fortran programs using flang in order to guarantee we have a flang that does the most basic tasks. --- tests/flang/hello.f | 3 +++ tests/flang/main.fmf | 20 ++++++++++++++++++++ tests/flang/sin.f90 | 5 +++++ tests/flang/test.sh | 13 +++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 tests/flang/hello.f create mode 100644 tests/flang/main.fmf create mode 100644 tests/flang/sin.f90 create mode 100755 tests/flang/test.sh diff --git a/tests/flang/hello.f b/tests/flang/hello.f new file mode 100644 index 0000000..e32b35a --- /dev/null +++ b/tests/flang/hello.f @@ -0,0 +1,3 @@ + PROGRAM HELLO + PRINT '(A)', 'Hello, world' + END diff --git a/tests/flang/main.fmf b/tests/flang/main.fmf new file mode 100644 index 0000000..85895d6 --- /dev/null +++ b/tests/flang/main.fmf @@ -0,0 +1,20 @@ +summary: Run simple tests for flang + +tag+: + - fedora-only + +adjust+: + - because: "flang is available for Fedora, not RHEL/CentOS" + when: >- + distro == rhel + or distro == centos + enabled: false + + - because: "flang is not built for compat packages" + enabled: false + when: compat is defined + +require+: + - flang + - llvm-devel +duration: 1h diff --git a/tests/flang/sin.f90 b/tests/flang/sin.f90 new file mode 100644 index 0000000..ba091b0 --- /dev/null +++ b/tests/flang/sin.f90 @@ -0,0 +1,5 @@ +program sin + real :: pi + pi = 4*atan(1.0) + print *, sin(pi/2) +end program diff --git a/tests/flang/test.sh b/tests/flang/test.sh new file mode 100755 index 0000000..6b29663 --- /dev/null +++ b/tests/flang/test.sh @@ -0,0 +1,13 @@ +#!/usr/bin/bash +# Compile and run simple Fortran programs in order to evaluate if Flang is +# minimally funcional. + +set -e + +flang hello.f -o hello +./hello | grep -q "Hello, world" +rm hello + +flang sin.f90 -o sin +./sin | grep -q "1." +rm sin