[llvm-branch-commits] [flang] 8298ec2 - [flang][driver] Copy input files into a temp dir when testing
Andrzej Warzynski via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 11 06:10:01 PST 2021
Author: Andrzej Warzynski
Date: 2021-01-11T13:54:19Z
New Revision: 8298ec2d6299a95d2920cb8ee993ac6c5e604097
URL: https://github.com/llvm/llvm-project/commit/8298ec2d6299a95d2920cb8ee993ac6c5e604097
DIFF: https://github.com/llvm/llvm-project/commit/8298ec2d6299a95d2920cb8ee993ac6c5e604097.diff
LOG: [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
Added:
Modified:
flang/test/Frontend/multiple-input-files.f90
Removed:
################################################################################
diff --git a/flang/test/Frontend/multiple-input-files.f90 b/flang/test/Frontend/multiple-input-files.f90
index 04fe25fdf6f3..f1fb7d1caae3 100644
--- a/flang/test/Frontend/multiple-input-files.f90
+++ b/flang/test/Frontend/multiple-input-files.f90
@@ -16,9 +16,13 @@
! FLANG FRONTEND DRIVER (flang-new -fc1)
!----------------------------------------
! TEST 3: Both input files are processed
-! RUN: %flang-new -fc1 -test-io %S/Inputs/hello-world.f90 %s 2>&1 \
-! RUN: && FileCheck %s --input-file=%S/multiple-input-files.txt --match-full-lines -check-prefix=FC1-OUTPUT1 \
-! RUN: && FileCheck %s --input-file=%S/Inputs/hello-world.txt --match-full-lines -check-prefix=FC1-OUTPUT2
+! 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-new -fc1 -test-io hello-world.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
! TEST 4: Only the last input file is processed
! RUN: %flang-new -fc1 -test-io %s %S/Inputs/hello-world.f90 -o %t 2>&1 \
More information about the llvm-branch-commits
mailing list