Changeset 280 for branches/GNU/src/gmake/tests/scripts
- Timestamp:
- May 16, 2005, 6:54:02 PM (21 years ago)
- Location:
- branches/GNU/src/gmake
- Files:
-
- 5 edited
-
. (modified) (1 prop)
-
tests/scripts/features/conditionals (modified) (5 diffs)
-
tests/scripts/features/echoing (modified) (1 diff)
-
tests/scripts/features/errors (modified) (3 diffs)
-
tests/scripts/test_template (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gmake
- Property svn:ignore
-
old new 34 34 README.DOS 35 35 README.W32 36 README.OS2 36 37 aclocal.m4 37 38 autom4te.cache
-
- Property svn:ignore
-
branches/GNU/src/gmake/tests/scripts/features/conditionals
r153 r280 4 4 $details = "Attempt various different flavors of GNU make conditionals."; 5 5 6 open(MAKEFILE,"> $makefile"); 7 8 # The Contents of the MAKEFILE ... 9 10 print MAKEFILE <<'EOMAKE'; 11 objects = foo.obj 6 run_make_test(' 12 7 arg1 = first 13 8 arg2 = second … … 23 18 endif 24 19 25 ifeq '$(arg2)' "$(arg5)"20 ifeq \'$(arg2)\' "$(arg5)" 26 21 @echo arg2 equals arg5 27 22 else … … 29 24 endif 30 25 31 ifneq '$(arg3)' '$(arg4)'26 ifneq \'$(arg3)\' \'$(arg4)\' 32 27 @echo arg3 NOT equal arg4 33 28 else … … 44 39 else 45 40 @echo arg4 is NOT defined 46 endif 47 48 EOMAKE 49 50 close(MAKEFILE); 51 52 &run_make_with_options($makefile,"",&get_logfile,0); 53 54 $answer = "arg1 NOT equal arg2 41 endif', 42 '', 43 'arg1 NOT equal arg2 55 44 arg2 equals arg5 56 45 arg3 NOT equal arg4 57 46 variable is undefined 58 arg4 is defined 59 "; 60 61 &compare_output($answer,&get_logfile(1)); 47 arg4 is defined'); 62 48 63 49 64 50 # Test expansion of variables inside ifdef. 65 51 66 $makefile2 = &get_tmpfile; 67 68 open(MAKEFILE, "> $makefile2"); 69 70 print MAKEFILE <<'EOF'; 71 52 run_make_test(' 72 53 foo = 1 73 54 … … 93 74 endif 94 75 95 all:; @echo DEF=$(DEF) DEF2=$(DEF2) DEF3=$(DEF3) 76 all:; @echo DEF=$(DEF) DEF2=$(DEF2) DEF3=$(DEF3)', 77 '', 78 'DEF=yes DEF2=yes DEF3=yes'); 96 79 97 EOF98 80 99 close(MAKEFILE) 81 # Test all the different "else if..." constructs 100 82 101 &run_make_with_options($makefile2,"",&get_logfile,0); 102 $answer = "DEF=yes DEF2=yes DEF3=yes\n"; 103 &compare_output($answer,&get_logfile(1)); 83 run_make_test(' 84 arg1 = first 85 arg2 = second 86 arg3 = third 87 arg4 = cc 88 arg5 = fifth 89 90 result = 91 92 ifeq ($(arg1),$(arg2)) 93 result += arg1 equals arg2 94 else ifeq \'$(arg2)\' "$(arg5)" 95 result += arg2 equals arg5 96 else ifneq \'$(arg3)\' \'$(arg3)\' 97 result += arg3 NOT equal arg4 98 else ifndef arg5 99 result += variable is undefined 100 else ifdef undefined 101 result += arg4 is defined 102 else 103 result += success 104 endif 105 106 107 all: ; @echo $(result)', 108 '', 109 'success'); 110 111 112 # Test some random "else if..." construct nesting 113 114 run_make_test(' 115 arg1 = first 116 arg2 = second 117 arg3 = third 118 arg4 = cc 119 arg5 = second 120 121 ifeq ($(arg1),$(arg2)) 122 $(info failed 1) 123 else ifeq \'$(arg2)\' "$(arg2)" 124 ifdef undefined 125 $(info failed 2) 126 else 127 $(info success) 128 endif 129 else ifneq \'$(arg3)\' \'$(arg3)\' 130 $(info failed 3) 131 else ifdef arg5 132 $(info failed 4) 133 else ifdef undefined 134 $(info failed 5) 135 else 136 $(info failed 6) 137 endif 138 139 .PHONY: all 140 all: ; @:', 141 '', 142 'success'); 104 143 105 144 -
branches/GNU/src/gmake/tests/scripts/features/echoing
r53 r280 55 55 56 56 &run_make_with_options($makefile,"clean",&get_logfile,0); 57 $answer = ""; 58 &compare_output($answer,&get_logfile(1)); 59 60 if (-f $example) 61 { 62 $test_passed = 0; 57 if (-f $example) { 58 $test_passed = 0; 63 59 } 60 &compare_output('',&get_logfile(1)); 64 61 65 62 # TEST #3 -
branches/GNU/src/gmake/tests/scripts/features/errors
r53 r280 53 53 &run_make_with_options($makefile,"",&get_logfile); 54 54 55 # If make acted as planned, it should ignore the error from the first 56 # command in the target and execute the second which deletes the file "foo" 57 # This file, therefore, should not exist if the test PASSES. 58 if (-f "foo") { 59 $test_passed = 0; 60 } 61 55 62 # The output for this on VOS is too hard to replicate, so we only check it 56 63 # on unix. … … 58 65 { 59 66 &compare_output($answer,&get_logfile(1)); 60 }61 62 # If make acted as planned, it should ignore the error from the first63 # command in the target and execute the second which deletes the file "foo"64 # This file, therefore, should not exist if the test PASSES.65 if (-f "foo")66 {67 $test_passed = 0;68 67 } 69 68 … … 81 80 &run_make_with_options($makefile,"clean2 -i",&get_logfile); 82 81 83 if (!$vos) 84 { 82 if (-f "foo") { 83 $test_passed = 0; 84 } 85 86 if (!$vos) { 85 87 &compare_output($answer,&get_logfile(1)); 86 88 } 87 89 88 if (-f "foo")89 {90 $test_passed = 0;91 }92 93 90 1; -
branches/GNU/src/gmake/tests/scripts/test_template
r53 r280 1 $description = "The following test creates a makefile to ... 2 <FILL IN DESCRIPTION HERE> "; 1 # -*-perl-*- 3 2 3 $description = "<FILL IN SHORT DESCRIPTION HERE>"; 4 4 $details = "<FILL IN DETAILS OF HOW YOU TEST WHAT YOU SAY YOU ARE TESTING>"; 5 5 6 # IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET 7 # THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF 8 # HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END. 9 # EXAMPLE: $makefile2 = &get_tmpfile; 6 # Run a make test. See the documentation of run_make_test() in 7 # run_make_tests.pl, but briefly the first argument is a string with the 8 # contents of a makefile to be tested, the second is a string containing the 9 # arguments to be passed to the make invocation, the third is a string 10 # containing the expected output. The fourth is the expected exit code for 11 # make. If not specified, it's assumed that the make program should succeed 12 # (exit with 0). 10 13 11 open(MAKEFILE,"> $makefile"); 14 run_make_test('Your test makefile goes here', 15 'Arguments to pass to make go here', 16 'Expected output from the invocation goes here'); 12 17 13 # The Contents of the MAKEFILE ... 18 # There are various special tokens, options, etc. See the full documentation 19 # in run_make_tests.pl. 14 20 15 print MAKEFILE " <FILL IN THE CONTENTS OF THE MAKEFILE HERE> \n";16 17 # END of Contents of MAKEFILE18 19 close(MAKEFILE);20 21 22 # Run make. You may specify a makefile, but if you don't want to, just23 # insert "" where $make_filename is now. You may also specify specific24 # options to run make with, but you also don't have to. (Insert "" where it25 # says <FILL IN OPTIONS HERE>), The last field in this subroutine call26 # is the code which is returned from make. If you think that make should27 # execute with no errors, you may OPTIONALLY put 0; Otherwise put the28 # error code that you expect back from make for this test.29 30 # Every time you run make, you just need to say &get_logfile and that31 # subroutine will get a new logfile name for you in incrementing order32 # according to how many times you call it within ONE test. It is33 # reset to 0 at the beginning of every new test script.34 35 &run_make_with_options($makefile,36 "<FILL IN OPTIONS HERE>",37 &get_logfile,38 0);39 40 41 # THE REST OF THIS FILE DEPENDS HIGHLY ON WHAT KIND OF TEST YOU ARE42 # CREATING, SO IT WILL VARY. BASICALLY, YOU MAY INSERT ANYTHING YOU43 # WISH AT THIS POINT TO SEE IF THE TEST WORKED OK. IF THERE ARE44 # ADDITIONAL TESTS BESIDES &compare_output, AND IT FAILES, YOU45 # MUST *** SET $test_passed = 0 !!! ***46 47 # Create the answer to what should be produced by this Makefile48 $answer = "<INSERT ANSWER HERE>";49 50 # COMPARE RESULTS51 52 # In this call to compare output, you should use the call &get_logfile(1)53 # to send the name of the last logfile created. You may also use54 # the special call &get_logfile(1) which returns the same as &get_logfile(1).55 56 &compare_output($answer,&get_logfile(1));57 58 # If you wish to &error ("abort59 ") if the compare fails, then add a "|| &error ("abort60 ")" to the61 # end of the previous line.62 21 63 22 # This tells the test driver that the perl test script executed properly.
Note:
See TracChangeset
for help on using the changeset viewer.
