summaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/shell-ksh.mk
blob: 676c8e2d47d97f27f02505c6de059b1bedfd6cda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# $NetBSD: shell-ksh.mk,v 1.2 2025/06/05 21:56:54 rillig Exp $
#
# Tests for using a Korn shell for running the commands.

KSH!=	which ksh 2> /dev/null || true

# The shell path must be an absolute path.
# This is only obvious in parallel mode since in compat mode,
# simple commands are executed via execvp directly.
.if ${KSH} != ""
.SHELL: name="ksh" path="${KSH}"
.endif

# In parallel mode, the shell->noPrint command is filtered from
# the output, rather naively (in PrintOutput).
.MAKEFLAGS: -j1

all:
.if ${KSH} != ""
	# This command is both printed and executed.
	echo normal

	# This command is only executed.
	@echo hidden

	# This command is both printed and executed.
	+echo always

	# This command is both printed and executed.
	-echo ignore errors

	# In the Korn shell, "set +v" is set as the noPrint command.
	# Therefore, it is filtered from the output, rather naively.
# FIXME: Don't assume a newline character in PrintFilteredOutput.
# expect: The "is filtered out.
	@echo 'The "set +v" is filtered out.'
.else
	@sed '$$d' ${MAKEFILE:.mk=.exp}	# This is cheated.
.endif