brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 0242db2 Raw
66 lines · plain
1 2!--------------------------3! FLANG DRIVER (flang)4!--------------------------5! NOTE: Use `-E` so that the compiler driver stops after the 1st compilation phase, preprocessing. That's all we need.6 7! TEST 1: Both input files are processed (output is printed to stdout)8! RUN: %flang -E %s %S/Inputs/hello.f90 | FileCheck %s --match-full-lines -check-prefix=FLANG9 10! TEST 2: None of the files is processed (not possible to specify the output file when multiple input files are present)11! RUN: not %flang -E -o - %S/Inputs/hello.f90 %s  2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR12! RUN: not %flang -E -o %t %S/Inputs/hello.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR13 14!----------------------------------------15! FLANG FRONTEND DRIVER (flang -fc1)16!----------------------------------------17! TEST 3: Both input files are processed18! This particular test case generates output files in the same directory as the input files. We need to copy the input files into a19! temporary directory to avoid polluting the source directory.20! RUN: rm -rf %t-dir && mkdir -p %t-dir && cd %t-dir21! RUN: cp %s . && cp %S/Inputs/hello.f90 .22! RUN: %flang_fc1 -test-io  hello.f90 multiple-input-files.f90 2>&1 \23! RUN:  && FileCheck %s --input-file=multiple-input-files.txt --match-full-lines -check-prefix=FC1-OUTPUT1 \24! RUN:  && FileCheck %s --input-file=hello.txt --match-full-lines -check-prefix=FC1-OUTPUT225 26! TEST 4: Only the last input file is processed27! RUN: %flang_fc1 -test-io %s %S/Inputs/hello.f90 -o %t 2>&1 \28! RUN:  && FileCheck %s --input-file=%t --match-full-lines -check-prefix=FC1-OUTPUT329 30! TEST 1: By default, `flang` prints the output from all input files to31! stdout32! FLANG-LABEL: Program arithmetic33! FLANG-NEXT:    Integer :: i, j34! FLANG-NEXT:    i = 2; j = 3; i= i * j;35! FLANG-NEXT:  End Program arithmetic36 37! FLANG-LABEL: program hello38! FLANG-NEXT:  write(*,*), "Hello world!"39! FLANG-NEXT:end program hello40 41! TEST 2: `-o` does not when multiple input files are present42! ERROR: flang{{.*}}: error: cannot specify -o when generating multiple output files43 44! TEST 3: The output file _was not_ specified - `flang_fc1` will process all45! input files and generate one output file for every input file.46! FC1-OUTPUT1-LABEL: Program arithmetic47! FC1-OUTPUT1-NEXT:    Integer :: i, j48! FC1-OUTPUT1-NEXT:    i = 2; j = 3; i= i * j;49! FC1-OUTPUT1-NEXT:  End Program arithmetic50 51! FC1-OUTPUT2-LABEL:program hello52! FC1-OUTPUT2-NEXT:  write(*,*), "Hello world!"53! FC1-OUTPUT2-NEXT:end program hello54 55! TEST 4: The output file _was_ specified - `flang_fc1` will process only56! the last input file and generate the corresponding output.57! FC1-OUTPUT3-LABEL:program hello58! FC1-OUTPUT3-NEXT:  write(*,*), "Hello world!"59! FC1-OUTPUT3-NEXT:end program hello60 61 62Program arithmetic63  Integer :: i, j64  i = 2; j = 3; i= i * j;65End Program arithmetic66