Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flang] Fix flang tests on MacOS #70811

Merged
merged 1 commit into from
Nov 14, 2023
Merged

Conversation

luporl
Copy link
Contributor

@luporl luporl commented Oct 31, 2023

Adjust some of the tests run by check-flang to make them pass on MacOS,
either by skipping unsupported tests or by adapting the test for correct
execution on MacOS.

For now ctofortran.f90 test is marked as unsupported, but it can be
adapted to run on MacOS once support for -isysroot flag is added to
flang.

Issues #70805 and #70807 are tracking the failing tests that remain, as
these reveal real problems with flang.

@llvmbot llvmbot added flang:driver flang Flang issues not falling into any other category flang:semantics labels Oct 31, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Oct 31, 2023

@llvm/pr-subscribers-flang-semantics

@llvm/pr-subscribers-flang-driver

Author: Leandro Lupori (luporl)

Changes

Skip unsupported flang tests on MacOS.

Issues #70805 and #70807 were opened for the failing tests that
remain, as these reveal real problems with flang.


Full diff: https://github.com/llvm/llvm-project/pull/70811.diff

4 Files Affected:

  • (modified) flang/test/Driver/lto-flags.f90 (+2-1)
  • (modified) flang/test/Driver/save-mlir-temps.f90 (+2-1)
  • (modified) flang/test/Evaluate/fold-out_of_range.f90 (+1-1)
  • (modified) flang/test/Runtime/no-cpp-dep.c (+3)
diff --git a/flang/test/Driver/lto-flags.f90 b/flang/test/Driver/lto-flags.f90
index da456b47ef4357e..b4819852fbc3616 100644
--- a/flang/test/Driver/lto-flags.f90
+++ b/flang/test/Driver/lto-flags.f90
@@ -10,7 +10,7 @@
 ! RUN: %flang -### -S -flto=jobserver %s 2>&1 | FileCheck %s --check-prefix=FULL-LTO
 
 ! Also check linker plugin opt for Thin LTO
-! RUN: %flang -### -flto=thin %s 2>&1 | FileCheck %s --check-prefix=THIN-LTO
+! RUN: %flang --target=x86_64-linux-gnu -### -flto=thin %s 2>&1 | FileCheck %s --check-prefix=THIN-LTO
 
 ! RUN: not %flang -### -S -flto=somelto %s 2>&1 | FileCheck %s --check-prefix=ERROR
 
@@ -28,6 +28,7 @@
 ! THIN-LTO: flang-new: warning: the option '-flto=thin' is a work in progress
 ! THIN-LTO: "-fc1"
 ! THIN-LTO-SAME: "-flto=thin"
+! NOTE: This check fails on MacOS.
 ! THIN-LTO: "-plugin-opt=thinlto"
 
 ! ERROR: error: unsupported argument 'somelto' to option '-flto=
diff --git a/flang/test/Driver/save-mlir-temps.f90 b/flang/test/Driver/save-mlir-temps.f90
index 8985271e27282e3..2eaadd051e58cc2 100644
--- a/flang/test/Driver/save-mlir-temps.f90
+++ b/flang/test/Driver/save-mlir-temps.f90
@@ -7,7 +7,8 @@
 ! As `flang` does not implement `-fc1as` (i.e. a driver for the integrated
 ! assembler), we need to use `-fno-integrated-as` here.
 
-! UNSUPPORTED: system-windows
+! This test fails on MacOS with the error "can't specifiy -Q with -arch arm64"
+! UNSUPPORTED: system-windows, system-darwin
 
 !--------------------------
 ! Invalid output directory
diff --git a/flang/test/Evaluate/fold-out_of_range.f90 b/flang/test/Evaluate/fold-out_of_range.f90
index fd1b1c286f2fb18..de66c803b103e19 100644
--- a/flang/test/Evaluate/fold-out_of_range.f90
+++ b/flang/test/Evaluate/fold-out_of_range.f90
@@ -1,5 +1,5 @@
 ! RUN: %python %S/test_folding.py %s %flang_fc1
-! UNSUPPORTED: target=powerpc{{.*}}, target=aarch{{.*}}, system-windows, system-solaris
+! UNSUPPORTED: target=powerpc{{.*}}, target=aarch{{.*}}, target=arm{{.*}}, system-windows, system-solaris
 ! Tests folding of OUT_OF_RANGE().
 module m
   integer(1),  parameter :: i1v(*)  = [ -huge(1_1)  - 1_1,  huge(1_1) ]
diff --git a/flang/test/Runtime/no-cpp-dep.c b/flang/test/Runtime/no-cpp-dep.c
index f8fe97b5bf78e24..7d1f05759623caa 100644
--- a/flang/test/Runtime/no-cpp-dep.c
+++ b/flang/test/Runtime/no-cpp-dep.c
@@ -5,6 +5,9 @@ a C compiler.
 
 REQUIRES: c-compiler
 
+MacOS doesn't have a separate libm.
+UNSUPPORTED: system-darwin
+
 RUN: %cc -std=c99 %s -I%include %libruntime %libdecimal -lm -o /dev/null
 */
 

Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look into this - I've left a few questions/suggestions. Hope it makes sense :)

flang/test/Driver/lto-flags.f90 Outdated Show resolved Hide resolved
flang/test/Driver/save-mlir-temps.f90 Outdated Show resolved Hide resolved
flang/test/Runtime/no-cpp-dep.c Outdated Show resolved Hide resolved
@luporl
Copy link
Contributor Author

luporl commented Nov 7, 2023

Thank you for the review! The last commits should address all comments. If not, please "unresolve" the conversations.

I've also marked flang/test/Driver/ctofortran.f90 as unsupported, because both clang and flang fails to build binaries, similar to what happened with flang/test/Runtime/no-cpp-dep.c. It would be easy to add the correct -isysroot flag to clang, but flang still doesn't support this flag.

Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is typical case of "few lines of code that expose some non-trivial issues" 😂 .

Thanks for all the investigation - this is a much needed contribution that brings Darwin support in parity with other targets. Much appreciated!

I've added a few more questions/suggestions, but nothing major - this is practically ready to land, so approving as is. LGTM!

flang/test/Driver/ctofortran.f90 Show resolved Hide resolved
flang/test/Driver/lto-flags.f90 Outdated Show resolved Hide resolved
Adjust some of the tests run by check-flang to make them pass on MacOS,
either by skipping unsupported tests or by adapting the test for correct
execution on MacOS.

For now ctofortran.f90 test is marked as unsupported, but it can be
adapted to run on MacOS once support for -isysroot flag is added to
flang.

Issues llvm#70805 and llvm#70807 are tracking the failing tests that remain, as
these reveal real problems with flang.
@luporl luporl merged commit 8cccda2 into llvm:main Nov 14, 2023
2 of 3 checks passed
@luporl luporl deleted the luporl-fix-mac-tests branch November 14, 2023 13:26
zahiraam pushed a commit to zahiraam/llvm-project that referenced this pull request Nov 20, 2023
Adjust some of the tests run by check-flang to make them pass on MacOS,
either by skipping unsupported tests or by adapting the test for correct
execution on MacOS.

For now ctofortran.f90 test is marked as unsupported, but it can be
adapted to run on MacOS once support for -isysroot flag is added to
flang.

Issues llvm#70805 and llvm#70807 are tracking the failing tests that remain, as
these reveal real problems with flang.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:driver flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants