xref: /freebsd/contrib/bmake/unit-tests/shell-csh.mk (revision 0b46a53a2f50b5ab0f4598104119a049b9c42cc9)
1# $NetBSD: shell-csh.mk,v 1.10 2025/06/05 21:56:54 rillig Exp $
2#
3# Tests for using a C shell for running the commands.
4
5CSH!=	which csh 2> /dev/null || true
6
7# The shell path must be an absolute path.
8# This is only obvious in parallel mode since in compat mode,
9# simple commands are executed via execvp directly.
10.if ${CSH} != ""
11.SHELL: name="csh" path="${CSH}"
12.endif
13
14# In parallel mode, the shell->noPrint command is filtered from
15# the output, rather naively (in PrintOutput).
16#
17# Until 2020-10-03, the output in parallel mode was garbled because
18# the definition of the csh had been wrong since 1993 at least.
19.MAKEFLAGS: -j1
20
21all:
22.if ${CSH} != ""
23	# This command is both printed and executed.
24	echo normal
25
26	# This command is only executed.
27	@echo hidden
28
29	# This command is both printed and executed.
30	+echo always
31
32	# This command is both printed and executed.
33	-echo ignore errors
34
35	# In the C shell, "unset verbose" is set as the noPrint command.
36	# Therefore, it is filtered from the output, rather naively.
37# FIXME: Don't assume a newline character in PrintFilteredOutput.
38# expect: They chatted in the sy.
39	@echo 'They chatted in the sunset verbosely.'
40.else
41	@sed '$$d' ${MAKEFILE:.mk=.exp}	# This is cheated.
42.endif
43