From 205b77619e4f69a5054314d07a270555c1faad33 Mon Sep 17 00:00:00 2001 From: Maria Kotsifakou Date: Wed, 11 Sep 2024 17:19:50 -0500 Subject: [PATCH] Made 3rd argument of krun-sol optional and not a file. --- Makefile | 14 ++++++++++---- bin/kparse-bool | 2 +- bin/krun-sol | 9 +++++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 58f8321..2e99941 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ REGRESSION_TESTS = $(patsubst %.sol, %.out, $(wildcard $(TEST_DIR)/regression/*. TRANSACTIONS = $(shell find $(TRANSACTIONS_DIR) -name "*.txn") EXAMPLE_TESTS = $(patsubst %.txn, %.out, $(TRANSACTIONS)) +EXAMPLE_TESTS_CSE = $(patsubst %.txn, %.out, $(wildcard $(TRANSACTIONS_DIR)/swaps/UniswapV2SwapRenamed/*.txn)) +EXAMPLE_TESTS_NOCSE = $(filter-out $(EXAMPLE_TESTS_CSE), $(EXAMPLE_TESTS)) build: $(SEMANTICS_DIR)/$(SEMANTICS_FILE) kompile $(SEMANTICS_DIR)/$(SEMANTICS_FILE) --main-module $(MAIN_MODULE) --gen-glr-bison-parser -O2 @@ -75,13 +77,17 @@ test-aave: test-regression: ${REGRESSION_TESTS} -$(REGRESSION_TESTS): %.out: %.sol %.txn %.ref %.smr $(SEMANTICS_FILE_NAME)-kompiled/timestamp - ulimit -s 65536 && bin/krun-sol $*.sol $*.txn $*.smr > $*.out 2>&1 +$(REGRESSION_TESTS): %.out: %.sol %.txn %.ref $(SEMANTICS_FILE_NAME)-kompiled/timestamp + ulimit -s 65536 && bin/krun-sol $*.sol $*.txn > $*.out 2>&1 diff -U3 -w $*.ref $*.out test-examples: ${EXAMPLE_TESTS} .SECONDEXPANSION: -$(EXAMPLE_TESTS): %.out: $$(subst $(TRANSACTIONS_DIR), $(EXAMPLES_DIR), $$(@D)).sol %.txn %.ref %.smr $(SEMANTICS_FILE_NAME)-kompiled/timestamp - ulimit -s 65536 && bin/krun-sol $< $*.txn $*.smr > $*.out 2>&1 +$(EXAMPLE_TESTS_NOCSE): %.out: $$(subst $(TRANSACTIONS_DIR), $(EXAMPLES_DIR), $$(@D)).sol %.txn %.ref $(SEMANTICS_FILE_NAME)-kompiled/timestamp + ulimit -s 65536 && bin/krun-sol $< $*.txn > $*.out 2>&1 + diff -U3 -w $*.ref $*.out + +$(EXAMPLE_TESTS_CSE): %.out: $$(subst $(TRANSACTIONS_DIR), $(EXAMPLES_DIR), $$(@D)).sol %.txn %.ref $(SEMANTICS_FILE_NAME)-kompiled/timestamp + ulimit -s 65536 && bin/krun-sol $< $*.txn true > $*.out 2>&1 diff -U3 -w $*.ref $*.out diff --git a/bin/kparse-bool b/bin/kparse-bool index 0a0f9b3..7062a9f 100755 --- a/bin/kparse-bool +++ b/bin/kparse-bool @@ -1,2 +1,2 @@ #!/bin/bash -kparse -d "$(dirname "$0")/../solidity-kompiled" -s Bool -m SOLIDITY-DATA-SYNTAX "$(cat "$1")" +kparse -d "$(dirname "$0")/../solidity-kompiled" -s Bool -m SOLIDITY-DATA-SYNTAX "$1" diff --git a/bin/krun-sol b/bin/krun-sol index d8bb832..0c3ea66 100755 --- a/bin/krun-sol +++ b/bin/krun-sol @@ -1,6 +1,11 @@ #!/bin/bash contract="$1" txn="$2" -isuniswap="$3" -shift; shift; shift +if [ "$#" -lt 3 ]; then + isuniswap=false +else + isuniswap="$3" + shift +fi +shift; shift krun -d "$(dirname "$0")/../solidity-kompiled" "$contract" -cTXN="$txn" -pTXN="$(dirname "$0")/kparse-txn" -cISUNISWAP="$isuniswap" -pISUNISWAP="$(dirname "$0")/kparse-bool" --no-expand-macros "$@"