Reapply "[NFC][clang][Driver] Add tests for --driver-mode=flang" (#211724)
This reapplies #207658. Some targets do not support flang_rt or clang_rt. It seems difficult to create a blocklist, so the tests are now configured to explicitly specify the known-working targets. The specified targets are extracted from tests in flang/test/Driver. ----- The original commit message: This patch intends to clarify the current behaviors, not to state the expected/desirable behaviors.
This commit is contained in:
parent
0879c1092c
commit
0142992aea
2 changed files with 35 additions and 0 deletions
|
|
@ -5,3 +5,25 @@
|
|||
! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90"
|
||||
! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}clang{{[^"/]*}}" "-cc1"
|
||||
! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/other.c"
|
||||
|
||||
! Check that flang-only options are not passed to clang.
|
||||
! RUN: %clang --driver-mode=flang -### -fstack-arrays %S/Inputs/one.f90 %S/Inputs/other.c 2>&1 | FileCheck --check-prefixes=CHECK-FLANG-OPT %s
|
||||
! CHECK-FLANG-OPT-LABEL: "{{[^"]*}}flang{{[^"/]*}}" "-fc1"
|
||||
! CHECK-FLANG-OPT: "-fstack-arrays"
|
||||
! CHECK-FLANG-OPT-LABEL: "{{[^"]*}}clang{{[^"/]*}}" "-cc1"
|
||||
! CHECK-FLANG-OPT-NOT: "-fstack-arrays"
|
||||
|
||||
! The -std= option is accepted by both clang and flang, but its acceptable values differ between the two.
|
||||
! Currently, -std=c17 is passed to flang, which rejects it. This should be fixed in the future.
|
||||
! A potential solution is to use -Xflang and -Xclang to pass the option to the right frontend; however, -Xclang is rejected.
|
||||
|
||||
! RUN: %clang --driver-mode=flang -### -std=f2018 %S/Inputs/one.f90 -std=c17 %S/Inputs/other.c 2>&1 | FileCheck --check-prefixes=MIXED-OPT %s
|
||||
! MIXED-OPT-LABEL: "{{[^"]*}}flang{{[^"/]*}}" "-fc1"
|
||||
! MIXED-OPT: "-std=f2018"
|
||||
! MIXED-OPT: "-std=c17"
|
||||
! MIXED-OPT-LABEL: "{{[^"]*}}clang{{[^"/]*}}" "-cc1"
|
||||
! MIXED-OPT-NOT: "-std=f2018"
|
||||
! MIXED-OPT: "-std=c17"
|
||||
|
||||
! RUN: not %clang --driver-mode=flang -### -Xflang -std=f2018 %S/Inputs/one.f90 -Xclang -std=c17 %S/Inputs/other.c 2>&1 | FileCheck --check-prefixes=SEPARATE-MIXED-OPT %s
|
||||
! SEPARATE-MIXED-OPT: error: unknown argument '-Xclang'
|
||||
|
|
|
|||
13
clang/test/Driver/flang/runtimes.f90
Normal file
13
clang/test/Driver/flang/runtimes.f90
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
! Check that Flang runtimes are passed to the linker in --driver-mode=flang.
|
||||
|
||||
! RUN: %clang --driver-mode=flang --rtlib=compiler-rt --target=x86_64-linux-gnu -### %s 2>&1 | FileCheck %s
|
||||
! RUN: %clang --driver-mode=flang --rtlib=compiler-rt --target=x86_64-pc-windows-msvc -### %s 2>&1 | FileCheck %s
|
||||
! RUN: %clang --driver-mode=flang --rtlib=compiler-rt --target=aarch64-linux-none -### %s 2>&1 | FileCheck %s
|
||||
! RUN: %clang --driver-mode=flang --rtlib=compiler-rt --target=ppc64le-linux-gnu -### %s 2>&1 | FileCheck %s
|
||||
! RUN: %clang --driver-mode=flang --rtlib=compiler-rt --target=powerpc64-ibm-aix -### %s 2>&1 | FileCheck %s
|
||||
! RUN: %clang --driver-mode=flang --rtlib=compiler-rt --target=sparc-sun-solaris2.11 -### %s 2>&1 | FileCheck %s
|
||||
! CHECK-DAG: clang_rt.{{[^ "]}}
|
||||
! CHECK-DAG: flang_rt.{{[^ "]}}
|
||||
|
||||
! RUN: not %clang --driver-mode=flang -stdlib=libc++ -### %s 2>&1 | FileCheck --check-prefix=LIBCXX %s
|
||||
! LIBCXX: error: unknown argument: '-stdlib=libc++'
|
||||
Loading…
Reference in a new issue