Skip to content

Commit 8298ec2

Browse files
committed
[flang][driver] Copy input files into a temp dir when testing
The following frontend driver invocation will generate 2 output files in the same directory as the input files: ``` flang-new -fc1 input-1.f input-2.f ``` This is the desired behaviour. However, when testing we need to make sure that we don't pollute the source directory. To this end, copy test input files into a temporary directory. Differential Revision: https://reviews.llvm.org/D94243
1 parent 4c372a3 commit 8298ec2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

flang/test/Frontend/multiple-input-files.f90

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@
1616
! FLANG FRONTEND DRIVER (flang-new -fc1)
1717
!----------------------------------------
1818
! TEST 3: Both input files are processed
19-
! RUN: %flang-new -fc1 -test-io %S/Inputs/hello-world.f90 %s 2>&1 \
20-
! RUN: && FileCheck %s --input-file=%S/multiple-input-files.txt --match-full-lines -check-prefix=FC1-OUTPUT1 \
21-
! RUN: && FileCheck %s --input-file=%S/Inputs/hello-world.txt --match-full-lines -check-prefix=FC1-OUTPUT2
19+
! This particular test case generates output files in the same directory as the input files. We need to copy the input files into a
20+
! temporary directory to avoid polluting the source directory.
21+
! RUN: rm -rf %t-dir && mkdir -p %t-dir && cd %t-dir
22+
! RUN: cp %s . && cp %S/Inputs/hello-world.f90 .
23+
! RUN: %flang-new -fc1 -test-io hello-world.f90 multiple-input-files.f90 2>&1 \
24+
! RUN: && FileCheck %s --input-file=multiple-input-files.txt --match-full-lines -check-prefix=FC1-OUTPUT1 \
25+
! RUN: && FileCheck %s --input-file=hello-world.txt --match-full-lines -check-prefix=FC1-OUTPUT2
2226

2327
! TEST 4: Only the last input file is processed
2428
! RUN: %flang-new -fc1 -test-io %s %S/Inputs/hello-world.f90 -o %t 2>&1 \

0 commit comments

Comments
 (0)