diff --git a/flang/test/Frontend/input-output-file.f90 b/flang/test/Frontend/input-output-file.f90 --- a/flang/test/Frontend/input-output-file.f90 +++ b/flang/test/Frontend/input-output-file.f90 @@ -6,20 +6,19 @@ ! FLANG DRIVER (flang-new) !-------------------------- ! TEST 1: Print to stdout (implicit) -! RUN: %flang-new -test-io %s 2>&1 | FileCheck %s +! RUN: %flang-new -test-io %s 2>&1 | FileCheck %s --match-full-lines ! TEST 2: Print to stdout (explicit) -! RUN: %flang-new -test-io -o - %s 2>&1 | FileCheck %s +! RUN: %flang-new -test-io -o - %s 2>&1 | FileCheck %s --match-full-lines ! TEST 3: Print to a file -! RUN: %flang-new -test-io -o %t %s 2>&1 && FileCheck %s --input-file=%t +! RUN: %flang-new -test-io -o %t %s 2>&1 && FileCheck %s --match-full-lines --input-file=%t !---------------------------------------- ! FLANG FRONTEND DRIVER (flang-new -fc1) !---------------------------------------- ! TEST 4: Write to a file (implicit) -! RUN: %flang-new -fc1 -test-io %s 2>&1 && FileCheck %s --input-file=%S/input-output-file.txt +! RUN: %flang-new -fc1 -test-io %s 2>&1 && FileCheck %s --match-full-lines --input-file=%S/input-output-file.txt ! TEST 5: Write to a file (explicit) -! RUN: %flang-new -fc1 -test-io -o %t %s 2>&1 && FileCheck %s --input-file=%t - +! RUN: %flang-new -fc1 -test-io -o %t %s 2>&1 && FileCheck %s --match-full-lines --input-file=%t !----------------------- ! EXPECTED OUTPUT @@ -32,4 +31,4 @@ Program arithmetic Integer :: i, j i = 2; j = 3; i= i * j; -End Program arithmetic \ No newline at end of file +End Program arithmetic diff --git a/flang/test/Frontend/multiple-input-files.f90 b/flang/test/Frontend/multiple-input-files.f90 --- a/flang/test/Frontend/multiple-input-files.f90 +++ b/flang/test/Frontend/multiple-input-files.f90 @@ -6,54 +6,62 @@ ! FLANG DRIVER (flang-new) !-------------------------- ! TEST 1: Both input files are processed (output is printed to stdout) -! RUN: %flang-new -test-io %s %S/Inputs/hello-world.f90 | FileCheck %s -check-prefix=flang-new +! RUN: %flang-new -test-io %s %S/Inputs/hello-world.f90 | FileCheck %s --match-full-lines -check-prefix=FLANG ! TEST 2: None of the files is processed (not possible to specify the output file when multiple input files are present) -! RUN: not %flang-new -test-io -o - %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s -check-prefix=ERROR -! RUN: not %flang-new -test-io -o %t %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s -check-prefix=ERROR +! RUN: not %flang-new -test-io -o - %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR +! RUN: not %flang-new -test-io -o %t %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR !---------------------------------------- ! 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 -check-prefix=flang-new-FC1-OUTPUT1 +! 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 ! TEST 4: Only the last input file is processed -! RUN: %flang-new -fc1 -test-io %S/Inputs/hello-world.f90 %s -o %t 2>&1 \ -! RUN: && FileCheck %s --input-file=%t -check-prefix=flang-new-FC1-OUTPUT1 +! RUN: %flang-new -fc1 -test-io %s %S/Inputs/hello-world.f90 -o %t 2>&1 \ +! RUN: && FileCheck %s --input-file=%t --match-full-lines -check-prefix=FC1-OUTPUT3 !----------------------- ! EXPECTED OUTPUT !----------------------- ! TEST 1: By default, `flang-new` prints the output from all input files to ! stdout -! flang-new-LABEL: Program arithmetic -! flang-new-NEXT: Integer :: i, j -! flang-new-NEXT: i = 2; j = 3; i= i * j; -! flang-new-NEXT: End Program arithmetic -! flang-new-NEXT: !This is a test file with a hello world in Fortran -! flang-new-NEXT:program hello -! flang-new-NEXT: implicit none -! flang-new-NEXT: write(*,*) 'Hello world!' -! flang-new-NEXT:end program hello - +! FLANG-LABEL: Program arithmetic +! FLANG-NEXT: Integer :: i, j +! FLANG-NEXT: i = 2; j = 3; i= i * j; +! FLANG-NEXT: End Program arithmetic +! FLANG-NEXT:!This is a test file with a hello world in Fortran +! FLANG-NEXT:program hello +! FLANG-NEXT: implicit none +! FLANG-NEXT: write(*,*) 'Hello world!' +! FLANG-NEXT:end program hello ! TEST 2: `-o` does not work for `flang-new` when multiple input files are present -! ERROR:error: cannot specify -o when generating multiple output files - - -! TEST 3 & TEST 4: Unless the output file is specified, `flang-new -fc1` generates one output file for every input file. If an -! output file is specified (with `-o`), then only the last input file is processed. -! flang-new-FC1-OUTPUT1-LABEL: Program arithmetic -! flang-new-FC1-OUTPUT1-NEXT: Integer :: i, j -! flang-new-FC1-OUTPUT1-NEXT: i = 2; j = 3; i= i * j; -! flang-new-FC1-OUTPUT1-NEXT: End Program arithmetic -! flang-new-FC1-OUTPUT1-NEXT: !This is a test file with a hello world in Fortran -! flang-new-FC1-OUTPUT1-NEXT:program hello -! flang-new-FC1-OUTPUT1-NEXT: implicit none -! flang-new-FC1-OUTPUT1-NEXT: write(*,*) 'Hello world!' -! flang-new-FC1-OUTPUT1-NEXT:end program hello +! ERROR: flang-new: error: cannot specify -o when generating multiple output files + +! TEST 3 The output file _was not_ specified - `flang-new -fc1` will process all +! input files and generate one output file for every input file. +! FC1-OUTPUT1-LABEL: Program arithmetic +! FC1-OUTPUT1-NEXT: Integer :: i, j +! FC1-OUTPUT1-NEXT: i = 2; j = 3; i= i * j; +! FC1-OUTPUT1-NEXT: End Program arithmetic + +! FC1-OUTPUT2-LABEL:!This is a test file with a hello world in Fortran +! FC1-OUTPUT2-NEXT:program hello +! FC1-OUTPUT2-NEXT: implicit none +! FC1-OUTPUT2-NEXT: write(*,*) 'Hello world!' +! FC1-OUTPUT2-NEXT:end program hello + +! TEST 4: The output file _was_ specified - `flang-new -fc1` will process only +! only the last input file and generate the corresponding output. +! FC1-OUTPUT3-LABEL:!This is a test file with a hello world in Fortran +! FC1-OUTPUT3-NEXT:program hello +! FC1-OUTPUT3-NEXT: implicit none +! FC1-OUTPUT3-NEXT: write(*,*) 'Hello world!' +! FC1-OUTPUT3-NEXT:end program hello Program arithmetic