10/29/89

The files in this directory are intended to exercise most parts of PMake.
In most cases, pmake should not abort nor should the creation of any target
stop before its shell script is complete. In cases where this is expected to
happen, a message is printed beforehand. If such is not the case, there's
a bug in PMake somewhere...

1/28/93

The old output sample has been moved to README.OLD, and a new one appears
below.  It was produced with pmake -C to re-enable pmake-style variable
substitution (disabled in the default config.h).

The following differences are results of deliberate changes made to PMake:
- program name in error message is stripped of leading path
- some error message have different wording (but same meaning)
- commands in system makefile ($(CC) etc.) use full paths.
- openStreams is invoked as ./openStreams.

The remaining ones are due to different execution environments:
- the order of targets in the expansion of $(.ALLSRC) in glob.test
- order of commands echoed by sh -x in glob.test
- output from ls -l TESTALL and pwd
- three new tests: arch.test, env.test, shellvar.test

Other differences that are likely to appear:
- Order of commands and output if running in parallel mode
- messages from remote module if running in exportation mode
- missing header lines (--- target ---) if running with -J 1 or -X -L 1.
- The test of tcsh in shellvar.test may be skipped if not available on system.
- arch.test skips the ranlib command on System V machines.
- arch.test symbol lookup test fails because the system uses a non-standard
  ranlib format (e.g., HP-UX).
- The `false' command returns 255, not 1, on some systems.
- shellvar.test output depends on availability and identity of local shells.

*** Testing 2c.test

--- b ---
+ : b1 
+ test d != d 
--- b ---
+ : b2 
+ test e != e 
--- a ---
+ test b c != b c 


*** Testing arch.test

--- run ---
: Building archives sequentially
../pmake -lf arch.test -Dtest1 build
--- 1234567890123456.c ---
echo 'main() {}' > 1234567890123456.c
--- test.a ---
ar r test.a 1234567890123456.c
ar: filename 1234567890123456.c truncated to 123456789012345
ar: creating test.a
--- 1234567890123456.o ---
/bin/cc  -c 1234567890123456.c
--- libtest.a(1234567890123456.o) ---
ar r libtest.a 1234567890123456.o
ar: filename 1234567890123456.o truncated to 123456789012345
ar: creating libtest.a
: Checking for results
: test.a should be uptodate
../pmake -lf arch.test -Dtest1 -q test.a
: ...  so should the member in libtest.a
../pmake -lf arch.test -Dtest1 -q "libtest.a(1234567890123456.o)"
: ...  but not the libary itself
if ../pmake -lf arch.test -Dtest1 -q libtest.a ; then false;  else true; fi
: Run ranlib
../pmake -lf arch.test -Dtest1 libtest.a
--- libtest.a ---
ranlib libtest.a
: Checking again
../pmake -lf arch.test -Dtest1 -q libtest.a
: Now we remove the external copy of the member, and things should
: still be fine.
rm -f 1234567890123456.o
../pmake -lf arch.test -Dtest1 -q libtest.a
: cleanup
../pmake -lf arch.test .INTERRUPT
--- .INTERRUPT ---
rm -f libtest.a test.a 1234567890123456.o 1234567890123456.c
: 
: Now building archive in parallel
../pmake -lf arch.test -Dtest2 libtest.a
--- 1234567890123456.c ---
echo 'main() {}' > 1234567890123456.c
--- 1234567890123456.o ---
/bin/cc  -c 1234567890123456.c
--- libtest.a ---
ar r libtest.a 1234567890123456.o
ar: filename 1234567890123456.o truncated to 123456789012345
ar: creating libtest.a
ranlib libtest.a
--- .END ---
rm -f 1234567890123456.o
: Checking that object was removed
test ! -f 1234567890123456.o
: ... and archive built
../pmake -lf arch.test -Dtest2 -q libtest.a
: Now touch source
sleep 1; touch 1234567890123456.c
: Both member and library should be out of date
if ../pmake -lf arch.test -Dtest2 -q "libtest.a(1234567890123456.o)" ; then false;  else true; fi
if ../pmake -lf arch.test -Dtest2 -q libtest.a ; then false;  else true; fi
: Rebuild -- this should execute the ar command although
: the member is not updated by the .o.a dependency
../pmake -lf arch.test -Dtest2 libtest.a
--- 1234567890123456.o ---
/bin/cc  -c 1234567890123456.c
--- libtest.a ---
ar r libtest.a 1234567890123456.o
ar: filename 1234567890123456.o truncated to 123456789012345
ranlib libtest.a
--- .END ---
rm -f 1234567890123456.o
: .. and check again
../pmake -lf arch.test -Dtest2 -q "libtest.a(1234567890123456.o)" libtest.a
: Checking symbol lookup -- may fail on some systems
../pmake -lf arch.test -Dtest3 -q libtest.a
: cleanup
../pmake -lf arch.test .INTERRUPT
--- .INTERRUPT ---
rm -f libtest.a test.a 1234567890123456.o 1234567890123456.c


*** Testing cmd.test

--- a ---
a
: That should have printed just "a"
: Should next get an error message about extra commands for a ignored
"cmd.test", line 14: warning: Extra command line for "a" ignored
a
: That should have printed just "a"


*** Testing cmdvar.test

--- a ---
+ test cmd != cmd 


*** Testing comment.test

--- b ---
+ test hi there  != hi there  
--- c ---
+ test how nice to see you #scumbucket != how nice to see you #scumbucket 
--- d ---
+ test wheeee   != wheeee   
--- a ---
+ test b c d != b c d 


*** Testing cond.test

--- a ---
fish is not defined
!defined(unix) && (make(kumquat) || defined(sun)) worked
.MAKEFLAGS = -V -L -1 -J 8 -C


*** Testing condop.test

--- a ---
: decimal int worked
: hex int worked
: regular float worked
: E float worked
: negative E float worked
: string worked
: true boolean worked
: false boolean worked
: target worked
: exists worked
: make worked
: defined worked
: empty worked


*** Testing cycle.test

--- d ---
: This message should be followed by one warning message:
: pmake: Ignoring cycle through 'b: a'
: and a greeting
: Since this is not in compatibility mode, this should be followed by
: two error messages:
: pmake: Graph cycles through 'b: a'
: pmake: Graph cycles through 'a: b'
: after a complaint about c not being remade because of errors
pmake: Ignoring cycle through `b: a'
hithere
pmake: Graph cycles through `b: a'
pmake: Graph cycles through `a: b'


