1# ast nmake state tests 2 3INCLUDE cc.def 4 5TEST 01 'state views' 6 7 EXEC --nojobs one code=2 8 INPUT Makefile $'all : one two 9one : .ALWAYS .VIRTUAL .FORCE 10 cd $(<) 11 MAKEPATH=.. $(MAKE) $(-) -f main.mk CODE==$(code) 12two : .ALWAYS .VIRTUAL .FORCE 13 $(MAKE) $(-) -f main.mk CODE==$(code)' 14 INPUT cc.probe 15 INPUT one/ 16 INPUT main.mk $'%.o : %.c 17 : $(CCFLAGS) > $(<) 18.COMMAND.o : 19 : > $(<) 20app :: a.c b.c c.c' 21 INPUT a.c $'extern int b(); main() { return b() + CODE; }' 22 INPUT b.c $'extern int c(); int b() { return c() + CODE; }' 23 INPUT c.c $'int c() { return CODE; }' 24 ERROR - $'+ cd one 25+ nmake --nojobs \'--regress=message\' \'--native-pp=-1\' --noprefix-include -f main.mk CODE==2 26+ MAKEPATH=.. 27+ : \'-DCODE=2\' 28+ 1> a.o 29+ : \'-DCODE=2\' 30+ 1> b.o 31+ : \'-DCODE=2\' 32+ 1> c.o 33+ : 34+ 1> app' 35 36 EXEC --nojobs one code=2 37 ERROR - $'+ cd one 38+ nmake --nojobs \'--regress=message\' \'--native-pp=-1\' --noprefix-include -f main.mk CODE==2 39+ MAKEPATH=..' 40 41 EXEC --nojobs one code=2 42 43 EXEC --nojobs two code=0 44 ERROR - $'+ nmake --nojobs \'--regress=message\' \'--native-pp=-1\' --noprefix-include -f main.mk CODE==0 45+ : \'-DCODE=0\' 46+ 1> a.o 47+ : \'-DCODE=0\' 48+ 1> b.o 49+ : \'-DCODE=0\' 50+ 1> c.o 51+ : 52+ 1> app' 53 54 EXEC --nojobs two code=0 55 INPUT two/ 56 ERROR - $'+ nmake --nojobs \'--regress=message\' \'--native-pp=-1\' --noprefix-include -f main.mk CODE==0' 57 58 EXEC --nojobs one code=2 59 ERROR - $'+ cd one 60+ nmake --nojobs \'--regress=message\' \'--native-pp=-1\' --noprefix-include -f main.mk CODE==2 61+ MAKEPATH=.. 62+ : \'-DCODE=2\' 63+ 1> a.o 64+ : \'-DCODE=2\' 65+ 1> b.o 66+ : \'-DCODE=2\' 67+ 1> c.o 68+ : 69+ 1> app' 70 71TEST 02 'state actions' 72 73 EXEC 74 INPUT Makefile $'all : (XX) (YY) 75XX = xx 76(XX) : Makefile 77 : XX is $(;) 78YY = yy 79(YY) : 80 : YY is $(;)' 81 ERROR - $'+ : XX is xx 82+ : YY is yy' 83 84 EXEC -- 85 ERROR - 86 87 EXEC XX=aa 88 ERROR - $'+ : XX is aa' 89 90 EXEC -- 91 ERROR - $'+ : XX is xx' 92 93 EXEC YY=zz 94 ERROR - $'+ : YY is zz' 95 96 EXEC -- 97 ERROR - $'+ : YY is yy' 98 99TEST 03 'error status' 100 101 EXEC --regress=sync -NFMstatic 102 INPUT Makefile $'a : b y z 103 echo aha $(*) 104b : 105 true > $(<) 106y : 107 false > $(<) 108z : 109 true > $(<)' 110 OUTPUT - $'info mam static 00000 111setv INSTALLROOT ../../../.. 112setv PACKAGEROOT ../../../../../.. 113setv AR ${mam_cc_AR} ${mam_cc_AR_ARFLAGS} 114setv ARFLAGS rc 115setv AS as 116setv ASFLAGS 117setv CC cc 118setv mam_cc_FLAGS 119setv CCFLAGS ${-debug-symbols?1?${mam_cc_DEBUG} -D_BLD_DEBUG?${mam_cc_OPTIMIZE}?} 120setv CCLDFLAGS ${-strip-symbols?1?${mam_cc_LD_STRIP}??} 121setv COTEMP $$ 122setv CPIO cpio 123setv CPIOFLAGS 124setv CPP "${CC} -E" 125setv F77 f77 126setv HOSTCC ${CC} 127setv IGNORE 128setv LD ld 129setv LDFLAGS 130setv LEX lex 131setv LEXFLAGS 132setv LPR lpr 133setv LPRFLAGS 134setv M4FLAGS 135setv NMAKE nmake 136setv NMAKEFLAGS 137setv PR pr 138setv PRFLAGS 139setv SHELL /bin/sh 140setv SILENT 141setv TAR tar 142setv YACC yacc 143setv YACCFLAGS -d 144make a 145make b 146exec - true > b 147done b virtual 148make y 149exec - false > y 150done y virtual 151make z 152exec - true > z 153done z virtual 154exec - echo aha b y z 155done a virtual' 156 157 EXEC -- 158 OUTPUT - 159 ERROR - $'+ true 160+ 1> b 161+ false 162+ 1> y 163make: *** exit code 1 making y' 164 EXIT 1 165 166 EXEC 167 ERROR - $'+ false 168+ 1> y 169make: *** exit code 1 making y' 170 171TEST 04 'cancelled error status' 172 173 EXEC 174 INPUT Makefile $'%.z : %.x (DISABLE.%) 175 $(DISABLE.$(%):?false?touch $(<)?) 176z : a.z b.z c.z d.z 177 touch $(<)' 178 INPUT a.x 179 INPUT b.x 180 INPUT c.x 181 INPUT d.x 182 ERROR - $'+ touch a.z 183+ touch b.z 184+ touch c.z 185+ touch d.z 186+ touch z' 187 188 EXEC DISABLE.a=1 DISABLE.b=1 DISABLE.c=1 DISABLE.d=1 -k 189 EXIT 1 190 ERROR - $'+ false 191make: *** exit code 1 making a.z 192+ false 193make: *** exit code 1 making b.z 194+ false 195make: *** exit code 1 making c.z 196+ false 197make: *** exit code 1 making d.z 198make: *** 4 actions failed' 199 200 EXEC DISABLE.a=1 DISABLE.b=1 DISABLE.c=1 DISABLE.d=1 201 ERROR - $'+ false 202make: *** exit code 1 making a.z' 203 204 EXEC DISABLE.a=1 DISABLE.b=1 DISABLE.c=1 DISABLE.d=1 -k 205 ERROR - $'+ false 206make: *** exit code 1 making a.z 207+ false 208make: *** exit code 1 making b.z 209+ false 210make: *** exit code 1 making c.z 211+ false 212make: *** exit code 1 making d.z 213make: *** 4 actions failed' 214 215 EXEC DISABLE.a= DISABLE.b= DISABLE.c=1 DISABLE.d=1 216 ERROR - $'+ touch a.z 217+ touch b.z 218+ false 219make: *** exit code 1 making c.z' 220 221 EXEC DISABLE.a= DISABLE.b= DISABLE.c=1 DISABLE.d=1 222 ERROR - $'+ false 223make: *** exit code 1 making c.z' 224 225 EXEC DISABLE.a= DISABLE.b= DISABLE.c= DISABLE.d=1 226 ERROR - $'+ touch c.z 227+ false 228make: *** exit code 1 making d.z' 229 230 EXEC DISABLE.a= DISABLE.b= DISABLE.c= DISABLE.d=1 231 ERROR - $'+ false 232make: *** exit code 1 making d.z' 233 234 EXEC DISABLE.a= DISABLE.b= DISABLE.c= DISABLE.d= 235 EXIT 0 236 ERROR - $'+ touch d.z 237+ touch z' 238 239 EXEC DISABLE.a= DISABLE.b= DISABLE.c= DISABLE.d= 240 ERROR - 241 242TEST 05 'virtual state' 243 244 EXEC 245 INPUT Makefile $'all : (S0) 246(S0) : .MAKE (S1) (S2) (S3) (S4) (S5) 247 print : $(<) : $(~:T>T=$(<)) :' 248 OUTPUT - $': (S0) : (S1) (S2) (S3) (S4) (S5) :' 249 250 EXEC 251 OUTPUT - 252 253 EXEC S1=1 254 OUTPUT - $': (S0) : (S1) :' 255 256 EXEC S1=1 257 OUTPUT - 258 259 EXEC S1=1 S2=2 260 OUTPUT - $': (S0) : (S2) :' 261 262 EXEC S1=1 S2=2 263 OUTPUT - 264 265 EXEC S1=1 266 OUTPUT - $': (S0) : (S2) :' 267 268 EXEC S1=1 269 OUTPUT - 270 271 EXEC -- 272 OUTPUT - $': (S0) : (S1) :' 273 274 EXEC -- 275 OUTPUT - 276 277TEST 06 'virtual state with long actions' 278 279 EXEC --silent 280 INPUT Makefile $'all : (S) 281(S) : so 282 sleep 2 283 echo load $(*) 284so : si 285 echo "s output" > $(<)' 286 INPUT si $'s input' 287 OUTPUT - $'load so' 288 289 EXEC --silent 290 OUTPUT - 291 292 DO touch si 293 294 EXEC --silent 295 OUTPUT - $'load so' 296 297 EXEC --silent 298 OUTPUT - 299 300TEST 07 'virtual targets with errors' 301 302 EXEC ERROR=0 303 INPUT Makefile $'set keepgoing 304:ALL: V0 305V0 : V1 V2 V3 306V1 V2 V3 : .VIRTUAL (ERROR) 307 case "$(<)" in 308 *$(ERROR)*) false ;; 309 *) : "$(<)" ok ;; 310 esac' 311 ERROR - $'+ : V1 ok 312+ : V2 ok 313+ : V3 ok' 314 315 EXEC ERROR=0 316 ERROR - 317 318 EXEC ERROR=1 319 ERROR - $'+ false 320make: *** exit code 1 making V1 321+ : V2 ok 322+ : V3 ok 323make: *** 1 action failed' 324 EXIT 1 325 326 EXEC ERROR=1 327 ERROR - $'+ false 328make: *** exit code 1 making V1 329make: *** 1 action failed' 330 331 EXEC ERROR=2 332 ERROR - $'+ : V1 ok 333+ false 334make: *** exit code 1 making V2 335+ : V3 ok 336make: *** 1 action failed' 337 338 EXEC ERROR=2 339 ERROR - $'+ false 340make: *** exit code 1 making V2 341make: *** 1 action failed' 342 343 EXEC ERROR=3 344 ERROR - $'+ : V1 ok 345+ : V2 ok 346+ false 347make: *** exit code 1 making V3 348make: *** 1 action failed' 349 350 EXEC ERROR=3 351 ERROR - $'+ false 352make: *** exit code 1 making V3 353make: *** 1 action failed' 354 355 EXEC ERROR=0 356 ERROR - $'+ : V1 ok 357+ : V2 ok 358+ : V3 ok' 359 EXIT 0 360 361 EXEC ERROR=0 362 ERROR - 363 364TEST 08 'statevar targets with errors' 365 366 EXEC ERROR=0 367 INPUT Makefile $'set keepgoing 368:ALL: (S0) 369(S0) : (S1) (S2) (S3) 370(S1) (S2) (S3) : (ERROR) 371 case "$(<)" in 372 *$(ERROR)*) false ;; 373 *) : "$(<)" ok ;; 374 esac' 375 ERROR - $'+ : \'(S1)\' ok 376+ : \'(S2)\' ok 377+ : \'(S3)\' ok' 378 379 EXEC ERROR=0 380 ERROR - 381 382 EXEC ERROR=1 383 ERROR - $'+ false 384make: *** exit code 1 making (S1) 385+ : \'(S2)\' ok 386+ : \'(S3)\' ok 387make: *** 1 action failed' 388 EXIT 1 389 390 EXEC ERROR=1 391 ERROR - $'+ false 392make: *** exit code 1 making (S1) 393make: *** 1 action failed' 394 395 EXEC ERROR=2 396 ERROR - $'+ : \'(S1)\' ok 397+ false 398make: *** exit code 1 making (S2) 399+ : \'(S3)\' ok 400make: *** 1 action failed' 401 402 EXEC ERROR=2 403 ERROR - $'+ false 404make: *** exit code 1 making (S2) 405make: *** 1 action failed' 406 407 EXEC ERROR=3 408 ERROR - $'+ : \'(S1)\' ok 409+ : \'(S2)\' ok 410+ false 411make: *** exit code 1 making (S3) 412make: *** 1 action failed' 413 414 EXEC ERROR=3 415 ERROR - $'+ false 416make: *** exit code 1 making (S3) 417make: *** 1 action failed' 418 419 EXEC ERROR=0 420 ERROR - $'+ : \'(S1)\' ok 421+ : \'(S2)\' ok 422+ : \'(S3)\' ok' 423 EXIT 0 424 425 EXEC ERROR=0 426 ERROR - 427