diff --git a/Makefile b/Makefile index 59abedf..eb361c2 100644 --- a/Makefile +++ b/Makefile @@ -105,8 +105,6 @@ TESTDIR=$(CURDIR)/tests/integration/programs .PHONY: integration-test integration-test: TESTS ?= $(shell find $(TESTDIR) -type f -name "*.rs") integration-test: SMIR ?= $(CURDIR)/run.sh -Z no-codegen -# before comparison we want to clean the files up -integration-test: PRE_FILTER ?= jq -e -f $(TESTDIR)/../pre-filter.jq # override this to tweak how expectations are formatted integration-test: NORMALIZE ?= jq -S -e -f $(TESTDIR)/../normalise-filter.jq # override this to re-make golden files @@ -117,15 +115,13 @@ integration-test: build for rust in ${TESTS}; do \ target=$${rust%.rs}.smir.json; \ dir=$$(dirname $${rust}); \ - ${PRE_FILTER} $${target}.expected > temp.json; \ echo "$$rust"; \ ${SMIR} --out-dir $${dir} $${rust} || report "$$rust" "Conversion failed"; \ [ -f $${target} ] \ - && ${PRE_FILTER} $${target} | ${NORMALIZE} ${DIFF} temp.json \ + && ${NORMALIZE} $${target} ${DIFF} $${target}.expected \ && rm $${target} \ || report "$$rust" "Unexpected json output"; \ done; \ - rm -rf temp.json; [ -z "$$errors" ] || (echo "===============\nFAILING TESTS:$$errors"; exit 1) diff --git a/tests/integration/normalise-filter.jq b/tests/integration/normalise-filter.jq index 23c7e97..5b63a49 100644 --- a/tests/integration/normalise-filter.jq +++ b/tests/integration/normalise-filter.jq @@ -1,3 +1,8 @@ +# Remove the hashes at the end of mangled names +.functions = ( [ .functions[] | if .[1].NormalSym then .[1].NormalSym = .[1].NormalSym[:-17] else . end ] ) + | .items = ( [ .items[] | if .symbol_name then .symbol_name = .symbol_name[:-17] else . end ] ) + | +# Apply the normalisation filter { allocs: ( [ .allocs[] ] # sort allocs by their ID diff --git a/tests/integration/pre-filter.jq b/tests/integration/pre-filter.jq deleted file mode 100644 index c68d20d..0000000 --- a/tests/integration/pre-filter.jq +++ /dev/null @@ -1,2 +0,0 @@ -.functions = ( [ .functions[] | if .[1].NormalSym then .[1].NormalSym = .[1].NormalSym[:-17] else . end ] ) - | .items = ( [ .items[] | if .symbol_name then .symbol_name = .symbol_name[:-17] else . end ] ) \ No newline at end of file