# file : tests/recipe/buildscript/testscript # license : MIT; see accompanying LICENSE file +mkdir build +cat <=build/bootstrap.build project = test amalgamation = subprojects = using config using test EOI +cat <=build/root.build EOI : update : { : success : { echo 'bar' >=bar; cat <=buildfile; foo: bar {{ cp $path($<) $path($>) }} EOI $* 2>'cp file{foo}'; cat <<'bar'; # While at it, make sure there is no rebuild. # $* 2>/'info: dir{./} is up to date'; $* clean 2>- } : error : : Test that the target file is removed on error and is created on subsequent : successful update. : { echo 'bar' >=bar; cat <=buildfile; foo: bar {{ diag concat $< t = $path($>) p = $path($<) cp $p $t cat $(p).baz >>$t }} EOI $* 2>>~%EOE% != 0; concat file{bar.} %cat: unable to print '.+bar.baz': .+% buildfile:10:3: error: cat exited with code 1 %.+ EOE test -f foo != 0; echo 'baz' >=bar.baz; $* 2>'concat file{bar.}'; cat <<>EOO; bar baz EOO $* clean 2>- } } : clean : { echo 'bar' >=bar; cat <=buildfile; foo: bar {{ cp $path($<) $path($>) }} % [diag=clean] clean {{ t = $path($>) rm $t $(t).d }} EOI $* 2>-; # Rely on the cleanup machinery to verify that the build output files are # removed. # $* clean 2>'clean file{foo}' } : test : { echo 'bar' >=bar; cat <=buildfile; foo: bar {{ cp $path($<) $path($>) }} % [diag=test] test {{ cat <$path($<) >?$path($>) }} EOI $* test 2>>EOE; cp file{foo} test file{foo} EOE $* clean 2>- } : diff-label : { echo 'bar' >=bar; cat <=buildfile; foo: bar {{ echo 'baz' >? $path($<) }} EOI $* 2>>/~%EOE% != 0; %.+ %--- .+/bar% +++ stdout %.+ EOE $* clean 2>- } : timeout : if ($cxx.target.class != 'windows') { : update : { : expired : { echo 'bar' >=bar; cat <=buildfile; foo: bar % [diag=update] {{ cp $path($<) $path($>) timeout 1 ^sleep 5 }} EOI $* 2>>~%EOE% != 0; update file{foo} buildfile:6:3: error: ^sleep terminated: execution timeout expired info: while updating file{foo} %.+ EOE $* clean 2>- } : successful-timeout : { echo 'bar' >=bar; cat <=buildfile; foo: bar % [diag=update] {{ cp $path($<) $path($>) timeout --success 1 ^sleep 5 }} EOI $* 2>>EOE; update file{foo} EOE $* clean 2>- } } : test : { : expired : { echo 'bar' >=bar; cat <=buildfile; foo: bar {{ cp $path($<) $path($>) }} % [diag=test] test {{ ^sleep 5 }} EOI $* test config.test.timeout=1 2>>~%EOE% != 0; cp file{foo} test file{foo} buildfile:7:3: error: ^sleep terminated: execution timeout expired info: while testing file{foo} %.+ EOE $* test config.test.timeout=/1 2>>~%EOE% != 0; test file{foo} buildfile:7:3: error: ^sleep terminated: execution timeout expired info: while testing file{foo} %.+ EOE $* clean 2>- } : not-expired : { echo 'bar' >=bar; cat <=buildfile; foo: bar % [diag=cp] {{ ^sleep 4 cp $path($<) $path($>) }} % [diag=test] test {{ ^sleep 1 }} EOI $* test config.test.timeout=3 2>>EOE; cp file{foo} test file{foo} EOE $* clean 2>- } } }