opt-jobs-no-action.mk revision 1.1 1 1.1 rillig # $NetBSD: opt-jobs-no-action.mk,v 1.1 2020/12/09 00:25:00 rillig Exp $
2 1.1 rillig #
3 1.1 rillig # Tests for the combination of the options -j and -n, which prints the
4 1.1 rillig # commands instead of actually running them.
5 1.1 rillig #
6 1.1 rillig # The format of the output differs from the output of only the -n option,
7 1.1 rillig # without the -j. This is because all this code is implemented twice, once
8 1.1 rillig # in compat.c and once in job.c.
9 1.1 rillig
10 1.1 rillig .MAKEFLAGS: -j1 -n
11 1.1 rillig
12 1.1 rillig # Change the templates for running the commands in jobs mode, to make it
13 1.1 rillig # easier to see what actually happens.
14 1.1 rillig #
15 1.1 rillig # The shell attributes are handled by Job_ParseShell.
16 1.1 rillig # The shell attributes 'quiet' and 'echo' don't need a trailing newline,
17 1.1 rillig # this is handled by the [0] != '\0' checks in Job_ParseShell.
18 1.1 rillig # The '\#' is handled by ParseGetLine.
19 1.1 rillig # The '\n' is handled by Str_Words in Job_ParseShell.
20 1.1 rillig # The '$$' is handled by Var_Subst in ParseDependency.
21 1.1 rillig .SHELL: \
22 1.1 rillig name=sh \
23 1.1 rillig path=${.SHELL} \
24 1.1 rillig quiet="\# .echoOff" \
25 1.1 rillig echo="\# .echoOn" \
26 1.1 rillig filter="\# .noPrint\n" \
27 1.1 rillig check="\# .errOnOrEcho\n""echo \"%s\"\n" \
28 1.1 rillig ignore="\# .errOffOrExecIgnore\n""%s\n" \
29 1.1 rillig errout="\# .errExit\n""{ %s \n} || exit $$?\n"
30 1.1 rillig
31 1.1 rillig all:
32 1.1 rillig # The following command is regular, it is printed twice:
33 1.1 rillig # - first using the template shell.errOnOrEcho,
34 1.1 rillig # - then using the template shell.errExit.
35 1.1 rillig false regular
36 1.1 rillig
37 1.1 rillig # The following command is silent, it is printed once, using the
38 1.1 rillig # template shell.errExit.
39 1.1 rillig @: silent
40 1.1 rillig
41 1.1 rillig # The following command ignores errors, it is printed once, using
42 1.1 rillig # the default template for cmdTemplate, which is "%s\n".
43 1.1 rillig # XXX: Why is it not printed using shell.errOnOrEcho as well?
44 1.1 rillig # XXX: The '-' should not influence the echoing of the command.
45 1.1 rillig -false ignore-errors
46 1.1 rillig
47 1.1 rillig # The following command ignores the -n command line option, it is
48 1.1 rillig # not handled by the Job module but by the Compat module, see the
49 1.1 rillig # '!silent' in Compat_RunCommand.
50 1.1 rillig +echo run despite the -n option
51 1.1 rillig
52 1.1 rillig # TODO: test all 8 combinations of '-', '+', '@'.
53 1.1 rillig # TODO: for each of the above test, test '-true' and '-false'.
54 1.1 rillig # The code with its many branches feels like a big mess.
55 1.1 rillig # See opt-jobs.mk for the corresponding tests without the -n option.
56