Changeset 280 in kBuild for branches/GNU/src/gmake/tests/scripts/test_template
- Timestamp:
- May 16, 2005 4:54:02 PM (20 years ago)
- Location:
- branches/GNU/src/gmake
- Files:
-
- 2 edited
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/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.