# -*-perl-*- $description = "Test the behaviour of the .POSIX target."; $details = ""; # Ensure turning on .POSIX enables the -e flag for the shell # We can't assume the exit value of "false" because on different systems it's # different. my $script = 'false; true'; my $flags = '-ec'; my $out = `$sh_name $flags '$script' 2>&1`; my $err = $? >> 8; setup_for_test(); open(MAKEFILE,"> $makefile"); print MAKEFILE qq{ .SHELLFLAGS = $flags .POSIX: all: ; \@$script }; $out = `/bin/sh $flags '$script' 2>&1`; my $answer = qq{#MAKEFILE#:4: *** [all] error $err #0 all at #MAKEFILE#:4 }; $logfile = &get_logfile; run_make_with_options($makefile, '', $logfile, 512); my $slurp = &read_file_into_string ($logfile); $slurp =~ s:^#0 all at .*work/targets/:#0 all at work/targets/:gm; &compare_output_string($answer, $slurp, $logfile); # Test the default value of various POSIX-specific variables my %POSIX = (AR => 'ar', ARFLAGS => 'rvU', YACC => 'yacc', YFLAGS => '', LEX => 'lex', LFLAGS => '', LDFLAGS => '', CC => 'c99', CFLAGS => '-O1', FC => 'fort77', FFLAGS => '-O1', SCCSFLAGS => '', SCCSGETFLAGS => '-s'); my $make = join('', map { "\t\@echo '$_=\$($_)'\n" } sort keys %POSIX); my $r = join('', map { "$_=$POSIX{$_}\n"} sort keys %POSIX); run_make_test(qq! .POSIX: all: $make !, '', $r); # Make sure that local settings take precedence %extraENV = map { $_ => "xx-$_" } keys %POSIX; $r = join('', map { "$_=xx-$_\n"} sort keys %POSIX); run_make_test(undef, '', $r); # This tells the test driver that the perl test script executed properly. 1;