VirtualBox

source: kBuild/trunk/src/kmk/tests/scripts/targets/POSIX@ 3140

Last change on this file since 3140 was 3140, checked in by bird, 7 years ago

kmk: Merged in changes from GNU make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6 / https://git.savannah.gnu.org/git/make.git).

File size: 1.5 KB
Line 
1# -*-perl-*-
2
3$description = "Test the behaviour of the .POSIX target.";
4
5$details = "";
6
7
8# Ensure turning on .POSIX enables the -e flag for the shell
9# We can't assume the exit value of "false" because on different systems it's
10# different.
11
12my $script = 'false; true';
13my $flags = '-ec';
14my $out = `/bin/sh $flags '$script' 2>&1`;
15my $err = $? >> 8;
16run_make_test(qq!
17.POSIX:
18all: ; \@$script
19!,
20 '', "#MAKE#: *** [#MAKEFILE#:3: all] Error $err\n", 512);
21
22# User settings must override .POSIX
23$flags = '-xc';
24$out = `/bin/sh $flags '$script' 2>&1`;
25run_make_test(qq!
26.SHELLFLAGS = $flags
27.POSIX:
28all: ; \@$script
29!,
30 '', $out);
31
32# Test the default value of various POSIX-specific variables
33my %POSIX = (AR => 'ar', ARFLAGS => '-rv',
34 YACC => 'yacc', YFLAGS => '',
35 LEX => 'lex', LFLAGS => '',
36 LDFLAGS => '',
37 CC => 'c99', CFLAGS => '-O',
38 FC => 'fort77', FFLAGS => '-O 1',
39 GET => 'get', GFLAGS => '',
40 SCCSFLAGS => '', SCCSGETFLAGS => '-s');
41my $make = join('', map { "\t\@echo '$_=\$($_)'\n" } sort keys %POSIX);
42my $r = join('', map { "$_=$POSIX{$_}\n"} sort keys %POSIX);
43run_make_test(qq!
44.POSIX:
45all:
46$make
47!,
48 '', $r);
49
50# Make sure that local settings take precedence
51%extraENV = map { $_ => "xx-$_" } keys %POSIX;
52$r = join('', map { "$_=xx-$_\n"} sort keys %POSIX);
53run_make_test(undef, '', $r);
54
55# This tells the test driver that the perl test script executed properly.
561;
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette