diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2006-04-20 11:15:03 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2006-04-20 11:15:03 +0000 |
commit | 16db6e11426e9d6751d853023a8cbdfa284655cb (patch) | |
tree | 3d080c3cdd2f242017573d99666c4e18580365bc /dmake/tests | |
parent | de45f7e775ef1ca39642e46a4e0f0b678df2a028 (diff) |
INTEGRATION: CWS dmake43p01 (1.1.2); FILE ADDED
2005/06/02 03:41:19 vq 1.1.2.1: #i39248# Add testsuite for dmake (only tor targets using the autotools).
Diffstat (limited to 'dmake/tests')
-rwxr-xr-x | dmake/tests/function_macros-1 | 96 | ||||
-rwxr-xr-x | dmake/tests/function_macros-2 | 64 |
2 files changed, 160 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 diff --git a/dmake/tests/function_macros-2 b/dmake/tests/function_macros-2 new file mode 100755 index 000000000000..c17501f2aa5d --- /dev/null +++ b/dmake/tests/function_macros-2 @@ -0,0 +1,64 @@ +#!/bin/sh + +# 01.06.2005 Volker Quetschke +# Tests for dmake function macros - part 2. +# (issue 36027, issue 37053, issue 37491) + +: ${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 +PAT:=Z + +all: + +@echo -e '\n\$\$(shell ...) section' + +test ":123:" = ":\$(shell echo 123 ):" + +test ":123:" = ":\$(shell \ + echo 123 ):" + +test ":123:" = ":\$(shell echo \ + 123 ):" + + +@echo -e '\n\$\$(sort ...) section' + +test ":a b c:" = ":\$(sort c a b ):" + +test ":a b c:" = ":\$(sort\ + c a b ):" + +test ":a b c:" = ":\$(sort c \ + a b ):" + + +@echo -e '\n\$\$(strip ...) section' + +test ":c a b:" = ":\$(strip c a b ):" + +test ":c a b:" = ":\$(strip c \ + a b ):" + + +@echo -e '\n\$\$(subst ...) section' + +test ":aZbZc:" = ":\$(subst,\$(SPACECHAR),\$(PAT) \$(TEST1)):" + +test ":aZbZc:" = ":\$(subst,%Z*Z%,\$(PAT) \$(TEST1:s/ /%Z*Z%/)):" + +test ":aZbZc:" = ":\$(subst,Y,\$(PAT) aYbYc ):" + +test ":aZbZc:" = ":{\$(subst,Y,Z aYbYc )}:" +# Undefined +# +test ":Should error out:BUG:\$(subst, ,\$(PAT) \$(TEST1)):" + + +@echo -e '\n\$\$(uniq ...) section' + +test ":a b c:" = ":\$(uniq c a b c ):" + +test ":a b c:" = ":\$(uniq c \ + a b c ):" + +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 |