# file : tests/dependency/recipe/testscript # license : MIT; see accompanying LICENSE file .include ../../common.testscript # Note: in the parser we have to handle recipes for the with/without # prerequisites cases separately. So we try to cover both here. : basics : $* <>/~%EOE% alias{x}: alias{z} {{ echo }} dump alias{x} EOI :5:1: dump: % .+/alias\{x\}: .+/:alias\{z\}% % [diag=echo] perform(update) {{ echo }} EOE : basics-replay : $* <>/~%EOE% alias{x y}: alias{z} {{ echo }} dump alias{y} EOI :5:1: dump: % .+/alias\{y\}: .+/:alias\{z\}% % [diag=echo] perform(update) {{ echo }} EOE : basics-header : $* <>/~%EOE% alias{x}: % update clean {{ echo }} dump alias{x} EOI :6:1: dump: % .+/alias\{x\}:% % [diag=echo] perform(update) perform(clean) {{ echo }} EOE : basics-header-replay : $* <>/~%EOE% alias{x y}: % perform(update clean) {{ echo }} dump alias{y} EOI :6:1: dump: % .+/alias\{y\}:% % [diag=echo] perform(update) perform(clean) {{ echo }} EOE : basics-lang : $* <>/~%EOE% alias{x}: {{ c++ 1 void f (); }} dump alias{x} EOI :5:1: dump: % .+/alias\{x\}:% % perform(update) {{ c++ 1 void f (); }} EOE : with-vars : $* <>/~%EOE% alias{x}: { var = x } {{ echo }} dump alias{x} EOI :8:1: dump: % .+/alias\{x\}:% { var = x } % [diag=echo] perform(update) {{ echo }} EOE : with-vars-replay : $* <>/~%EOE% alias{x y}: alias{z} { var = x } {{ echo }} dump alias{y} EOI :8:1: dump: % .+/alias\{y\}: .+/:alias\{z\}% { var = x } % [diag=echo] perform(update) {{ echo }} EOE : with-vars-depchain : $* <>/~%EOE% ./: alias{x}: alias{y} { var = x } {{ echo }} dump alias{x} EOI :8:1: dump: % .+/alias\{x\}: .+/:alias\{y\}% { var = x } % [diag=echo] perform(update) {{ echo }} EOE : with-vars-replay-depchain : $* <>/~%EOE% ./: alias{x y}: alias{z} { var = x } {{ echo }} dump alias{y} EOI :8:1: dump: % .+/alias\{y\}: .+/:alias\{z\}% { var = x } % [diag=echo] perform(update) {{ echo }} EOE : with-vars-header : $* <>/~%EOE% alias{x}: alias{z} { var = x } % perform(update) {{ echo }} dump alias{x} EOI :9:1: dump: % .+/alias\{x\}: .+/:alias\{z\}% { var = x } % [diag=echo] perform(update) {{ echo }} EOE : with-vars-header-replay : $* <>/~%EOE% alias{x y}: { var = x } % perform(update) {{ echo }} dump alias{y} EOI :9:1: dump: % .+/alias\{y\}:% { var = x } % [diag=echo] perform(update) {{ echo }} EOE : chain : $* <>/~%EOE% alias{x}: {{ echo }} % clean {{{ cat }}} dump alias{x} EOI :9:1: dump: % .+/alias\{x\}:% % [diag=echo] perform(update) {{ echo }} % [diag=cat] perform(clean) {{{ cat }}} EOE : chain-replay : $* <>/~%EOE% alias{x y}: alias{z} {{ echo }} % clean {{{ cat }}} dump alias{y} EOI :9:1: dump: % .+/alias\{y\}: .+/:alias\{z\}% % [diag=echo] perform(update) {{ echo }} % [diag=cat] perform(clean) {{{ cat }}} EOE : chain-header : $* <>/~%EOE% alias{x}: alias{z} % clean {{ echo }} % update {{{ cat }}} dump alias{x} EOI :11:1: dump: % .+/alias\{x\}: .+/:alias\{z\}% % [diag=echo] perform(clean) {{ echo }} % [diag=cat] perform(update) {{{ cat }}} EOE : chain-header-replay : $* <>/~%EOE% alias{x y}: % clean {{ echo }} % update {{{ cat }}} dump alias{y} EOI :12:1: dump: % .+/alias\{y\}:% % [diag=echo] perform(clean) {{ echo }} % [diag=cat] perform(update) {{{ cat }}} EOE : unterminated : $* <>EOE != 0 alias{x}: {{{ echo }} EOI :5:1: error: unterminated recipe block :2:1: info: recipe block starts here EOE : expected-lang : $* <>EOE != 0 alias{x}: {{ $lang echo }} EOI :2:4: error: expected recipe language instead of '$' EOE : header-attribute : $* <>/~!EOE! alias{x}: % [diag=gen] {{ echo }} dump alias{x} EOI :6:1: dump: ! .+/alias\{x\}:! % [diag=gen] perform(update) {{ echo }} EOE : header-attribute-replay : $* <>/~!EOE! alias{x y}: % [diag=gen] {{ echo }} dump alias{y} EOI :6:1: dump: ! .+/alias\{y\}:! % [diag=gen] perform(update) {{ echo }} EOE : header-missing-block : $* <>EOE != 0 alias{x}: % { echo } EOI :3:1: error: expected recipe block instead of '{' EOE : duplicate-action-single : $* <>EOE != 0 alias{x}: % update perform(update) {{ echo }} EOI :2:3: error: duplicate recipe for perform(update) EOE : duplicate-action-multiple : $* <>EOE != 0 alias{x}: {{ echo }} % perform(update) {{ echo }} EOI :5:3: error: duplicate recipe for perform(update) EOE : if-else : $* <>/~%EOE% f = false alias{x}: alias{z} % if $f {{ false }} else {{ echo }} dump alias{x} EOI :12:1: dump: % .+/alias\{x\}: .+/:alias\{z\}% % [diag=echo] perform(update) {{ echo }} EOE : if-else-replay : $* <>/~%EOE% f = false alias{x y}: alias{z} % if $f {{ false }} else {{ echo }} dump alias{y} EOI :12:1: dump: % .+/alias\{y\}: .+/:alias\{z\}% % [diag=echo] perform(update) {{ echo }} EOE : if-no-else : $* <>/~%EOE% f = false alias{x}: alias{z} % if $f {{ false }} dump alias{x} EOI :8:1: dump: % .+/alias\{x\}: .+/:alias\{z\}% EOE : switch : $* <>/~%EOE% f = 2 alias{x}: alias{z} % switch $f { case 1 {{ false }} case 2 {{ echo }} default {{ false }} } dump alias{x} EOI :19:1: dump: % .+/alias\{x\}: .+/:alias\{z\}% % [diag=echo] perform(update) {{ echo }} EOE : switch-replay : $* <>/~%EOE% f = 2 alias{x y}: alias{z} % switch $f { case 1 {{ false }} case 2 {{ echo }} default {{ false }} } dump alias{y} EOI :19:1: dump: % .+/alias\{y\}: .+/:alias\{z\}% % [diag=echo] perform(update) {{ echo }} EOE : switch-no-default : $* <>/~%EOE% f = 2 alias{x}: alias{z} % switch $f { case 0 {{ false }} case 1 {{ echo }} } dump alias{x} EOI :15:1: dump: % .+/alias\{x\}: .+/:alias\{z\}% EOE : diag : { : builtins : { : weight-0 : $* <>EOE != 0 alias{x}: {{ exit }} dump alias{x} EOI :3:1: error: unable to deduce low-verbosity script diagnostics name info: consider specifying it explicitly with the 'diag' recipe attribute info: or provide custom low-verbosity diagnostics with the 'diag' builtin EOE : weight-1 : $* <>~%EOE% alias{x}: {{ true rm b }} dump alias{x} EOI %.{2} % [diag=rm] perform(update) %.{4} EOE : weight-2 : $* <>~%EOE% alias{x}: {{ rm a echo a }} dump alias{x} EOI %.{2} % [diag=echo] perform(update) %.{4} EOE : ambiguity : $* <>EOE != 0 alias{x}: {{ echo a cat b }} dump alias{x} EOI :3:1: error: low-verbosity script diagnostics name is ambiguous :3:3: info: could be 'echo' :4:3: info: could be 'cat' info: consider specifying it explicitly with the 'diag' recipe attribute info: or provide custom low-verbosity diagnostics with the 'diag' builtin EOE } : process-path-ex : { config_cxx = config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true) mkdir build; cat <=build/bootstrap.build; project = test amalgamation = subprojects = using config EOI cat <=build/root.build; using cxx EOI $* $config_cxx <>~%EOE% c = $cxx.path --version alias{x}: {{ $c }} dump alias{x} EOI %.{2} % [diag=c++] perform(update) %.{3} EOE } : unrecognized : { : expansion-failure : $* <>EOE != 0 alias{x}: {{ x = true ech($x ? o : a) }} dump alias{x} EOI :4:8: error: invalid bool value: null :4:11: info: use the '\?' escape sequence if this is a wildcard pattern :4:4: info: while deducing low-verbosity script diagnostics name info: consider specifying it explicitly with the 'diag' recipe attribute info: or provide custom low-verbosity diagnostics with the 'diag' builtin EOE : empty : $* <>EOE != 0 alias{x}: {{ foo = bar $foo }} dump alias{x} EOI :4:3: error: unable to deduce low-verbosity script diagnostics name info: consider specifying it explicitly with the 'diag' recipe attribute info: or provide custom low-verbosity diagnostics with the 'diag' builtin EOE : process-path-typed : $* <>~%EOE% != 0 alias{x}: {{ $build.path --version }} dump alias{x} EOI %:3:4: error: unable to deduce low-verbosity script diagnostics name from process path .+% info: consider specifying it explicitly with the 'diag' recipe attribute info: or provide custom low-verbosity diagnostics with the 'diag' builtin EOE : process-path-syntactic : $* <>~%EOE% != 0 b = $build.path alias{x}: {{ $b --version }} dump alias{x} EOI %:4:4: error: unable to deduce low-verbosity script diagnostics name from process path .+% info: consider specifying it explicitly with the 'diag' recipe attribute info: or provide custom low-verbosity diagnostics with the 'diag' builtin EOE : target-no-name : : Disable when cross-testing for the sake of simplicity. : #\ # @@ There is now metadata and name in exe{b}. if ($test.target == $build.host) { $* <>/~%EOE% != 0 import! b = build2%exe{b} alias{x}: $b {{ $b --version }} dump alias{x} EOI %:5:3: error: unable to deduce low-verbosity script diagnostics name from target .+/exe\{b\}% info: consider specifying it explicitly with the 'diag' recipe attribute info: or provide custom low-verbosity diagnostics with the 'diag' builtin EOE } #\ : program : $* <>~%EOE% != 0 alias{x}: {{ echo a foo }} dump alias{x} EOI :4:3: error: unable to deduce low-verbosity script diagnostics name for program foo info: consider specifying it explicitly with the 'diag' recipe attribute info: or provide custom low-verbosity diagnostics with the 'diag' builtin EOE } : manual : { : attribute : $* <>~%EOE% alias{x}: % [diag=foo] {{ rm a echo b | set c bar }} dump alias{x} EOI %.{2} % [diag=foo] perform(update) %.{5} EOE : diag : $* <>~%EOE% v = a b alias{x}: {{ rm a echo b | set c diag bar fo$v }} dump alias{x} EOI %. % .+alias\{x\}:% % perform(update) {{ diag bar %.{4} EOE } }