Skip to content

Commit

Permalink
Combined pre-filter into normalise jq script
Browse files Browse the repository at this point in the history
  • Loading branch information
dkcumming committed Jan 15, 2025
1 parent 8c5bf4e commit 346f67e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)


Expand Down
5 changes: 5 additions & 0 deletions tests/integration/normalise-filter.jq
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/pre-filter.jq

This file was deleted.

0 comments on commit 346f67e

Please sign in to comment.