2 !--------------------------
4 !--------------------------
5 ! NOTE: Use `-E` so that the compiler driver stops after the 1st compilation phase, preprocessing. That's all we need.
7 ! TEST 1: Print to stdout (implicit)
8 ! RUN: %flang -E %s 2>&1 | FileCheck %s --match-full-lines
10 ! TEST 2: Print to stdout (explicit)
11 ! RUN: %flang -E -o - %s 2>&1 | FileCheck %s --match-full-lines
13 ! TEST 3: Print to a file
14 ! RUN: %flang -E -o %t %s 2>&1 && FileCheck %s --match-full-lines --input-file=%t
16 !----------------------------------------
17 ! FLANG FRONTEND DRIVER (flang -fc1)
18 !----------------------------------------
19 ! TEST 4: Write to a file (implicit)
20 ! This particular test case generates an output file in the same directory as the input file. We need to copy the input file into a
21 ! temporary directory to avoid polluting the source directory.
22 ! RUN: rm -rf %t-dir && mkdir -p %t-dir && cd %t-dir
24 ! RUN: %flang_fc1 -test-io input-output-file.f90 2>&1 && FileCheck %s --match-full-lines --input-file=input-output-file.txt
26 ! TEST 5: Write to a file (explicit)
27 ! RUN: %flang_fc1 -test-io -o %t %s 2>&1 && FileCheck %s --match-full-lines --input-file=%t
29 ! CHECK-LABEL: Program arithmetic
30 ! CHECK-NEXT: Integer :: i, j
31 ! CHECK-NEXT: i = 2; j = 3; i= i * j;
32 ! CHECK-NEXT: End Program arithmetic
36 i
= 2; j
= 3; i
= i
* j
;
37 End Program arithmetic