[wip] more flexibility

This commit is contained in:
Michael Bradley, Jr 2022-09-05 15:45:25 -05:00 committed by Dmitriy Ryajov
parent 9d5e9cf0e1
commit 93270e0649
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
2 changed files with 12 additions and 6 deletions

View File

@ -132,15 +132,22 @@ coverage:
genhtml coverage/coverage.f.info --output-directory coverage/report
if which open >/dev/null; then (echo -e "\e[92mOpening\e[39m HTML coverage report in browser..." && open coverage/report/index.html) || true; fi
SCRATCH_IGNORE ?= "\.update\.timestamp\|Would skip\|build/\|codex\.nims\|nimcache/\|scratch/\|vendor/\.nimble"
TESTGROUND_BUILDER ?= docker:generic
TESTGROUND_OPTIONS ?= --instances=2
TESTGROUND_PLAN ?= hello_codex
TESTGROUND_RUNNER ?= local:docker
TESTGROUND_TESTCASE ?= hello
testground:
mkdir -p scratch && rm -rf scratch/* && git clone --depth=1 "file://$${PWD}" "scratch/$$(basename $${PWD})"
git diff --merge-base HEAD > "scratch/$$(basename $${PWD})/scratch.patch"
cd "scratch/$$(basename $${PWD})" && git apply scratch.patch
rm "scratch/$$(basename $${PWD})/scratch.patch"
git clean -ndfx | grep -v $(SCRATCH_IGNORE) | awk '{ print $$3 }' | xargs -I{} bash -c "test -d '{}' && echo '{}' || true" | xargs -I{} mkdir -p scratch/nim-codex/{}
git clean -ndfx | grep -v $(SCRATCH_IGNORE) | awk '{ print $$3 }' | xargs -I{} cp -R {} scratch/nim-codex/{}
testground plan import --from=testground/$(TESTGROUND_PLAN)
testground run single --builder=$(TESTGROUND_BUILDER) --runner=$(TESTGROUND_RUNNER) --plan=$(TESTGROUND_PLAN) --testcase=$(TESTGROUND_TESTCASE) --instances=2
testground run single --builder=$(TESTGROUND_BUILDER) --runner=$(TESTGROUND_RUNNER) --plan=$(TESTGROUND_PLAN) --testcase=$(TESTGROUND_TESTCASE) $(TESTGROUND_OPTIONS)
testground_exec: | build deps
TESTGROUND_PLAN=$(TESTGROUND_PLAN) $(ENV_SCRIPT) nim testground_exec codex.nims

View File

@ -40,8 +40,7 @@ when declared(namedBin):
### Helper functions
proc buildBinary(name: string, outName = "", srcDir = "./", params = "", lang = "c") =
if not dirExists "build":
mkDir "build"
if not dirExists "build": mkDir "build"
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
var extra_params = params
when compiles(commandLineParams):
@ -60,9 +59,6 @@ proc test(name: string, srcDir = "tests/", lang = "c") =
task codex, "build codex binary":
buildBinary "codex", params = "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE"
task testground_exec, "build codex_testground binary":
buildBinary "main", outName = "codex_testground", srcDir = "testground/" & getEnv("TESTGROUND_PLAN").strip & "/"
task testCodex, "Build & run Codex tests":
test "testCodex"
@ -80,3 +76,6 @@ task testAll, "Run all tests":
testCodexTask()
testContractsTask()
testIntegrationTask()
task testground_exec, "build codex_testground binary":
buildBinary "main", outName = "codex_testground", srcDir = "testground/" & getEnv("TESTGROUND_PLAN").strip & "/"