VirtualBox

source: kBuild/trunk/src/kmk/tests/scripts/options/dash-n

Last change on this file 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).

  • Property svn:eol-style set to LF
File size: 2.3 KB
Line 
1# -*-perl-*-
2$description = "Test the -n option.\n";
3
4$details = "Try various uses of -n and ensure they all give the correct results.\n";
5
6touch('orig');
7
8run_make_test(q!
9final: intermediate ; echo >> $@
10intermediate: orig ; echo >> $@
11!,
12 '', "echo >> intermediate\necho >> final\n");
13
14# TEST 1
15
16run_make_test(undef, '-Worig -n', "echo >> intermediate\necho >> final\n");
17
18rmfiles(qw(orig intermediate final));
19
20# We consider the actual updated timestamp of targets with all
21# recursive commands, even with -n. Switching this to the new model
22# is non-trivial because we use a trick below to change the log content
23# before we compare it ...
24
25$makefile2 = &get_tmpfile;
26
27open(MAKEFILE, "> $makefile2");
28
29print MAKEFILE <<'EOF';
30.SUFFIXES:
31BAR = # nothing
32FOO = +$(BAR)
33a: b; echo > $@
34b: c; $(FOO)
35EOF
36
37close(MAKEFILE);
38
39&utouch(-20, 'b');
40&utouch(-10, 'a');
41&touch('c');
42
43# TEST 2
44
45&run_make_with_options($makefile2, "", &get_logfile);
46$answer = "$make_name: 'a' is up to date.\n";
47&compare_output($answer, &get_logfile(1));
48
49# TEST 3
50
51&run_make_with_options($makefile2, "-n", &get_logfile);
52$answer = "$make_name: 'a' is up to date.\n";
53&compare_output($answer, &get_logfile(1));
54
55# TEST 4
56
57unlink(qw(a b));
58
59&run_make_with_options($makefile2, "-t -n", &get_logfile);
60
61open(DASH_N_LOG, ">>" . &get_logfile(1));
62print DASH_N_LOG "a exists but should not!\n" if -e 'a';
63print DASH_N_LOG "b exists but should not!\n" if -e 'b';
64close(DASH_N_LOG);
65
66&compare_output("touch b\ntouch a\n", &get_logfile(1));
67
68# CLEANUP
69
70unlink(qw(a b c));
71
72# Ensure -n continues to be included with recursive/re-execed make
73# See Savannah bug #38051
74
75$topmake = &get_tmpfile;
76$submake = &get_tmpfile;
77
78open(MAKEFILE, "> $topmake");
79print MAKEFILE <<"EOF";
80foo: ; \@\$(MAKE) -f "$submake" bar
81EOF
82close(MAKEFILE);
83
84
85# The bar target should print what would happen, but not actually run
86open(MAKEFILE, "> $submake");
87print MAKEFILE <<'EOF';
88inc: ; touch $@
89-include inc
90bar: ; @echo $(strip $(MAKEFLAGS))
91EOF
92close(MAKEFILE);
93
94&run_make_with_options($topmake, '-n --no-print-directory', &get_logfile);
95$answer = "$make_command -f \"$submake\" bar\ntouch inc\necho n --no-print-directory\n";
96&compare_output($answer, &get_logfile(1));
97
98unlink('inc');
99
1001;
Note: See TracBrowser for help on using the repository browser.

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