OPT_i = -i OPT_l = -l OPT_m = -m OPT_M = -M OPT_s = -s opt_w = -w # test suite formatted output OPTS = -t -q EXE := ../$(PROG) TEST_DIR := $(shell mktemp --directory ) CP := cp RM := rm -f SHA := sha1sum SHASUM := $(shell which $(SHA) ) HDR_ORIG := header_test.bin HDR_TEST := $(TEST_DIR)/header_test.bin CHK_HDR_ORIG=$(shell $(SHASUM) $(HDR_TEST) ) tests: banner test_nochange test_man_nomatch test_man_match -$(RM) -r $(TEST_DIR) banner: @echo "Starting tests" tests_dir: $(TEST_DIR) @echo "Tests directory: $(TEST_DIR)" exe: @echo "Testing $(EXE)" @test -e $(EXE) || ( echo "executable $(EXE) does not exist" && /bin/false ) @test -f $(EXE) || ( echo "executable $(EXE) is not a file" && /bin/false ) @test -x $(EXE) || ( echo "executable $(EXE) is not executable" && /bin/false ) @echo "Checking for $(SHA)" @test -x $(SHASUM) || ( echo "$(SHA) not found" && /bin/false ) checksum: echo $(CHK_HDR_ORIG) | $(SHASUM) --check --quiet hdr_duplicate: $(CP) $(HDR_ORIG) $(HDR_TEST) test_nochange: exe tests_dir hdr_duplicate checksum $(EXE) $(OPTS) $(HDR_TEST) 2>/dev/null test_man_nomatch: test_man_match: .PHONY: tests exe