Feat: valgrind
This commit is contained in:
parent
06992f0421
commit
79712efa7f
1 changed files with 31 additions and 7 deletions
|
@ -7,6 +7,10 @@ CFLAGS = -Ilib -ggdb -std=c11 -g -Wall -Wextra -no-pie -O3
|
|||
LDFLAGS = -pthread
|
||||
TESTFILES = t/1 t/2 t/5 t/10 t/20 t/50 t/100 t/1000 t/2000 t/5000 t/10000
|
||||
TESTFILES_SIZES = ${subst t/,,${TESTFILES}}
|
||||
BLUE=\033[1;36m
|
||||
RED=\033[1;31m
|
||||
GREEN=\033[1;32m
|
||||
NC=\033[0m
|
||||
|
||||
all: md2
|
||||
|
||||
|
@ -32,9 +36,9 @@ md2: ${OBJ}
|
|||
t/%:
|
||||
@mkdir -p t
|
||||
@echo
|
||||
@echo "=== Generating ${subst t/,,$@}MB of random data... ==="
|
||||
@echo -e "${BLUE}=== Generating ${subst t/,,$@}MB of random data... ===${NC}"
|
||||
dd if=/dev/random of=$@ bs=1M count=${subst t/,,$@} status=progress
|
||||
@echo "=== done ==="
|
||||
@echo "${BLUE}=== done ===${NC}"
|
||||
@echo
|
||||
|
||||
benchmarks.csv: md2 ${TESTFILES}
|
||||
|
@ -47,13 +51,13 @@ benchmarks.csv: md2 ${TESTFILES}
|
|||
|
||||
@for i in 0 1 2 3 4; do \
|
||||
echo ;\
|
||||
echo "=== Testing implementation $$i ===";\
|
||||
echo -e "${BLUE}=== Testing implementation $$i ===${NC}";\
|
||||
echo -n "Implementierung-$$i" >> $@; \
|
||||
for t in $(TESTFILES_SIZES); do \
|
||||
echo -n "- with $${t}MB ... "; \
|
||||
if ! rr=$$(./md2 t/$${t} -B1 -V$${i}); then \
|
||||
echo; \
|
||||
echo "SKIPPED!"; \
|
||||
echo -e "${RED}ERROR -> SKIPPED!${NC}"; \
|
||||
echo -n ";0" >> $@; \
|
||||
else \
|
||||
r=$$(echo $$rr | xargs | sed -e 's/.*took \(.*\) seconds.*/\1/'); \
|
||||
|
@ -62,10 +66,30 @@ benchmarks.csv: md2 ${TESTFILES}
|
|||
fi; \
|
||||
done; \
|
||||
echo "" >> $@; \
|
||||
echo "=== done ===";\
|
||||
echo -e "${BLUE}=== done ===${NC}";\
|
||||
echo;\
|
||||
done
|
||||
|
||||
benchmarks: benchmarks.csv
|
||||
|
||||
.PHONY: all clean help benchmarks
|
||||
lint: md2 t/3
|
||||
|
||||
@for i in 0 1 2 3 4; do \
|
||||
echo; \
|
||||
echo -e "${BLUE}=== Testing implementation $$i ===${NC}";\
|
||||
if ! valgrind --error-exitcode=1 --leak-check=full --tool=memcheck -s ./md2 t/3 -V$$i -B1; then \
|
||||
echo -e "${RED}ERROR found! (see above)${NC}"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
echo -e "${BLUE}=== done ===${NC}";\
|
||||
echo; \
|
||||
done
|
||||
|
||||
@if ! valgrind -s ./md2 -T; then \
|
||||
echo -e "${RED}ERROR found! (see above)${NC}"; \
|
||||
exit 1;\
|
||||
fi
|
||||
|
||||
@echo -e "${GREEN}=== all implementations PASSED valgrind ===${NC}"
|
||||
|
||||
.PHONY: all clean help benchmarks lint
|
||||
|
|
Loading…
Reference in a new issue