From 7cc80b3b9a2eebf5286a983df3ebaf3952ea6fca Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Wed, 1 Jan 2020 20:48:52 +0000 Subject: Verification function checks if file exists Until now, if the file to be verified didn't exist, a different checksum would be generated, and it would stop, but it wasn't immediately clear if the differing checksum is because the file doesn't exist at all! With this commit, before calculating the checksum, we first make sure if the file exists. If it doesn't exist an explicit error is printed and thus will help the project editor to find the cause of the problem. --- reproduce/analysis/make/verify.mk | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'reproduce/analysis') diff --git a/reproduce/analysis/make/verify.mk b/reproduce/analysis/make/verify.mk index 440ac57..1173f2c 100644 --- a/reproduce/analysis/make/verify.mk +++ b/reproduce/analysis/make/verify.mk @@ -23,6 +23,12 @@ # ---------------------- # # These functions are used by the final rule in this Makefil +verify-print-error-start = \ + echo; \ + echo "VERIFICATION ERROR"; \ + echo "------------------"; \ + echo + verify-print-tips = \ echo "If you are still developing your project, you can disable"; \ echo "verification by removing the value of the variable in the"; \ @@ -37,6 +43,12 @@ verify-print-tips = \ verify-txt-no-comments-leading-space = \ infile=$(strip $(1)); \ inchecksum=$(strip $(2)); \ + if ! [ -f "$$infile" ]; then \ + $(call verify-print-error-start); \ + echo "The following file (that should be verified) doesn't exist:"; \ + echo " $$infile"; \ + echo; exit 1; \ + fi; \ checksum=$$(sed -e 's/^[[:space:]]*//g' \ -e 's/\#.*$$//' \ -e '/^$$/d' $$infile \ @@ -45,9 +57,7 @@ verify-txt-no-comments-leading-space = \ if [ x"$$inchecksum" = x"$$checksum" ]; then \ echo "Verified: $$infile"; \ else \ - echo; \ - echo "VERIFICATION ERROR"; \ - echo "------------------"; \ + $(call verify-print-error-start); \ $(call verify-print-tips); \ echo; \ echo "Checked file (without empty or commented lines):"; \ -- cgit v1.2.1