mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-17 18:43:50 +01:00
makefiles/tests: Add test-input-hash-changed target
This target allows one to check if a test-input-hash is there and if it differs from a new one, adding basic support to skip tests if nothing needs to be run.
This commit is contained in:
parent
8a77807e57
commit
66d75f191c
@ -102,3 +102,26 @@ else
|
|||||||
test-input-hash: .SECONDARY
|
test-input-hash: .SECONDARY
|
||||||
$(file >$(RIOT_TEST_HASH_DIR)/test-input-hash.sha1,no binary generated due to RIOTNOLINK=1)
|
$(file >$(RIOT_TEST_HASH_DIR)/test-input-hash.sha1,no binary generated due to RIOTNOLINK=1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Helper function to compare two strings
|
||||||
|
define compare_strings
|
||||||
|
$(and $(filter $1,$2),$(filter $2,$1))
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Target to test only if the input hash has changed
|
||||||
|
.PHONY: test-input-hash-changed
|
||||||
|
test-input-hash-changed:
|
||||||
|
@if [ ! -f "$(RIOT_TEST_HASH_DIR)/test-input-hash.sha1" ]; then \
|
||||||
|
echo "Old hash file doesn't exist. Generating hash and running tests..."; \
|
||||||
|
mkdir -p $(RIOT_TEST_HASH_DIR); \
|
||||||
|
$(MAKE) test-input-hash; \
|
||||||
|
else \
|
||||||
|
OLD_HASH=$$(cat $(RIOT_TEST_HASH_DIR)/test-input-hash.sha1); \
|
||||||
|
$(MAKE) test-input-hash; \
|
||||||
|
NEW_HASH=$$(cat $(RIOT_TEST_HASH_DIR)/test-input-hash.sha1); \
|
||||||
|
if [ "$${OLD_HASH}" != "$${NEW_HASH}" ]; then \
|
||||||
|
echo "Hashes do not match."; \
|
||||||
|
else \
|
||||||
|
echo "Hashes match."; \
|
||||||
|
fi; \
|
||||||
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user