b13bd3d59376011faa46a79377f7444a8c605672
[firmware_header_edit.git] / testsuite / Makefile
1 OPT_i = -i
2 OPT_l = -l
3 OPT_m = -m
4 OPT_M = -M
5 OPT_s = -s
6 opt_w = -w
7
8 # test suite formatted output
9 OPTS = -t -q
10
11 EXE := ../$(PROG)
12 TEST_DIR := $(shell mktemp --directory )
13 SHA1SUM := $(shell which sha1sum )
14 HDR_ORIG := header_test.bin
15 HDR_TEST := $(TEST_DIR)/header_test.bin
16 CHK_HDR_ORIG=$(shell $(SHA1SUM) $(HDR_TEST) )
17
18 tests: banner test_nochange test_man_nomatch test_man_match
19         -rm -rf $(TEST_DIR)
20
21 banner:
22         @echo "Starting tests"
23
24 tests_dir: $(TEST_DIR)
25         @echo "Tests directory: $(TEST_DIR)"
26
27 exe:
28         @echo "Testing $(EXE)"
29         @test -e $(EXE) || ( echo "executable $(EXE) does not exist" && /bin/false )
30         @test -f $(EXE) || ( echo "executable $(EXE) is not a file" && /bin/false )
31         @test -x $(EXE) || ( echo "executable $(EXE) is not executable" && /bin/false )
32
33 checksum:
34         echo $(CHK_HDR_ORIG) | $(SHA1SUM) --check --quiet
35
36 hdr_duplicate:
37         cp $(HDR_ORIG) $(HDR_TEST)
38
39 test_nochange: exe tests_dir hdr_duplicate checksum
40         $(EXE) $(OPTS) $(HDR_TEST) 2>/dev/null 
41
42 test_man_nomatch:
43
44 test_man_match:
45
46 .PHONY: tests exe
47