diff options
author | Cyril SIX <cyril.six@kalray.eu> | 2018-04-25 15:26:28 +0200 |
---|---|---|
committer | Cyril SIX <cyril.six@kalray.eu> | 2018-04-25 15:26:28 +0200 |
commit | aa26db13f4daedec371a17ee7f79ecce7f8fb60f (patch) | |
tree | e3f26cfc68b26bb3e03a363ebb95efd97d9b79e7 /test/mppa | |
parent | 28db3119a6fef8a6ef487b414f7851a065db0889 (diff) | |
download | compcert-kvx-aa26db13f4daedec371a17ee7f79ecce7f8fb60f.tar.gz compcert-kvx-aa26db13f4daedec371a17ee7f79ecce7f8fb60f.zip |
MPPA - Added coverage test
Diffstat (limited to 'test/mppa')
-rw-r--r-- | test/mppa/Makefile | 5 | ||||
m--------- | test/mppa/asm_coverage | 0 | ||||
-rw-r--r-- | test/mppa/coverage.sh | 17 | ||||
-rw-r--r-- | test/mppa/coverage_helper.py | 35 |
4 files changed, 57 insertions, 0 deletions
diff --git a/test/mppa/Makefile b/test/mppa/Makefile index b210efaf..87315f6e 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -37,6 +37,11 @@ FORCE: check: $(TOK) sort mmult .PHONY: +coverage: $(ASM) + bash coverage.sh $(DIR)/$(ASMDIR) + + +.PHONY: sort: FORCE (cd sort && make compc-check) diff --git a/test/mppa/asm_coverage b/test/mppa/asm_coverage new file mode 160000 +Subproject 5bdb081bc5fd4962315e960af3c539f2ddd2447 diff --git a/test/mppa/coverage.sh b/test/mppa/coverage.sh new file mode 100644 index 00000000..0a057ff9 --- /dev/null +++ b/test/mppa/coverage.sh @@ -0,0 +1,17 @@ +asmdir=$1 +to_cover_raw=/tmp/to_cover_raw +to_cover=/tmp/to_cover +covered_raw=/tmp/covered_raw +covered=/tmp/covered + +sed -n "s/^.*fprintf oc \" \(.*\) .*/\1/p" ../../mppa_k1c/TargetPrinter.ml > $to_cover_raw +sed -n "s/^.*fprintf oc \" \(.*\)\\n.*/\1/p" ../../mppa_k1c/TargetPrinter.ml >> $to_cover_raw +python2.7 coverage_helper.py $to_cover_raw > $to_cover + +rm -f $covered_raw +for asm in $(ls $asmdir/*.s); do + bash asm_coverage/asm-coverage.sh $asm >> $covered_raw +done +python2.7 coverage_helper.py $covered_raw > $covered + +vimdiff $to_cover $covered diff --git a/test/mppa/coverage_helper.py b/test/mppa/coverage_helper.py new file mode 100644 index 00000000..f886264c --- /dev/null +++ b/test/mppa/coverage_helper.py @@ -0,0 +1,35 @@ +import fileinput + +occurs = {} + +for line in fileinput.input(): + line_noc = line.replace('\n', '') + if line_noc not in occurs: + occurs[line_noc] = 0 + occurs[line_noc] += 1 + +# HACK: Removing all the instructions with "%a", replacing them with all their variations +# Also removing all instructions starting with '.' +pruned_occurs = dict(occurs) +for inst in occurs: + if inst[0] == '.': + del pruned_occurs[inst] + if "%a" not in inst: + continue + inst_no_a = inst.replace(".%a", "") + if inst_no_a in ("compw", "compd"): + del pruned_occurs[inst] + for mod in ("ne", "eq", "lt", "gt", "le", "ge", "ltu", "leu", "geu", + "gtu", "all", "any", "nall", "none"): + pruned_occurs[inst_no_a + "." + mod] = 1 + elif inst_no_a in ("cb"): + del pruned_occurs[inst] + for mod in ("wnez", "weqz", "wltz", "wgez", "wlez", "wgtz", "dnez", + "dltz", "dgez", "dlez", "dgtz"): + pruned_occurs[inst_no_a + "." + mod] = 1 + else: + assert False, "Found instruction with %a: " + inst +occurs = pruned_occurs + +for inst in sorted(occurs): + print inst |