| # Check that we handle commands with multiple outputs properly. |
| # |
| # We use a Shake ยง6.3 inspired script which separates the input into odd and |
| # even numbers, and only updates the output when changed. |
| |
| # RUN: rm -rf %t.build |
| # RUN: mkdir -p %t.build |
| # RUN: cp %S/Inputs/split-numbers %t.build |
| # RUN: cp %s %t.build/build.ninja |
| # RUN: touch %t.build/input |
| # RUN: %{llbuild} ninja build --jobs 1 --chdir %t.build &> %t1.out |
| # RUN: %{FileCheck} --check-prefix CHECK-INITIAL --input-file %t1.out %s |
| # |
| # CHECK-INITIAL: [1/{{.*}}] ./split-numbers < input odd even |
| # CHECK-INITIAL: [2/{{.*}}] cat odd > odd-copy |
| # CHECK-INITIAL: [3/{{.*}}] cat even > even-copy |
| |
| # Add an even number, and check that only the even side rebuilds. |
| # |
| # RUN: echo 0 >> %t.build/input |
| # RUN: %{llbuild} ninja build --strict --jobs 1 --chdir %t.build &> %t2.out |
| # RUN: %{FileCheck} --check-prefix CHECK-UPDATE-EVEN --input-file %t2.out %s |
| # |
| # CHECK-UPDATE-EVEN: [1/{{.*}}] ./split-numbers < input odd even |
| # CHECK-UPDATE-EVEN-NEXT: odd: file contents unchanged |
| # CHECK-UPDATE-EVEN-NEXT: even: updated file |
| # CHECK-UPDATE-EVEN-NEXT: [2/{{.*}}] cat even > even-copy |
| # CHECK-UPDATE-EVEN-NOT: [3/{{.*}}] |
| |
| # Add an odd number, and check that only the odd side rebuilds. |
| # |
| # RUN: echo 1 >> %t.build/input |
| # RUN: %{llbuild} ninja build --strict --jobs 1 --chdir %t.build &> %t3.out |
| # RUN: %{FileCheck} --check-prefix CHECK-UPDATE-ODD --input-file %t3.out %s |
| # |
| # CHECK-UPDATE-ODD: [1/{{.*}}] ./split-numbers < input odd even |
| # CHECK-UPDATE-ODD-NEXT: odd: updated file |
| # CHECK-UPDATE-ODD-NEXT: even: file contents unchanged |
| # CHECK-UPDATE-ODD-NEXT: [2/{{.*}}] cat odd > odd-copy |
| # CHECK-UPDATE-ODD-NOT: [3/{{.*}}] |
| |
| rule CAT |
| command = cat ${in} > ${out} |
| rule SPLITNUMBERS |
| command = ./split-numbers < ${in} ${out} |
| restat = 1 |
| |
| build odd even: SPLITNUMBERS input |
| build odd-copy: CAT odd |
| build even-copy: CAT even |
| |
| # Also check multiple outputs of a phony rule. |
| build output-1 output-2: phony odd-copy even-copy |