diff --git a/usr.bin/lseg/tests/dotests b/usr.bin/lseg/tests/dotests new file mode 100644 index 0000000..ebd87af --- /dev/null +++ b/usr.bin/lseg/tests/dotests @@ -0,0 +1,53 @@ +# Tests for lseg command; invoked by command file "fulltests" +# Written by Dave Tribby (September 1997) +# $Id: dotests,v 1.1 1997/09/28 16:41:37 gdr Exp $ + +# Location of the lseg command to be tested +set testcmd="../lseg" + +# Record starting time +echo -n "Testing command $testcmd beginning at" +date + +set src="procs" +set cmp="out.${src}" +set dest="/tmp/$cmp" +echo "Listing segments in files " ${src}* +$testcmd ${src}* > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set cmp="outd.${src}" +set dest="/tmp/$cmp" +echo "Listing segments (decimal) in files " ${src}* +$testcmd -d ${src}* > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set src="omf1format" +set cmp="out.omf1" +set dest="/tmp/$cmp" +echo "Listing segments in an OMF version 1 file" +$testcmd $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + + +echo "***** Error Messages *****" + +set dest="/tmp/err.cond" + +echo "" +set src="badname" +echo "Expected error: $src: no such file or directory" +$testcmd $src > $dest +echo " Error completion status = $status (expected: 1)" diff --git a/usr.bin/lseg/tests/fulltests b/usr.bin/lseg/tests/fulltests new file mode 100644 index 0000000..f62a534 --- /dev/null +++ b/usr.bin/lseg/tests/fulltests @@ -0,0 +1,29 @@ +# gsh script to run tests and collect results +# Written by Dave Tribby * September 1997 +# $Id: fulltests,v 1.1 1997/09/28 16:41:37 gdr Exp $ + +# Name of gsh script containing test cases +set command="dotests" +# Sometimes the file type is modified by editing; make it executable +chtyp -l exec $command + +# Filenames for raw and modified results +set raw_file="/tmp/rawlist" +set result_file="test.list" + +# Location of tr command that knows how to handle classes +set trcmd="/src/gno/usr.bin/tr/tr" + +# --- Begin the tests --- + +echo -n "Executing test script \"$command\" from directory " +pwd + +# Create a new gsh invocation and record all I/O +echo "$command ; exit" | script $raw_file + +# Cleanup control chars using either of the following... +echo "Done with tests. Removing control characters from results file" +$trcmd -c -ds '[:print:]\r' '\r' < $raw_file > $result_file + +echo "Tests results have been saved as \"$result_file\"" diff --git a/usr.bin/lseg/tests/make.procs b/usr.bin/lseg/tests/make.procs new file mode 100644 index 0000000..23fe075 --- /dev/null +++ b/usr.bin/lseg/tests/make.procs @@ -0,0 +1,9 @@ +# gsh command file to create the files for test lseg: +# procs.o output from compiler +# procs output from linker (executable) +# procs.lib output from makelib (library) + +17/occ -i -v -w -a0 procs.c -o procs + +rm -f procs.lib +makelib -P procs.lib +procs.o diff --git a/usr.bin/lseg/tests/omf1format b/usr.bin/lseg/tests/omf1format new file mode 100644 index 0000000..56982f2 Binary files /dev/null and b/usr.bin/lseg/tests/omf1format differ diff --git a/usr.bin/lseg/tests/out.omf1 b/usr.bin/lseg/tests/out.omf1 new file mode 100644 index 0000000..6c4b4f9 --- /dev/null +++ b/usr.bin/lseg/tests/out.omf1 @@ -0,0 +1,6 @@ +File Type Size Stack Name +-------------------- ------------------ -------- ------ ---------------- +omf1format Code 0x008DCE "main " +omf1format Code 0x000086 "~globals " +omf1format Code 0x00A4A9 "~arrays " +omf1format Code 0x001000 "DIRECT " diff --git a/usr.bin/lseg/tests/out.procs b/usr.bin/lseg/tests/out.procs new file mode 100644 index 0000000..1da521c --- /dev/null +++ b/usr.bin/lseg/tests/out.procs @@ -0,0 +1,50 @@ +File Type Size Stack Name +-------------------- ------------------ -------- ------ ---------------- +procs Data 0x000055 "~ExpressLoad" +procs Code 0x000E32 " " +Note: procs.c is not a recognized OMF file +procs.o Code 0x000020 0x0006 "main" +procs.o Code 0x000007 0x0004 "proc0" +procs.o Code 0x000010 0x0005 "proc1" +procs.o Code 0x000010 0x0006 "proc2" +procs.o Code 0x000010 0x0007 "proc3" +procs.o Code 0x000010 0x1004 "proc4096" +procs.o Code 0x00001F 0x0006 "databank0" +procs.o Code 0x00001F 0x0007 "databank1" +procs.o Code 0x00001F 0x0008 "databank2" +procs.o Code 0x00001F 0x0009 "databank3" +procs.o Code 0x00001F 0x1006 "databank4096" +procs.o Code 0x000001 "proc0o" +procs.o Code 0x000010 0x0003 "proc1o" +procs.o Code 0x000007 0x0004 "proc2o" +procs.o Code 0x000010 0x0005 "proc3o" +procs.o Code 0x000010 0x1002 "proc4096o" +procs.o Code 0x00003A 0x0004 "proc0db" +procs.o Code 0x000043 0x0005 "proc1db" +procs.o Code 0x000043 0x0006 "proc2db" +procs.o Code 0x000043 0x0007 "proc3db" +procs.o Code 0x000046 0x1004 "proc4096db" +procs.o Code 0x000001 "~GLOBALS" +procs.lib Library Dictionary 0x000000 "LIBRARY" +procs.lib Code 0x000020 0x0006 "main" +procs.lib Code 0x000007 0x0004 "proc0" +procs.lib Code 0x000010 0x0005 "proc1" +procs.lib Code 0x000010 0x0006 "proc2" +procs.lib Code 0x000010 0x0007 "proc3" +procs.lib Code 0x000010 0x1004 "proc4096" +procs.lib Code 0x00001F 0x0006 "databank0" +procs.lib Code 0x00001F 0x0007 "databank1" +procs.lib Code 0x00001F 0x0008 "databank2" +procs.lib Code 0x00001F 0x0009 "databank3" +procs.lib Code 0x00001F 0x1006 "databank4096" +procs.lib Code 0x000001 "proc0o" +procs.lib Code 0x000010 0x0003 "proc1o" +procs.lib Code 0x000007 0x0004 "proc2o" +procs.lib Code 0x000010 0x0005 "proc3o" +procs.lib Code 0x000010 0x1002 "proc4096o" +procs.lib Code 0x00003A 0x0004 "proc0db" +procs.lib Code 0x000043 0x0005 "proc1db" +procs.lib Code 0x000043 0x0006 "proc2db" +procs.lib Code 0x000043 0x0007 "proc3db" +procs.lib Code 0x000046 0x1004 "proc4096db" +procs.lib Code 0x000001 "~GLOBALS" diff --git a/usr.bin/lseg/tests/outd.procs b/usr.bin/lseg/tests/outd.procs new file mode 100644 index 0000000..a3a976e --- /dev/null +++ b/usr.bin/lseg/tests/outd.procs @@ -0,0 +1,50 @@ +File Type Size Stack Name +-------------------- ------------------ -------- ------ ---------------- +procs Data 85 "~ExpressLoad" +procs Code 3634 " " +Note: procs.c is not a recognized OMF file +procs.o Code 32 6 "main" +procs.o Code 7 4 "proc0" +procs.o Code 16 5 "proc1" +procs.o Code 16 6 "proc2" +procs.o Code 16 7 "proc3" +procs.o Code 16 4100 "proc4096" +procs.o Code 31 6 "databank0" +procs.o Code 31 7 "databank1" +procs.o Code 31 8 "databank2" +procs.o Code 31 9 "databank3" +procs.o Code 31 4102 "databank4096" +procs.o Code 1 "proc0o" +procs.o Code 16 3 "proc1o" +procs.o Code 7 4 "proc2o" +procs.o Code 16 5 "proc3o" +procs.o Code 16 4098 "proc4096o" +procs.o Code 58 4 "proc0db" +procs.o Code 67 5 "proc1db" +procs.o Code 67 6 "proc2db" +procs.o Code 67 7 "proc3db" +procs.o Code 70 4100 "proc4096db" +procs.o Code 1 "~GLOBALS" +procs.lib Library Dictionary 0 "LIBRARY" +procs.lib Code 32 6 "main" +procs.lib Code 7 4 "proc0" +procs.lib Code 16 5 "proc1" +procs.lib Code 16 6 "proc2" +procs.lib Code 16 7 "proc3" +procs.lib Code 16 4100 "proc4096" +procs.lib Code 31 6 "databank0" +procs.lib Code 31 7 "databank1" +procs.lib Code 31 8 "databank2" +procs.lib Code 31 9 "databank3" +procs.lib Code 31 4102 "databank4096" +procs.lib Code 1 "proc0o" +procs.lib Code 16 3 "proc1o" +procs.lib Code 7 4 "proc2o" +procs.lib Code 16 5 "proc3o" +procs.lib Code 16 4098 "proc4096o" +procs.lib Code 58 4 "proc0db" +procs.lib Code 67 5 "proc1db" +procs.lib Code 67 6 "proc2db" +procs.lib Code 67 7 "proc3db" +procs.lib Code 70 4100 "proc4096db" +procs.lib Code 1 "~GLOBALS" diff --git a/usr.bin/lseg/tests/procs.c b/usr.bin/lseg/tests/procs.c new file mode 100644 index 0000000..27adaff --- /dev/null +++ b/usr.bin/lseg/tests/procs.c @@ -0,0 +1,55 @@ +/* + * Test code for lseg + * + * Generate procedures using various amounts of stack space + * Not designed to be executed; just examined + * + * Dave Tribby * September 1997 + */ + +#pragma noroot +#pragma stacksize 256 +#pragma debug 0 + +int main(int argc, char *argv[]) +{ +return 0; +} + +/* Simple procedures no optimization or debug */ +#pragma optimize 0 +void proc0(void) {} +void proc1(void) { char ch; } +void proc2(void) { int i; } +void proc3(void) { char ch; int i; } +void proc4096(void) { char ch[4096]; } + + +/* Change the databank to see its effect */ +#pragma databank 1 +void databank0(void) {} +void databank1(void) { char ch; } +void databank2(void) { int i; } +void databank3(void) { char ch; int i; } +void databank4096(void) { char ch[4096]; } +#pragma databank 0 + + +/* Turn on full optimization to see its effect */ +#pragma optimize -1 +void proc0o(void) {} +void proc1o(void) { char ch; } +void proc2o(void) { int i; } +void proc3o(void) { char ch; int i; } +void proc4096o(void) { char ch[4096]; } +#pragma optimize 0 + + +/* Turn on full debug to see its effect */ +#pragma debug -1 +void proc0db(void) {} +void proc1db(void) { char ch; } +void proc2db(void) { int i; } +void proc3db(void) { char ch; int i; } +void proc4096db(void) { char ch[4096]; } +#pragma debug 0