diff options
Diffstat (limited to 'dmake/tests/function_macros-1')
-rwxr-xr-x | dmake/tests/function_macros-1 | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/dmake/tests/function_macros-1 b/dmake/tests/function_macros-1 new file mode 100755 index 000000000000..6e5368005a63 --- /dev/null +++ b/dmake/tests/function_macros-1 @@ -0,0 +1,96 @@ +#!/bin/sh + +# 01.06.2005 Volker Quetschke +# Tests for dmake function macros. (issue 36027, issue 37053) + +: ${DMAKEPROG:=dmake} +file1="mymakefile.mk" +tmpfiles="$file1" + +trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15 + +trap 'rm -rf $tmpfiles' 1 2 3 15 + +# Remember to quote variables in generated makefiles( $ -> \$ ). +cat > $file1 <<EOT +# Testing function macros +SHELL*:=/bin/sh +SHELLFLAGS*:=-ce + +TEST1:=a b c + +all: + @echo \$\$(and ...) section + test "::" = ":\$(and \$(nil) \$(nil) ):" + test ":t:" = ":\$(and a b ):" + test "::" = ":\$(and \$(nil) \ + \$(nil) ):" + test "::" = ":\$(and \ + ):" + + @echo -e \n\$\$(assign ...) section + test ":A:" = ":\$(assign A := B ):" + test "\$(A)" = "B" + test ":A:" = ":\$(assign A\ + := C ):" + test "\$(A)" = "C" + + @echo -e \n\$\$(echo ...) section + test ":123:" = ":\$(echo 123 ):" + test ":123:" = ":\$(echo 123 ):" + test ":123:" = ":\$(echo\ + 123 ):" + test ":123:" = ":\$(echo \ + 123 ):" + + @echo -e \n\$\$(eq ...) section + test ":true:" = ":\$(eq,1,1 true false):" + test ":true:" = ":\$(eq,1,1\ + true false):" + +# These tests need to use a shell + +@echo -e '\n\$\$(foreach ...) section' + +test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) [\$i]):" + +test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) [\$i]):" + +test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) [\$i] ):" + +test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) \ + [\$i] ):" + + @echo -e \n\$\$(nil ...) section + test "::" = ":\$(nil abc):" +# Fails with syntax error + test "::" = ":\$(nil \ + ):" + + @echo -e \n\$\$(not ...) section + test "::" = ":\$(not abc):" + test ":t:" = ":\$(not \$(NULL)):" + test ":t:" = ":\$(not ):" + test ":t:" = ":\$(not \ + ):" + + @echo -e \n\$\$(null ...) section + test ":true:" = ":\$(null, true false):" + test ":false:" = ":\$(null,a true false):" + test ":false:" = ":\$(null,a true false ):" + test ":false:" = ":\$(null,a \ + true false ):" + test ":true:" = ":\$(null, \ + true false ):" + + @echo -e \n\$\$(or ...) section + test "::" = ":\$(or \$(nil) \$(nil) ):" + test ":t:" = ":\$(or a \$(nil) ):" + test "::" = ":\$(or \$(nil) \ + \$(nil) ):" + test "::" = ":\$(or \ + ):" + +EOT + +${DMAKEPROG} -r -f $file1 +result=$? + +test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles} +test $result -ne 0 && echo "Failure!" +exit $result
\ No newline at end of file |