1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
# Check the handling of inputs that also have phony edges.
# Check that we handle phony rules for actual input files properly, and rebuild
# targets that depend on them if the input actually exists and it changes.
# RUN: rm -rf %t.build
# RUN: mkdir -p %t.build
# RUN: cp %s %t.build/build.ninja
# RUN: ln -s %S/Inputs %t.build/Inputs
# Check that the initial build creates 'output' properly, even though 'input'
# does not exist.
#
# RUN: %{llbuild} ninja build --jobs 1 --chdir %t.build &> %t1.out
# RUN: %{FileCheck} --check-prefix=CHECK-INITIAL < %t1.out %s
# RUN: %{FileCheck} --check-prefix=CHECK-OUTPUT-INITIAL < %t.build/output %s
#
# CHECK-INITIAL: SIZING input TO output
# CHECK-OUTPUT-INITIAL: input does not exist
# Check that a rebuild continues to run the output rule.
#
# RUN: %{llbuild} ninja build --jobs 1 --chdir %t.build &> %t1.out
# RUN: %{FileCheck} --check-prefix=CHECK-NEXT < %t1.out %s
# RUN: %{FileCheck} --check-prefix=CHECK-OUTPUT-NEXT < %t.build/output %s
#
# CHECK-NEXT: SIZING input TO output
# CHECK-OUTPUT-NEXT: input does not exist
# Check that the output rule gets rebuilt when we create 'input'.
#
# RUN: touch %t.build/input
# RUN: %{llbuild} ninja build --strict --jobs 1 --chdir %t.build &> %t1.out
# RUN: %{FileCheck} --check-prefix=CHECK-WITH-INPUT < %t1.out %s
# RUN: %{FileCheck} --check-prefix=CHECK-OUTPUT-WITH-INPUT < %t.build/output %s
#
# CHECK-WITH-INPUT: SIZING input TO output
# CHECK-OUTPUT-WITH-INPUT: input size: 0
# Check that the output rule no longer gets rebuilt ever build.
#
# RUN: %{llbuild} ninja build --jobs 1 --chdir %t.build &> %t1.out
# RUN: %{FileCheck} --check-prefix=CHECK-NEXT-WITH-INPUT < %t1.out %s
#
# CHECK-NEXT-WITH-INPUT: no work to do
# Check that the output rule does get rebuilt if input changes.
#
# RUN: echo -n "X" > %t.build/input
# RUN: %{llbuild} ninja build --strict --jobs 1 --chdir %t.build &> %t1.out
# RUN: %{FileCheck} --check-prefix=CHECK-WITH-NEW-INPUT < %t1.out %s
# RUN: %{FileCheck} --check-prefix=CHECK-OUTPUT-WITH-NEW-INPUT < %t.build/output %s
#
# CHECK-WITH-NEW-INPUT: SIZING input TO output
# CHECK-OUTPUT-WITH-NEW-INPUT: input size: 1
rule GETSIZE
command = if [ -f $in ]; then echo "input size: $$(Inputs/get-file-size $in)"; else echo "input does not exist"; fi > $out
description = SIZING $in TO $out
build input: phony
build output: GETSIZE input
default output
|