xref: /freebsd/contrib/bmake/unit-tests/shell-ksh.mk (revision 0b46a53a2f50b5ab0f4598104119a049b9c42cc9)
1# $NetBSD: shell-ksh.mk,v 1.2 2025/06/05 21:56:54 rillig Exp $
2#
3# Tests for using a Korn shell for running the commands.
4
5KSH!=	which ksh 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 ${KSH} != ""
11.SHELL: name="ksh" path="${KSH}"
12.endif
13
14# In parallel mode, the shell->noPrint command is filtered from
15# the output, rather naively (in PrintOutput).
16.MAKEFLAGS: -j1
17
18all:
19.if ${KSH} != ""
20	# This command is both printed and executed.
21	echo normal
22
23	# This command is only executed.
24	@echo hidden
25
26	# This command is both printed and executed.
27	+echo always
28
29	# This command is both printed and executed.
30	-echo ignore errors
31
32	# In the Korn shell, "set +v" is set as the noPrint command.
33	# Therefore, it is filtered from the output, rather naively.
34# FIXME: Don't assume a newline character in PrintFilteredOutput.
35# expect: The "is filtered out.
36	@echo 'The "set +v" is filtered out.'
37.else
38	@sed '$$d' ${MAKEFILE:.mk=.exp}	# This is cheated.
39.endif
40