tests: add checks for SHA executable
authorTJ <hacker@iam.tj>
Tue, 29 Mar 2016 16:19:11 +0000 (17:19 +0100)
committerTJ <hacker@iam.tj>
Tue, 29 Mar 2016 16:22:28 +0000 (17:22 +0100)
Signed-off-by: TJ <hacker@iam.tj>
testsuite/Makefile

index b13bd3d..073991e 100644 (file)
@@ -10,10 +10,11 @@ OPTS = -t -q
 
 EXE := ../$(PROG)
 TEST_DIR := $(shell mktemp --directory )
-SHA1SUM := $(shell which sha1sum )
+SHA := sha1sum
+SHASUM := $(shell which $(SHA) )
 HDR_ORIG := header_test.bin
 HDR_TEST := $(TEST_DIR)/header_test.bin
-CHK_HDR_ORIG=$(shell $(SHA1SUM) $(HDR_TEST) )
+CHK_HDR_ORIG=$(shell $(SHASUM) $(HDR_TEST) )
 
 tests: banner test_nochange test_man_nomatch test_man_match
        -rm -rf $(TEST_DIR)
@@ -29,9 +30,11 @@ 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) | $(SHA1SUM) --check --quiet
+       echo $(CHK_HDR_ORIG) | $(SHASUM) --check --quiet
 
 hdr_duplicate:
        cp $(HDR_ORIG) $(HDR_TEST)