*** Testing dynamic.test

--- str.o ---
test "../src/str.c" = "../src/str.c"
--- job.o ---
test "../src/job.c" = "../src/job.c"


*** Testing empty.test

--- a ---
: life I love you
: all is groovy
: -- P. Simon and A. Garfunkel


*** Testing env.test

--- test ---
Variables:  VAR1=xxx VAR2=yyy VAR3=$(VAR3) SHELL=/bin/sh
:
: VAR1 and VAR2 should be unchanged as make vars, but only
: VAR1 is exported back to the shell.
: VAR3 is inherited from the environment.
: SHELL is not inherited and not changed for subprocesses.
VAR1=zzz VAR3=aaa SHELL=/bin/myshell ../pmake -lf env.test doit
--- doit ---
# Make vars
test "xxx" = xxx
test "yyy" = yyy
test "aaa" = aaa
test "/bin/sh" = /bin/sh
# Environment
test "$VAR1" = zzz
test "$VAR2" = ""
test "$VAR3" = aaa
test "$SHELL" = /bin/myshell
:
: VAR1 is now overridden by the environment.
: Everything else should be as before.
VAR1=zzz VAR3=aaa SHELL=/bin/myshell ../pmake -lf env.test -e again
--- again ---
: Make vars
test "zzz" = zzz
test "yyy" = yyy
test "aaa" = aaa
test "/bin/sh" = /bin/sh
: Environment
test "$VAR1" = zzz
test "$VAR2" = ""
test "$VAR3" = aaa
test "$SHELL" = /bin/myshell


*** Testing exists.test

--- a ---
test '(' nofoo.mk = foo.mk -a -r foo.mk ')' -o '(' nofoo.mk = nofoo.mk  -a ! -r foo.mk ')'


*** Testing glob.test

--- c ---
+ test glob.test = glob.test 
--- a ---
+ : All .test files null.test empty.test arch.test cmdvar.test trans.test tab.test env.test onevar.test var.test condop.test stream.test vis.test recurse.test exists.test keepgoing.test cycle.test stop.test shellvar.test join.test order.test glob.test cmd.test sub.test onecmd.test comment.test 2c.test shell.test vpath.test dynamic.test cond.test 
+ test glob.test = glob.test 
--- b ---
+ test ../tests/glob.test = ../tests/glob.test 
--- d ---
+ + echo ../src/job.c ../src/job.h ../src/parse.c ../src/main.c ../src/dir.c ../src/targ.c ../src/cond.c ../src/str.c ../src/arch.c ../src/make.c ../src/var.c ../src/suff.c ../src/make.h ../src/compat.c ../src/nonints.h 
+ sort 
tr   \012 
+ sed -n -e 1h -e 2,$H -e $x -e $s/\n/ /gp 
f=../src/arch.c ../src/compat.c ../src/cond.c ../src/dir.c ../src/job.c ../src/job.h ../src/main.c ../src/make.c ../src/make.h ../src/nonints.h ../src/parse.c ../src/str.c ../src/suff.c ../src/targ.c ../src/var.c
+ echo ../src/arch.c ../src/compat.c ../src/cond.c ../src/dir.c ../src/job.c ../src/job.h ../src/main.c ../src/make.c ../src/make.h ../src/nonints.h ../src/parse.c ../src/str.c ../src/suff.c ../src/targ.c ../src/var.c 
+ test ../src/arch.c ../src/compat.c ../src/cond.c ../src/dir.c ../src/job.c ../src/job.h ../src/main.c ../src/make.c ../src/make.h ../src/nonints.h ../src/parse.c ../src/str.c ../src/suff.c ../src/targ.c ../src/var.cx = ../src/arch.c ../src/compat.c ../src/cond.c ../src/dir.c ../src/job.c ../src/job.h ../src/main.c ../src/make.c ../src/make.h ../src/nonints.h ../src/parse.c ../src/str.c ../src/suff.c ../src/targ.c ../src/var.cx 
--- all ---
+ : should have executed a, b, c and d 


