2020-10-24 19:33:19 +08:00
|
|
|
|
|
|
|
!--------------------------
|
2021-04-09 18:32:31 +08:00
|
|
|
! FLANG DRIVER (flang)
|
2020-10-24 19:33:19 +08:00
|
|
|
!--------------------------
|
2021-02-17 22:13:29 +08:00
|
|
|
! NOTE: Use `-E` so that the compiler driver stops after the 1st compilation phase, preprocessing. That's all we need.
|
|
|
|
|
2020-10-24 19:33:19 +08:00
|
|
|
! TEST 1: Print to stdout (implicit)
|
2021-10-14 16:07:30 +08:00
|
|
|
! RUN: %flang -E %s 2>&1 | FileCheck %s --match-full-lines
|
2021-02-17 22:13:29 +08:00
|
|
|
|
2020-10-24 19:33:19 +08:00
|
|
|
! TEST 2: Print to stdout (explicit)
|
2021-10-14 16:07:30 +08:00
|
|
|
! RUN: %flang -E -o - %s 2>&1 | FileCheck %s --match-full-lines
|
2021-02-17 22:13:29 +08:00
|
|
|
|
2020-10-24 19:33:19 +08:00
|
|
|
! TEST 3: Print to a file
|
2021-10-14 16:07:30 +08:00
|
|
|
! RUN: %flang -E -o %t %s 2>&1 && FileCheck %s --match-full-lines --input-file=%t
|
2020-10-24 19:33:19 +08:00
|
|
|
|
|
|
|
!----------------------------------------
|
2021-04-09 18:32:31 +08:00
|
|
|
! FLANG FRONTEND DRIVER (flang -fc1)
|
2020-10-24 19:33:19 +08:00
|
|
|
!----------------------------------------
|
|
|
|
! TEST 4: Write to a file (implicit)
|
2021-01-16 00:45:01 +08:00
|
|
|
! 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
|
|
|
|
! temporary directory to avoid polluting the source directory.
|
|
|
|
! RUN: rm -rf %t-dir && mkdir -p %t-dir && cd %t-dir
|
|
|
|
! RUN: cp %s .
|
2021-04-09 18:32:31 +08:00
|
|
|
! RUN: %flang_fc1 -test-io input-output-file.f90 2>&1 && FileCheck %s --match-full-lines --input-file=input-output-file.txt
|
2021-02-17 22:13:29 +08:00
|
|
|
|
2020-10-24 19:33:19 +08:00
|
|
|
! TEST 5: Write to a file (explicit)
|
2021-04-09 18:32:31 +08:00
|
|
|
! RUN: %flang_fc1 -test-io -o %t %s 2>&1 && FileCheck %s --match-full-lines --input-file=%t
|
2020-10-24 19:33:19 +08:00
|
|
|
|
|
|
|
!-----------------------
|
|
|
|
! EXPECTED OUTPUT
|
|
|
|
!-----------------------
|
|
|
|
! CHECK-LABEL: Program arithmetic
|
|
|
|
! CHECK-NEXT: Integer :: i, j
|
|
|
|
! CHECK-NEXT: i = 2; j = 3; i= i * j;
|
|
|
|
! CHECK-NEXT: End Program arithmetic
|
|
|
|
|
|
|
|
Program arithmetic
|
|
|
|
Integer :: i, j
|
|
|
|
i = 2; j = 3; i= i * j;
|
2020-11-02 17:34:27 +08:00
|
|
|
End Program arithmetic
|