TEST.mk revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/*
* regression test support
*
* @(#)TEST.mk (AT&T Research) 2010-05-19
*
* test management is still in the design phase
*/
/*
* three forms for :TEST:
*
* :TEST: xxx yyy ...
*
* $(REGRESS) $(REGRESSFLAGS) xxx.tst
* $(REGRESS) $(REGRESSFLAGS) yyy.tst
*
* :TEST: xxx.tst yyy ...
*
* $(REGRESS) $(REGRESSFLAGS) xxx.tst yyy ...
*
* :TEST: xxx.c [ :: test-prereq ... :: ] [ args [ : args ... ] ]
*
* :TEST: xxx.sh [ :: test-prereq ... :: ] [ args [ : args ... ] ]
*
* xxx :TEST: prereq ...
* [ action ]
*
* $(*) if no action
*/
local B G P S T
P := $(>:O=1)
if "$(P:N=*.tst)" && ! "$(@:V)"
B := $(P:B)
if ! ( T = "$(<:V)" )
T := $(B)
elif "$(P:N=*@(.sh|$(.SUFFIX.c:/ /|/G)|$(.SUFFIX.C:/ /|/G)))"
B := $(P:B)
if ! ( T = "$(<:V)" )
T := $(B)
:INSTALLDIR: $(B)
if "$(P:N=*.sh)"
$(B) : (TESTCC)
if "$(@:V)"
test.$$(T) : $$(B) $(>:V:O>1)
$(@:V)
elif "$(>:V:O>1)"
local I A V X S R=0
for A $(>:V:O>1)
if A == "::"
let R = !R
elif A == ":"
let I = I + 1
test.$(T).$(I) := $(V:V)
V =
X := $(X:V)$(S)$$(*) $$(test.$(T).$(I):T=*)
S = $("\n")
elif A != "-l*|*$(CC.SUFFIX.ARCHIVE)"
if R
else
V += $(A:V)
if V
let I = I + 1
test.$(T).$(I) := $(V:V)
X := $(X:V)$(S)$$(*) $$(test.$(T).$(I):T=*)
test.$$(T) : $$(B)
$(X:V)
else
test.$$(T) : $$(B)
$$(*)
elif ! "$(<:V)"
G = 1
for B $(>)
if B == "-|--"
let G = !G
else
if ! G
T =
for S .c .sh
if "$(B:B:S=$(S):T=F)"
:INSTALLDIR: $(B)
$(B) :: $(B:B:S=$(S))
T := $(B)
break
else
if "$(>:V)" || "$(@:V)"
P := $(>)
T := $(P:O=1)
B := $(T:B)
if "$(T)" != "$(B)" && "$(T:G=$(B))"
:INSTALLDIR: $(B)
$(B) :: $(T) $(P:O>1:N=-*)
T := $(B)
P := $(B) $(P:O>1:N!=-*)
if "$(<:V)"
T := $(<:V)
if "$(@:V)"
test.$$(T) : $$(P) $(>:V:O>1)
$(@:V)
else
test.$(T) : $(P)
$(*)
else
$(REGRESS) $(REGRESSFLAGS) $(*)
if VARIANT == "DLL"
exit 0
I| INCLUDE@ % |
/*
* test scripts are only regenerated from *.rt when --force
* is specified or the .rt file is newer than the script
* otherwise the script is accepted if it exists
*
* this avoids the case where a fresh build with no state
* would regenerate the test script and capture current
* behavior instead of expected behavior
*/