*** Testing join.test

--- q1 ---
creating q1
--- q2 ---
creating q2
--- q3 ---
creating q3
--- join ---
test "q1 q2 q3" = "q1 q2 q3"
--- all ---
test "q1 q2 q3" = "q1 q2 q3"


*** Testing keepgoing.test

--- b ---
: innocuous
--- c ---
false
*** Error code 1 (continuing)
--- d ---
: should be executed
pmake: Target `a' not remade because of errors.


*** Testing null.test

--- a.c ---
: This should print
: cc -o a a.c
: nm -a a '>' a.nm
--- a ---
cc -o a a.c
--- a.nm ---
nm -a a > a.nm


*** Testing onecmd.test

--- a ---
biff me
--- b ---
false
*** Error code 1 (ignored)
: this should execute since this target has .IGNORE set
--- t2 ---
../pmake -f onecmd.test -lk c d
--- c ---
ls -l TESTALL
-r-xr-xr-x  1 stolcke       467 Aug 18  1994 TESTALL
false
*** Error code 1 (continuing)
--- d ---
: this should execute since it dependeth not on 'c'


*** Testing onevar.test

--- make.h ---
+ : make.h 
+ test ./../src != ./../src 
(P) = ./../src


*** Testing order.test

--- .BEGIN ---
rm -f q1 q2 q3
--- q1 ---
touch q1
test ! -f q2 -a ! -f q3
--- q2 ---
touch q2
test -f q1 -a ! -f q3
--- q3 ---
touch	q3
test -f q1 -a -f q2
--- .END ---
rm -f q1 q2 q3


*** Testing recurse.test

--- .BEGIN ---
: pmake should abort in a moment for a recursive variable A
pmake: Variable A is recursive.


*** Testing shell.test

--- .BEGIN ---
: for sh and csh, the output should look like
: whuffle
: false
: true
: testing _____ next
--- sh ---
whuffle
false
true
testing csh next
--- csh ---
whuffle
false
true
testing cat next
--- cat ---
echo off$
echo whuffle$
echo on$
echo off$
error check off$
echo on$
false$
echo off$
error check on$
echo on$


*** Testing shellvar.test

--- test ---
: All shells should generate identical strings for
: Makefile SHELL variable and zeroth argument.  
: The SHELL environment variable remains unaffected.
SHELL=/bin/myshell ../pmake -lf shellvar.test doit
pmake: Could not execute shell: bogus: No such file or directory
"shellvar.test", line 30: warning: "$(TESTCMD)" returned non-zero
--- doit ---
test "SHELL=/bin/sh arg0=/bin/sh env=/bin/myshell" = "SHELL=/bin/sh arg0=/bin/sh env=/bin/myshell"
test "SHELL=bogus " = "SHELL=bogus "
test "SHELL= arg0=/bin/sh env=/bin/myshell" = "SHELL= arg0=/bin/sh env=/bin/myshell"
test "SHELL=/bin/csh arg0=/bin/csh env=/bin/myshell" = "SHELL=/bin/csh arg0=/bin/csh env=/bin/myshell"
test "SHELL=/usr/local/bin/tcsh arg0=/usr/local/bin/tcsh env=/bin/myshell" = "SHELL=/usr/local/bin/tcsh arg0=/usr/local/bin/tcsh env=/bin/myshell"
Final shell is /bin/sh.
:
: This time around makefile SHELL and zeroth arguments are
: overridden by the command line.
SHELL=/bin/myshell ../pmake -lf shellvar.test SHELL=/bin/sh again
--- again ---
test "SHELL=/bin/sh arg0=/bin/sh env=/bin/sh" = "SHELL=/bin/sh arg0=/bin/sh env=/bin/sh"
test "SHELL=/bin/sh arg0=/bin/sh env=/bin/sh" = "SHELL=/bin/sh arg0=/bin/sh env=/bin/sh"
test "SHELL=/bin/sh arg0=/bin/sh env=/bin/sh" = "SHELL=/bin/sh arg0=/bin/sh env=/bin/sh"
test "SHELL=/bin/sh arg0= env=/bin/sh" = "SHELL=/bin/sh arg0= env=/bin/sh"
test "SHELL=/bin/sh arg0= env=/bin/sh" = "SHELL=/bin/sh arg0= env=/bin/sh"
Final shell is /bin/sh.


*** Testing stop.test

--- c ---
: This is meant to cause an error. nothing more should execute
false
*** Error code 1
pmake: 1 error


*** Testing stream.test

--- note ---
: each 'openStreams' should print "Open streams: 0 1 2"
--- openStreams ---
/bin/cc  openStreams.c  -o openStreams
--- a ---
./openStreams
Open streams: 0 1 2
--- b ---
./openStreams
Open streams: 0 1 2
--- c ---
./openStreams
Open streams: 0 1 2
--- d ---
./openStreams
Open streams: 0 1 2
--- e ---
./openStreams
Open streams: 0 1 2
--- f ---
./openStreams
Open streams: 0 1 2
--- g ---
./openStreams
Open streams: 0 1 2
--- h ---
./openStreams
Open streams: 0 1 2
--- i ---
./openStreams
Open streams: 0 1 2
--- j ---
./openStreams
Open streams: 0 1 2
--- k ---
./openStreams
Open streams: 0 1 2
--- l ---
./openStreams
Open streams: 0 1 2
--- m ---
./openStreams
Open streams: 0 1 2
--- n ---
./openStreams
Open streams: 0 1 2
--- o ---
./openStreams
Open streams: 0 1 2
--- p ---
./openStreams
Open streams: 0 1 2
--- q ---
./openStreams
Open streams: 0 1 2
--- r ---
./openStreams
Open streams: 0 1 2
--- s ---
./openStreams
Open streams: 0 1 2
--- t ---
./openStreams
Open streams: 0 1 2
--- u ---
./openStreams
Open streams: 0 1 2
--- v ---
./openStreams
Open streams: 0 1 2
--- w ---
./openStreams
Open streams: 0 1 2
--- x ---
./openStreams
Open streams: 0 1 2
--- y ---
./openStreams
Open streams: 0 1 2
--- z ---
./openStreams
Open streams: 0 1 2


*** Testing sub.test

--- .BEGIN ---
: If any of these aborts, check VarSubstitute, VarModify and VarParse
--- a ---
test "sbr.cmds.o fish.c 'a$a'" = "sbr.cmds.o fish.c 'a$a'"
test "sbr.cmds.o fish.o 'a$a'" = "sbr.cmds.o fish.o 'a$a'"
test "xsbr.cmds.c fish.c 'a$a'" = "xsbr.cmds.c fish.c 'a$a'"
test "xsbr.cmds.c xfish.c x'a$a'" = "xsbr.cmds.c xfish.c x'a$a'"
test "sbr.cmds.c fish.co 'a$a'" = "sbr.cmds.c fish.co 'a$a'"
test "sbr.cmds.c dog.c 'a$a'" = "sbr.cmds.c dog.c 'a$a'"
test "sbr.cmds.c fish.c 'b$a'" = "sbr.cmds.c fish.c 'b$a'"
test "sbr.cmds.c 'a$a'" = "sbr.cmds.c 'a$a'"
test "sbr.cmds.c 'a$a'" = "sbr.cmds.c 'a$a'"
test "sbr.cmds.o fish.o 'a$a'" = "sbr.cmds.o fish.o 'a$a'"


*** Testing tab.test

--- q ---
ls -l
--- q ---
: q2
--- a ---


*** Testing trans.test

--- .BEGIN ---
: This should create ucb from ucb.l via ucb.c and ucb.o
--- ucb.c ---
/usr/bin/lex  ucb.l
/bin/mv lex.yy.c ucb.c
--- ucb.o ---
/bin/cc  -c ucb.c
--- ucb ---
/bin/cc  ucb.o  -o ucb


*** Testing var.test

--- a ---
+ : Q = ../../e.c a.out homer 
+ test ../.. . . != ../.. . . 
+ test e.c a.out homer != e.c a.out homer 
+ test ../../e a homer != ../../e a homer 
+ test c out != c out 
+ : tail of current working directory = tests 
+ pwd 
+ test /tmp_mnt/n/dimsum/export/src/local/icsi/pmake/testsx != /tmp_mnt/n/dimsum/export/src/local/icsi/pmake/testsx 
+ test ../../e.c a.out fishy \& homer != ../../e.c a.out fishy \& homer 
+ exit 0 


*** Testing vis.test

--- a ---
test "" = ""
test "" = ""


*** Testing vpath.test

--- a ---
+ test ( /usr/include/signal.h != /usr/include/signal.h ) -a ( /usr/include/signal.h != /sprite/att/lib/include/signal.h ) 


