[flang-commits] [flang] 49acab3 - [flang][nfc] Relocate a few driver tests
Andrzej Warzynski via flang-commits
flang-commits at lists.llvm.org
Fri Oct 7 10:04:29 PDT 2022
Author: Andrzej Warzynski
Date: 2022-10-07T17:04:06Z
New Revision: 49acab3f1408be9439a57833aa7b67678c9a05ba
URL: https://github.com/llvm/llvm-project/commit/49acab3f1408be9439a57833aa7b67678c9a05ba
DIFF: https://github.com/llvm/llvm-project/commit/49acab3f1408be9439a57833aa7b67678c9a05ba.diff
LOG: [flang][nfc] Relocate a few driver tests
When the work on the Flang driver started, we created 2 test
directories:
* flang/test/Frontend/
* flang/test/Driver/
That was mostly done to model what Clang was doing. In practice, we
stopped using "flang/test/Frontend/" early on and most Flang driver
tests are currently located in "flang/test/Driver/". This patch moves
the remaining tests from the latter into the former directory.
This change also means that we can re-use test input files, i.e.
flang/test/Frontend/Inputs/hello-world.f90 can be replaced with
flang/test/Driver/Inputs/hello.f90. To this end, the affected test is
updated (multiple-input-files.f90).
Differential Revision: https://reviews.llvm.org/D130633
Added:
flang/test/Driver/Inputs/empty.h
flang/test/Driver/input-output-file.f90
flang/test/Driver/multiple-input-files.f90
flang/test/Driver/prescanner-diag.f90
Modified:
flang/test/Driver/Inputs/hello.f90
Removed:
flang/test/Frontend/Inputs/empty.h
flang/test/Frontend/Inputs/hello-world.f90
flang/test/Frontend/input-output-file.f90
flang/test/Frontend/multiple-input-files.f90
flang/test/Frontend/prescanner-diag.f90
################################################################################
diff --git a/flang/test/Frontend/Inputs/empty.h b/flang/test/Driver/Inputs/empty.h
similarity index 100%
rename from flang/test/Frontend/Inputs/empty.h
rename to flang/test/Driver/Inputs/empty.h
diff --git a/flang/test/Driver/Inputs/hello.f90 b/flang/test/Driver/Inputs/hello.f90
index d0c7eb94f53c8..ce14c4c397883 100644
--- a/flang/test/Driver/Inputs/hello.f90
+++ b/flang/test/Driver/Inputs/hello.f90
@@ -1,3 +1,3 @@
program hello
- write (*,*), "hello world"
+ write(*,*), "Hello world!"
end program hello
diff --git a/flang/test/Frontend/input-output-file.f90 b/flang/test/Driver/input-output-file.f90
similarity index 100%
rename from flang/test/Frontend/input-output-file.f90
rename to flang/test/Driver/input-output-file.f90
diff --git a/flang/test/Frontend/multiple-input-files.f90 b/flang/test/Driver/multiple-input-files.f90
similarity index 71%
rename from flang/test/Frontend/multiple-input-files.f90
rename to flang/test/Driver/multiple-input-files.f90
index 251931e7a59d1..6c86f23f2b21f 100644
--- a/flang/test/Frontend/multiple-input-files.f90
+++ b/flang/test/Driver/multiple-input-files.f90
@@ -5,11 +5,11 @@
! NOTE: Use `-E` so that the compiler driver stops after the 1st compilation phase, preprocessing. That's all we need.
! TEST 1: Both input files are processed (output is printed to stdout)
-! RUN: %flang -E %s %S/Inputs/hello-world.f90 | FileCheck %s --match-full-lines -check-prefix=FLANG
+! RUN: %flang -E %s %S/Inputs/hello.f90 | FileCheck %s --match-full-lines -check-prefix=FLANG
! TEST 2: None of the files is processed (not possible to specify the output file when multiple input files are present)
-! RUN: not %flang -E -o - %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR
-! RUN: not %flang -E -o %t %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR
+! RUN: not %flang -E -o - %S/Inputs/hello.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR
+! RUN: not %flang -E -o %t %S/Inputs/hello.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR
!----------------------------------------
! FLANG FRONTEND DRIVER (flang -fc1)
@@ -18,13 +18,13 @@
! This particular test case generates output files in the same directory as the input files. We need to copy the input files into a
! temporary directory to avoid polluting the source directory.
! RUN: rm -rf %t-dir && mkdir -p %t-dir && cd %t-dir
-! RUN: cp %s . && cp %S/Inputs/hello-world.f90 .
-! RUN: %flang_fc1 -test-io hello-world.f90 multiple-input-files.f90 2>&1 \
+! RUN: cp %s . && cp %S/Inputs/hello.f90 .
+! RUN: %flang_fc1 -test-io hello.f90 multiple-input-files.f90 2>&1 \
! RUN: && FileCheck %s --input-file=multiple-input-files.txt --match-full-lines -check-prefix=FC1-OUTPUT1 \
-! RUN: && FileCheck %s --input-file=hello-world.txt --match-full-lines -check-prefix=FC1-OUTPUT2
+! RUN: && FileCheck %s --input-file=hello.txt --match-full-lines -check-prefix=FC1-OUTPUT2
! TEST 4: Only the last input file is processed
-! RUN: %flang_fc1 -test-io %s %S/Inputs/hello-world.f90 -o %t 2>&1 \
+! RUN: %flang_fc1 -test-io %s %S/Inputs/hello.f90 -o %t 2>&1 \
! RUN: && FileCheck %s --input-file=%t --match-full-lines -check-prefix=FC1-OUTPUT3
! TEST 1: By default, `flang` prints the output from all input files to
@@ -35,8 +35,7 @@
! FLANG-NEXT: End Program arithmetic
! FLANG-LABEL: program hello
-! FLANG-NEXT: implicit none
-! FLANG-NEXT: write(*,*) 'Hello world!'
+! FLANG-NEXT: write(*,*), "Hello world!"
! FLANG-NEXT:end program hello
! TEST 2: `-o` does not when multiple input files are present
@@ -50,15 +49,13 @@
! FC1-OUTPUT1-NEXT: End Program arithmetic
! FC1-OUTPUT2-LABEL:program hello
-! FC1-OUTPUT2-NEXT: implicit none
-! FC1-OUTPUT2-NEXT: write(*,*) 'Hello world!'
+! FC1-OUTPUT2-NEXT: write(*,*), "Hello world!"
! FC1-OUTPUT2-NEXT:end program hello
! TEST 4: The output file _was_ specified - `flang_fc1` will process only
! the last input file and generate the corresponding output.
! FC1-OUTPUT3-LABEL:program hello
-! FC1-OUTPUT3-NEXT: implicit none
-! FC1-OUTPUT3-NEXT: write(*,*) 'Hello world!'
+! FC1-OUTPUT3-NEXT: write(*,*), "Hello world!"
! FC1-OUTPUT3-NEXT:end program hello
diff --git a/flang/test/Frontend/prescanner-diag.f90 b/flang/test/Driver/prescanner-diag.f90
similarity index 100%
rename from flang/test/Frontend/prescanner-diag.f90
rename to flang/test/Driver/prescanner-diag.f90
diff --git a/flang/test/Frontend/Inputs/hello-world.f90 b/flang/test/Frontend/Inputs/hello-world.f90
deleted file mode 100644
index b06ad6a5c29c8..0000000000000
--- a/flang/test/Frontend/Inputs/hello-world.f90
+++ /dev/null
@@ -1,5 +0,0 @@
-!This is a test file with a hello world in Fortran
-program hello
- implicit none
- write(*,*) 'Hello world!'
-end program hello
More information about the flang-commits
mailing list