From 9074c751436ea50e1f203c3cf3632f161e3ff869 Mon Sep 17 00:00:00 2001
From: Andreas Romeyke <andreas.romeyke@slub-dresden.de>
Date: Thu, 5 Jan 2023 19:15:27 +0100
Subject: [PATCH] - use shell tests instead makefile-tests, because lazy
 evaluation

---
 Makefile | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index f200173..e8cf00d 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,7 @@ SOURCES:=java/org/slub/rosetta/dps/repository/plugin/SLUBVirusCheckClamAVPlugin.
 OBJS:=$(SOURCES:.java=.class)
 JAR:=SLUBVirusCheckPlugin.jar
 BUILD:=build/
+SHELL=/bin/bash
 
 all: $(BUILD) $(JAR)
 
@@ -75,20 +76,12 @@ check_prerequisites:
 test_eicar: $(OBJS)
 	@/usr/bin/java -cp $(CLASSPATH):$(JUNITCLASSPATH):java org.slub.rosetta.dps.repository.plugin.SLUBVirusCheckClamAVPlugin EICAR/eicar | grep -F 'SIGNATURE:' > $@
 	@echo -n "testing 'EICAR':"
-ifeq "$(shell cat test_eicar)" "RESULT: 2 SIGNATURE: Eicar-Signature"
-	@echo pass;
-else
-	@echo failed; exit 2;
-endif
+	@if [[ "$$(cat test_eicar)" = "RESULT: 2 SIGNATURE: Eicar-Signature" ]]; then echo pass; else echo failed; exit 2;fi
 
 test_novirus: $(OBJS)
 	@/usr/bin/java -cp $(CLASSPATH):$(JUNITCLASSPATH):java org.slub.rosetta.dps.repository.plugin.SLUBVirusCheckClamAVPlugin Makefile | grep -F 'SIGNATURE:' > $@
 	@echo -n "testing 'No virus': "
-ifeq "$(shell cat test_novirus)" "RESULT: 0 SIGNATURE: "
-	@echo pass;
-else
-	@echo fail; exit 2;
-endif
+	@if [[ "$$(cat test_novirus)" = "RESULT: 0 SIGNATURE: " ]]; then echo pass; else echo fail; exit 2; fi
 
 test:  test_eicar test_novirus
 
-- 
GitLab