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