1*69606e3fSchristos# -*-Perl-*- 2*69606e3fSchristos 3*69606e3fSchristos$description = "\ 4*69606e3fSchristosThe following test creates a makefile to test the error function."; 5*69606e3fSchristos 6*69606e3fSchristos$details = ""; 7*69606e3fSchristos 8*69606e3fSchristosopen(MAKEFILE,"> $makefile"); 9*69606e3fSchristos 10*69606e3fSchristosprint MAKEFILE 'err = $(error Error found!) 11*69606e3fSchristos 12*69606e3fSchristosifdef ERROR1 13*69606e3fSchristos$(error error is $(ERROR1)) 14*69606e3fSchristosendif 15*69606e3fSchristos 16*69606e3fSchristosifdef ERROR2 17*69606e3fSchristos$(error error is $(ERROR2)) 18*69606e3fSchristosendif 19*69606e3fSchristos 20*69606e3fSchristosifdef ERROR3 21*69606e3fSchristosall: some; @echo $(error error is $(ERROR3)) 22*69606e3fSchristosendif 23*69606e3fSchristos 24*69606e3fSchristosifdef ERROR4 25*69606e3fSchristosall: some; @echo error is $(ERROR4) 26*69606e3fSchristos @echo $(error error is $(ERROR4)) 27*69606e3fSchristosendif 28*69606e3fSchristos 29*69606e3fSchristossome: ; @echo Some stuff 30*69606e3fSchristos 31*69606e3fSchristostestvar: ; @: $(err) 32*69606e3fSchristos'; 33*69606e3fSchristos 34*69606e3fSchristosclose(MAKEFILE); 35*69606e3fSchristos 36*69606e3fSchristos# Test #1 37*69606e3fSchristos 38*69606e3fSchristos&run_make_with_options($makefile, "ERROR1=yes", &get_logfile, 512); 39*69606e3fSchristos$answer = "$makefile:4: *** error is yes. Stop.\n"; 40*69606e3fSchristos&compare_output($answer,&get_logfile(1)); 41*69606e3fSchristos 42*69606e3fSchristos# Test #2 43*69606e3fSchristos 44*69606e3fSchristos&run_make_with_options($makefile, "ERROR2=no", &get_logfile, 512); 45*69606e3fSchristos$answer = "$makefile:8: *** error is no. Stop.\n"; 46*69606e3fSchristos&compare_output($answer,&get_logfile(1)); 47*69606e3fSchristos 48*69606e3fSchristos# Test #3 49*69606e3fSchristos 50*69606e3fSchristos&run_make_with_options($makefile, "ERROR3=maybe", &get_logfile, 512); 51*69606e3fSchristos$answer = "Some stuff\n$makefile:12: *** error is maybe. Stop.\n"; 52*69606e3fSchristos&compare_output($answer,&get_logfile(1)); 53*69606e3fSchristos 54*69606e3fSchristos# Test #4 55*69606e3fSchristos 56*69606e3fSchristos&run_make_with_options($makefile, "ERROR4=definitely", &get_logfile, 512); 57*69606e3fSchristos$answer = "Some stuff\n$makefile:16: *** error is definitely. Stop.\n"; 58*69606e3fSchristos&compare_output($answer,&get_logfile(1)); 59*69606e3fSchristos 60*69606e3fSchristos# Test #5 61*69606e3fSchristos 62*69606e3fSchristos&run_make_with_options($makefile, "testvar", &get_logfile, 512); 63*69606e3fSchristos$answer = "$makefile:22: *** Error found!. Stop.\n"; 64*69606e3fSchristos&compare_output($answer,&get_logfile(1)); 65*69606e3fSchristos 66*69606e3fSchristos# This tells the test driver that the perl test script executed properly. 67*69606e3fSchristos1; 68*69606e3fSchristos 69*69606e3fSchristos 70*69606e3fSchristos 71*69606e3fSchristos 72*69606e3fSchristos 73*69606e3fSchristos 74