[2282] | 1 | # $Id: Makefile.kmk 3433 2020-09-02 17:25:31Z bird $
|
---|
| 2 | ## @file
|
---|
| 3 | # Sub-makefile for kash tests.
|
---|
| 4 | #
|
---|
| 5 |
|
---|
| 6 | #
|
---|
[2413] | 7 | # Copyright (c) 2005-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
|
---|
[2282] | 8 | #
|
---|
| 9 | # This file is part of kBuild.
|
---|
| 10 | #
|
---|
| 11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
| 12 | # it under the terms of the GNU General Public License as published by
|
---|
| 13 | # the Free Software Foundation; either version 3 of the License, or
|
---|
| 14 | # (at your option) any later version.
|
---|
| 15 | #
|
---|
| 16 | # kBuild is distributed in the hope that it will be useful,
|
---|
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | # GNU General Public License for more details.
|
---|
| 20 | #
|
---|
| 21 | # You should have received a copy of the GNU General Public License
|
---|
| 22 | # along with kBuild. If not, see <http://www.gnu.org/licenses/>
|
---|
| 23 | #
|
---|
| 24 | #
|
---|
| 25 |
|
---|
[2423] | 26 | SUB_DEPTH = ../../..
|
---|
[2282] | 27 | include $(KBUILD_PATH)/subheader.kmk
|
---|
| 28 |
|
---|
| 29 | #
|
---|
| 30 | # The program.
|
---|
| 31 | #
|
---|
| 32 |
|
---|
| 33 | TESTING += kash_tests
|
---|
| 34 |
|
---|
[2423] | 35 | KASH_TEST_BIN = $(if $(kash_1_TARGET),$(kash_1_TARGET),$(PATH_INS)/$(TEMPLATE_BIN_INST)kmk_ash$(SUFF_EXE))
|
---|
[2284] | 36 | KASH_TEST_DIR := $(PATH_SUB_CURRENT)
|
---|
| 37 | KASH_TESTCASES := $(addprefix $(KASH_TEST_DIR)/,\
|
---|
[2282] | 38 | trap-exit-1 \
|
---|
| 39 | trap-int-1 \
|
---|
| 40 | trap-term-1 \
|
---|
[2284] | 41 | tick-1 \
|
---|
| 42 | redirect-1 \
|
---|
| 43 | redirect-2 \
|
---|
| 44 | redirect-3 \
|
---|
[2285] | 45 | pipe-1 \
|
---|
| 46 | pipe-2 \
|
---|
[2282] | 47 | )
|
---|
| 48 |
|
---|
[3433] | 49 | # exec-1 - lost
|
---|
[2282] | 50 |
|
---|
[3433] | 51 |
|
---|
[2284] | 52 | kash_tests::
|
---|
[2282] | 53 | $(ECHO) "kash tests..."
|
---|
[2284] | 54 | @export KASH_TEST_DIR=$(KASH_TEST_DIR); \
|
---|
| 55 | KASH_FAILURE=0; \
|
---|
[2282] | 56 | $(foreach test,$(KASH_TESTCASES)\
|
---|
[2284] | 57 | ,echo " * $(KASH_TEST_BIN) $(test)"; \
|
---|
| 58 | if ! $(KASH_TEST_BIN) $(test); then \
|
---|
| 59 | echo " => FAILURE!"; \
|
---|
| 60 | KASH_FAILURE=`$(EXPR_EXT) $${KASH_FAILURE} + 1`; \
|
---|
| 61 | fi; \
|
---|
| 62 | ) \
|
---|
| 63 | if test $$KASH_FAILURE -eq 0; then \
|
---|
| 64 | echo 'kash tests: All tests succeeded.'; \
|
---|
| 65 | else \
|
---|
[2288] | 66 | echo "kash tests: $$KASH_FAILURE tests failed"'!!'; \
|
---|
| 67 | echo ""; \
|
---|
[2284] | 68 | exit 1; \
|
---|
| 69 | fi
|
---|
[2282] | 70 |
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
| 74 |
|
---|
| 75 |
|
---|