Commit fe5e4dcf authored by Dario Pinto's avatar Dario Pinto Committed by Andre Maroneze
Browse files

[bench-moerman2018] add makefile, script and summary results for Infer

parent 376640d2
INFER = infer run
CPPFLAGS += \
-Icommon \
# excludes files with recursive functions
filter-out-substring = $(foreach v,$(2),$(if $(findstring $(1),$(v)),,$(v)))
SRCS:=$(sort $(call filter-out-substring,leak,$(call filter-out-substring,recursion,$(wildcard base/*.c */*/*.c))))
GOOD_TARGETS:=$(foreach s,$(SRCS),$(subst /,_,$(s:%.c=%))_good.infer)
BAD_TARGETS:=$(foreach s,$(SRCS),$(subst /,_,$(s:%.c=%))_bad.infer)
TARGETS:=$(GOOD_TARGETS) $(BAD_TARGETS)
define generate-infer-rules =
$(subst /,_,$(1:%.c=%))_good.infer: $(if $(findstring cross_file,$(1)),common/common.c,) $(1)
$(INFER) -o $$@ -- clang -DNO_BUG $(CPPFLAGS) $$^
$(subst /,_,$(1:%.c=%))_bad.infer: $(if $(findstring cross_file,$(1)),common/common.c,) $(1)
$(INFER) -o $$@ -- clang $(CPPFLAGS) $$^
$(subst /,_,$(1:%.c=%))_good.infer/eval.txt: $(subst /,_,$(1:%.c=%))_good.infer infer_evaluate_case.sh
./infer_evaluate_case.sh good $$</bugs.txt > $$</eval.txt
$(subst /,_,$(1:%.c=%))_bad.infer/eval.txt: $(subst /,_,$(1:%.c=%))_bad.infer infer_evaluate_case.sh
./infer_evaluate_case.sh bad $$</bugs.txt > $$</eval.txt
endef
$(foreach s,$(SRCS),$(eval $(call generate-infer-rules,$(s))))
infer_eval_sumup.txt: $(addsuffix /eval.txt, $(TARGETS))
cat $^ > infer_eval_sumup.txt
evaluate: infer_eval_sumup.txt
.PHONY: infer_eval_sumup.txt
good: $(GOOD_TARGETS)
bad: $(BAD_TARGETS)
all: good bad
clean:
@rm -rf *_good.infer
@rm -rf *_bad.infer
@rm -rf a.out
@rm -rf infer-out
This diff is collapsed.
#!/bin/bash -eu
if [ $# -lt 2 ]; then
echo "usage: $0 (good|bad) path/to/bugs.txt"
exit 1
fi
goodbad="$1"
alarms=$(wc -l "$2" | cut -d' ' -f1)
case $goodbad in
"good")
if [ "$alarms" -gt 1 ]; then
echo "$2 ($goodbad): imprecise"
else
echo "$2 ($goodbad): ok"
fi
;;
"bad")
if [ "$alarms" -lt 2 ]; then
echo "$2 ($goodbad): false negative"
else
echo "$2 ($goodbad): ok"
fi
;;
*)
echo "invalid '$goodbad': must be either 'good' or 'bad'."
exit 1
esac
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment