1! RUN: rm -rf %S/multiple-input-files.txt %S/Inputs/hello-world.txt 2 3! REQUIRES: new-flang-driver 4 5!-------------------------- 6! FLANG DRIVER (flang-new) 7!-------------------------- 8! TEST 1: Both input files are processed (output is printed to stdout) 9! RUN: %flang-new -test-io %s %S/Inputs/hello-world.f90 | FileCheck %s --match-full-lines -check-prefix=FLANG 10 11! TEST 2: None of the files is processed (not possible to specify the output file when multiple input files are present) 12! RUN: not %flang-new -test-io -o - %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR 13! RUN: not %flang-new -test-io -o %t %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR 14 15!---------------------------------------- 16! FLANG FRONTEND DRIVER (flang-new -fc1) 17!---------------------------------------- 18! 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 22 23! TEST 4: Only the last input file is processed 24! RUN: %flang-new -fc1 -test-io %s %S/Inputs/hello-world.f90 -o %t 2>&1 \ 25! RUN: && FileCheck %s --input-file=%t --match-full-lines -check-prefix=FC1-OUTPUT3 26 27!----------------------- 28! EXPECTED OUTPUT 29!----------------------- 30! TEST 1: By default, `flang-new` prints the output from all input files to 31! stdout 32! FLANG-LABEL: Program arithmetic 33! FLANG-NEXT: Integer :: i, j 34! FLANG-NEXT: i = 2; j = 3; i= i * j; 35! FLANG-NEXT: End Program arithmetic 36! FLANG-NEXT:!This is a test file with a hello world in Fortran 37! FLANG-NEXT:program hello 38! FLANG-NEXT: implicit none 39! FLANG-NEXT: write(*,*) 'Hello world!' 40! FLANG-NEXT:end program hello 41 42! TEST 2: `-o` does not work for `flang-new` when multiple input files are present 43! ERROR: flang-new: error: cannot specify -o when generating multiple output files 44 45! TEST 3: The output file _was not_ specified - `flang-new -fc1` will process all 46! input files and generate one output file for every input file. 47! FC1-OUTPUT1-LABEL: Program arithmetic 48! FC1-OUTPUT1-NEXT: Integer :: i, j 49! FC1-OUTPUT1-NEXT: i = 2; j = 3; i= i * j; 50! FC1-OUTPUT1-NEXT: End Program arithmetic 51 52! FC1-OUTPUT2-LABEL:!This is a test file with a hello world in Fortran 53! FC1-OUTPUT2-NEXT:program hello 54! FC1-OUTPUT2-NEXT: implicit none 55! FC1-OUTPUT2-NEXT: write(*,*) 'Hello world!' 56! FC1-OUTPUT2-NEXT:end program hello 57 58! TEST 4: The output file _was_ specified - `flang-new -fc1` will process only 59! the last input file and generate the corresponding output. 60! FC1-OUTPUT3-LABEL:!This is a test file with a hello world in Fortran 61! FC1-OUTPUT3-NEXT:program hello 62! FC1-OUTPUT3-NEXT: implicit none 63! FC1-OUTPUT3-NEXT: write(*,*) 'Hello world!' 64! FC1-OUTPUT3-NEXT:end program hello 65 66 67Program arithmetic 68 Integer :: i, j 69 i = 2; j = 3; i= i * j; 70End Program arithmetic 71