From 02ec0088cddd0c6a2d9716337f44c6947ec85ab5 Mon Sep 17 00:00:00 2001 From: Jost Berthold Date: Tue, 27 Aug 2024 17:59:50 +1000 Subject: [PATCH] submodule setup for smir_pretty, simple make target for parse tests --- .gitmodules | 3 +++ Makefile | 31 +++++++++++++++++++++++++++++++ deps/smir_pretty | 1 + 3 files changed, 35 insertions(+) create mode 100644 .gitmodules create mode 160000 deps/smir_pretty diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..4a7941504 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "deps/smir_pretty"] + path = deps/smir_pretty + url = https://github.com/runtimeverification/smir_pretty diff --git a/Makefile b/Makefile index ee545380c..6d8640e04 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/deps/smir_pretty b/deps/smir_pretty new file mode 160000 index 000000000..dcc656ac8 --- /dev/null +++ b/deps/smir_pretty @@ -0,0 +1 @@ +Subproject commit dcc656ac8591fbb284773071081745ef8026e0ad