From 4275abbefe40b5e03d381951f000e4642bdba3a6 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Thu, 11 Jun 2020 19:41:43 +0300 Subject: [PATCH] Makefile targets for ctail and ntu --- .editorconfig | 14 ++++++++++++++ Makefile | 21 +++++++++++++++------ config.nims | 3 +++ scripts/run_ssz_fuzzing_test.nims | 10 +++------- 4 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..b9f4f84a4f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +root = true + +[*.nim] +indent_style = space +indent_size = 2 + +[*.sh] +indent_style = space +indent_size = 2 + +[Makefile] +ident_size = 2 +ident_style = tab + diff --git a/Makefile b/Makefile index f772ed9dba..e5ffd35cdb 100644 --- a/Makefile +++ b/Makefile @@ -15,23 +15,24 @@ BUILD_SYSTEM_DIR := vendor/nimbus-build-system # unconditionally built by the default Make target TOOLS := \ - validator_client \ beacon_node \ + block_sim \ + deposit_contract \ inspector \ logtrace \ - deposit_contract \ + nbench \ + nbench_spec_scenarios \ + ncli_db \ ncli_hash_tree_root \ ncli_pretty \ ncli_query \ ncli_transition \ - ncli_db \ process_dashboard \ stack_sizes \ state_sim \ - block_sim \ - nbench \ - nbench_spec_scenarios + validator_client \ # bench_bls_sig_agggregation TODO reenable after bls v0.10.1 changes + TOOLS_DIRS := \ beacon_chain \ benchmarks \ @@ -167,6 +168,14 @@ witti: | build deps witti-dev: | build deps NIM_PARAMS="$(subst ",\",$(NIM_PARAMS))" LOG_LEVEL="DEBUG; TRACE:discv5,networking; REQUIRED:none; DISABLED:none" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) shared/witti +ctail: | build deps + mkdir -p vendor/.nimble/bin/ + $(ENV_SCRIPT) nim -d:danger -o:vendor/.nimble/bin/ctail c vendor/nim-chronicles-tail/ctail.nim + +ntu: | build deps + mkdir -p vendor/.nimble/bin/ + $(ENV_SCRIPT) nim -d:danger -o:vendor/.nimble/bin/ntu c vendor/nim-testutils/ntu.nim + clean: | clean-common rm -rf build/{$(TOOLS_CSV),all_tests,*_node,*ssz*,beacon_node_*,block_sim,state_sim,transition*} ifneq ($(USE_LIBBACKTRACE), 0) diff --git a/config.nims b/config.nims index 610ab7b5cc..27496668a9 100644 --- a/config.nims +++ b/config.nims @@ -43,6 +43,9 @@ else: # switch("define", "snappy_implementation=libp2p") +const currentDir = currentSourcePath()[0 .. ^(len("config.nims") + 1)] +switch("define", "nim_compiler_path=" & currentDir & "env.sh nim") + switch("import", "testutils/moduletests") const useLibStackTrace = not defined(macosx) and diff --git a/scripts/run_ssz_fuzzing_test.nims b/scripts/run_ssz_fuzzing_test.nims index 6a37e5b699..26751f31e0 100644 --- a/scripts/run_ssz_fuzzing_test.nims +++ b/scripts/run_ssz_fuzzing_test.nims @@ -1,5 +1,6 @@ import os except dirExists import strformat, confutils +import testutils/fuzzing_engines const gitRoot = thisDir() / ".." @@ -10,13 +11,8 @@ const fuzzNims = gitRoot / "vendor" / "nim-testutils" / "testutils" / "fuzzing" / "fuzz.nims" -type - FuzzerKind = enum - libFuzzer - afl - cli do (testname {.argument.}: string, - fuzzer = libFuzzer): + fuzzer = defaultFuzzingEngine): if not dirExists(fixturesDir): echo "Please run `make test` first in order to download the official ETH2 test vectors" @@ -43,5 +39,5 @@ cli do (testname {.argument.}: string, let testProgram = fuzzingTestsDir / &"ssz_decode_{testname}.nim" - exec &"""nim "{fuzzNims}" "{fuzzer}" "{testProgram}" "{corpusDir}" """ + exec &"""ntu fuzz --fuzzer={fuzzer} --corpus="{corpusDir}" "{testProgram}" """