Commit 24de2876 authored by Dario Pinto's avatar Dario Pinto

change infer.mk and add infer_evaluate_case.sh

parent 548607ca
......@@ -18,17 +18,17 @@ define generate-infer-rules =
$(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 evaluate_case.sh
./evaluate_case.sh good $$</report.json > $$</eval.txt
$(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 evaluate_case.sh
./evaluate_case.sh bad $$</report.json > $$</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))
sed -i 's/unsound/false negative/g' $^ > infer_eval_sumup.txt
cat $^ > infer_eval_sumup.txt
evaluate: infer_eval_sumup.txt
.PHONY: infer_eval_sumup.txt
......
#!/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