summaryrefslogtreecommitdiffstats
path: root/src/kash/tests/Makefile.kmk
blob: 40e081debe76eb5b3c59afb66b5f4d31a0b483bf (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# $Id: Makefile.kmk 3433 2020-09-02 17:25:31Z bird $
## @file
# Sub-makefile for kash tests.
#

#
# Copyright (c) 2005-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
#
# This file is part of kBuild.
#
# kBuild is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# kBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with kBuild.  If not, see <http://www.gnu.org/licenses/>
#
#

SUB_DEPTH = ../../..
include $(KBUILD_PATH)/subheader.kmk

#
# The program.
#

TESTING += kash_tests

KASH_TEST_BIN   = $(if $(kash_1_TARGET),$(kash_1_TARGET),$(PATH_INS)/$(TEMPLATE_BIN_INST)kmk_ash$(SUFF_EXE))
KASH_TEST_DIR  := $(PATH_SUB_CURRENT)
KASH_TESTCASES := $(addprefix $(KASH_TEST_DIR)/,\
	trap-exit-1 \
	trap-int-1 \
	trap-term-1 \
	tick-1 \
	redirect-1 \
	redirect-2 \
	redirect-3 \
	pipe-1 \
	pipe-2 \
	)

#	exec-1  - lost


kash_tests::
	$(ECHO) "kash tests..."
	@export KASH_TEST_DIR=$(KASH_TEST_DIR); \
	KASH_FAILURE=0; \
	$(foreach test,$(KASH_TESTCASES)\
		,echo " * $(KASH_TEST_BIN) $(test)"; \
		if ! $(KASH_TEST_BIN) $(test); then \
			echo " => FAILURE!"; \
			KASH_FAILURE=`$(EXPR_EXT) $${KASH_FAILURE} + 1`; \
		fi; \
		) \
	if test $$KASH_FAILURE -eq 0; then \
		echo 'kash tests: All tests succeeded.'; \
	else \
		echo "kash tests: $$KASH_FAILURE tests failed"'!!'; \
		echo ""; \
		exit 1; \
	fi



include $(FILE_KBUILD_SUB_FOOTER)