Skip to content

Commit

Permalink
submodule setup for smir_pretty, simple make target for parse tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jberthold committed Aug 27, 2024
1 parent 33a7193 commit 02ec008
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "deps/smir_pretty"]
path = deps/smir_pretty
url = https://github.com/runtimeverification/smir_pretty
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,34 @@ kmir:

build: kmir
$(POETRY) run kdist -v build mir-semantics.\* -j4

##################################################
# for integration tests: build smir_pretty in-tree

##################################################
# this will change/go away as soon as we have a submodule setup in smir_pretty
smir-pretty-setup: deps/smir_pretty/deps/rust

deps/smir_pretty/deps/rust:
cd deps/smir_pretty && make setup
##################################################

smir-pretty: smir-pretty-setup deps/smir_pretty/target/debug/smir_pretty

deps/smir_pretty/target/debug/smir_pretty: deps/smir_pretty
cd deps/smir_pretty && make build_all

# generate smir and parse given test files (from parameter or run-rs subdirectory)
smir-parse-tests: TESTS = $(shell find kmir/src/tests/integration/data/run-rs -type f -name "*.rs")
smir-parse-tests: SMIR = deps/smir_pretty/run.sh
smir-parse-tests: build smir-pretty
for source in ${TESTS}; do \
echo -n "$$source: "; \
dir=$$(dirname $${source}); \
target=$${dir}/$$(basename $${source%.rs}).smir.json; \
${SMIR} -Z no-codegen --out-dir $${dir} $$source \
&& (echo -n "smir-ed "; \
${POETRY_RUN} convert-from-definition $${target} Pgm > /dev/null \
&& (echo "and parsed!"; rm $${target}) || echo "PARSE ERROR!") \
|| echo "SMIR ERROR!" ; \
done
1 change: 1 addition & 0 deletions deps/smir_pretty
Submodule smir_pretty added at dcc656

0 comments on commit 02ec008

Please sign in to comment.