[wip] more flexibility
This commit is contained in:
parent
28781608a5
commit
0fc197d992
9
Makefile
9
Makefile
|
@ -125,15 +125,22 @@ coverage:
|
||||||
genhtml coverage/coverage.f.info --output-directory coverage/report
|
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
|
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_BUILDER ?= docker:generic
|
||||||
|
TESTGROUND_OPTIONS ?= --instances=2
|
||||||
TESTGROUND_PLAN ?= hello_codex
|
TESTGROUND_PLAN ?= hello_codex
|
||||||
TESTGROUND_RUNNER ?= local:docker
|
TESTGROUND_RUNNER ?= local:docker
|
||||||
TESTGROUND_TESTCASE ?= hello
|
TESTGROUND_TESTCASE ?= hello
|
||||||
|
|
||||||
testground:
|
testground:
|
||||||
mkdir -p scratch && rm -rf scratch/* && git clone --depth=1 "file://$${PWD}" "scratch/$$(basename $${PWD})"
|
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 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_exec: | build deps
|
||||||
TESTGROUND_PLAN=$(TESTGROUND_PLAN) $(ENV_SCRIPT) nim testground_exec codex.nims
|
TESTGROUND_PLAN=$(TESTGROUND_PLAN) $(ENV_SCRIPT) nim testground_exec codex.nims
|
||||||
|
|
|
@ -40,8 +40,7 @@ when declared(namedBin):
|
||||||
|
|
||||||
### Helper functions
|
### Helper functions
|
||||||
proc buildBinary(name: string, outName = "", srcDir = "./", params = "", lang = "c") =
|
proc buildBinary(name: string, outName = "", srcDir = "./", params = "", lang = "c") =
|
||||||
if not dirExists "build":
|
if not dirExists "build": mkDir "build"
|
||||||
mkDir "build"
|
|
||||||
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
|
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
|
||||||
var extra_params = params
|
var extra_params = params
|
||||||
when compiles(commandLineParams):
|
when compiles(commandLineParams):
|
||||||
|
@ -60,9 +59,6 @@ proc test(name: string, srcDir = "tests/", lang = "c") =
|
||||||
task codex, "build codex binary":
|
task codex, "build codex binary":
|
||||||
buildBinary "codex", params = "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE"
|
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":
|
task testCodex, "Build & run Codex tests":
|
||||||
test "testCodex"
|
test "testCodex"
|
||||||
|
|
||||||
|
@ -80,3 +76,6 @@ task testAll, "Run all tests":
|
||||||
testCodexTask()
|
testCodexTask()
|
||||||
testContractsTask()
|
testContractsTask()
|
||||||
testIntegrationTask()
|
testIntegrationTask()
|
||||||
|
|
||||||
|
task testground_exec, "build codex_testground binary":
|
||||||
|
buildBinary "main", outName = "codex_testground", srcDir = "testground/" & getEnv("TESTGROUND_PLAN").strip & "/"
|
||||||
|
|
Loading…
Reference in New Issue