2010-07-06 06:37:42 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
|
2012-09-09 19:19:15 +00:00
|
|
|
$description = "Test the behaviour of the .POSIX target.";
|
2010-07-06 06:37:42 +00:00
|
|
|
|
|
|
|
$details = "";
|
|
|
|
|
|
|
|
|
|
|
|
# Ensure turning on .POSIX enables the -e flag for the shell
|
2010-07-28 05:39:50 +00:00
|
|
|
# We can't assume the exit value of "false" because on different systems it's
|
|
|
|
# different.
|
|
|
|
|
|
|
|
my $script = 'false; true';
|
|
|
|
my $flags = '-ec';
|
2017-04-17 19:37:57 +00:00
|
|
|
my $out = `$sh_name $flags '$script' 2>&1`;
|
2010-07-28 05:39:50 +00:00
|
|
|
my $err = $? >> 8;
|
|
|
|
run_make_test(qq!
|
2010-07-06 06:37:42 +00:00
|
|
|
.POSIX:
|
2010-07-28 05:39:50 +00:00
|
|
|
all: ; \@$script
|
2010-07-06 06:37:42 +00:00
|
|
|
!,
|
2017-10-28 22:45:30 +00:00
|
|
|
'', "#MAKE#: *** [#MAKEFILE#;3: all] Error $err\n", 512);
|
2010-07-06 06:37:42 +00:00
|
|
|
|
|
|
|
# User settings must override .POSIX
|
2010-07-28 05:39:50 +00:00
|
|
|
$flags = '-xc';
|
2017-04-17 19:37:57 +00:00
|
|
|
$out = `$sh_name $flags '$script' 2>&1`;
|
2010-07-28 05:39:50 +00:00
|
|
|
run_make_test(qq!
|
|
|
|
.SHELLFLAGS = $flags
|
2010-07-06 06:37:42 +00:00
|
|
|
.POSIX:
|
2010-07-28 05:39:50 +00:00
|
|
|
all: ; \@$script
|
2010-07-06 06:37:42 +00:00
|
|
|
!,
|
2010-07-28 05:39:50 +00:00
|
|
|
'', $out);
|
2010-07-06 06:37:42 +00:00
|
|
|
|
2012-09-09 19:19:15 +00:00
|
|
|
# Test the default value of various POSIX-specific variables
|
|
|
|
my %POSIX = (AR => 'ar', ARFLAGS => '-rv',
|
|
|
|
YACC => 'yacc', YFLAGS => '',
|
|
|
|
LEX => 'lex', LFLAGS => '',
|
|
|
|
LDFLAGS => '',
|
2017-04-16 19:40:57 +00:00
|
|
|
CC => 'c99', CFLAGS => '-O1',
|
|
|
|
FC => 'fort77', FFLAGS => '-O1',
|
2012-09-09 19:19:15 +00:00
|
|
|
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);
|
|
|
|
|
2010-07-06 06:37:42 +00:00
|
|
|
# This tells the test driver that the perl test script executed properly.
|
|
|
|
1;
|