From 4d5e55595b06e44c765db264e12652968afd1d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Fri, 2 Feb 2018 17:22:51 +0100 Subject: [PATCH] Test: split `test/shell` into `src/lib_{storage,shell}` --- src/lib_shell/test/jbuild | 32 +++++++++++++++++++ .../lib_shell/test}/test_state.ml | 0 src/lib_shell/tezos-shell.opam | 1 + {test/shell => src/lib_storage/test}/jbuild | 14 +------- .../lib_storage/test}/test_context.ml | 10 ++---- .../lib_storage/test}/test_store.ml | 6 ---- 6 files changed, 36 insertions(+), 27 deletions(-) create mode 100644 src/lib_shell/test/jbuild rename {test/shell => src/lib_shell/test}/test_state.ml (100%) rename {test/shell => src/lib_storage/test}/jbuild (67%) rename {test/shell => src/lib_storage/test}/test_context.ml (97%) rename {test/shell => src/lib_storage/test}/test_store.ml (99%) diff --git a/src/lib_shell/test/jbuild b/src/lib_shell/test/jbuild new file mode 100644 index 000000000..3faed0450 --- /dev/null +++ b/src/lib_shell/test/jbuild @@ -0,0 +1,32 @@ +(jbuild_version 1) + +(executables + ((names (test_state)) + (libraries (tezos-base + tezos-storage + tezos-shell + tezos-embedded-protocol-demo + tezos-test-helpers)) + (flags (:standard -w -9-32 + -safe-string + -open Tezos_base__TzPervasives + -open Tezos_test_helpers + -open Tezos_storage + -open Tezos_shell)))) + +(alias + ((name buildtest) + (deps (test_state.exe)))) + +(alias + ((name runtest_state) + (action (run ${exe:test_state.exe})))) + +(alias + ((name runtest) + (deps ((alias runtest_state))))) + +(alias + ((name runtest_indent) + (deps ((glob_files *.ml) (glob_files *.mli))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/test/shell/test_state.ml b/src/lib_shell/test/test_state.ml similarity index 100% rename from test/shell/test_state.ml rename to src/lib_shell/test/test_state.ml diff --git a/src/lib_shell/tezos-shell.opam b/src/lib_shell/tezos-shell.opam index 4ef166cfa..0f69a3be8 100644 --- a/src/lib_shell/tezos-shell.opam +++ b/src/lib_shell/tezos-shell.opam @@ -14,6 +14,7 @@ depends: [ "tezos-p2p" "tezos-shell-services" "tezos-protocol-updater" + "tezos-embedded-protocol-demo" { test } ] build: [ [ "jbuilder" "build" "-p" name "-j" jobs ] diff --git a/test/shell/jbuild b/src/lib_storage/test/jbuild similarity index 67% rename from test/shell/jbuild rename to src/lib_storage/test/jbuild index 937ad6db6..f824ed9f1 100644 --- a/test/shell/jbuild +++ b/src/lib_storage/test/jbuild @@ -2,36 +2,25 @@ (executables ((names (test_context - test_state test_store)) (libraries (tezos-base tezos-storage - tezos-shell - tezos-embedded-protocol-demo - tezos-embedded-protocol-alpha - tezos-embedded-protocol-genesis tezos-test-helpers)) (flags (:standard -w -9-32 -safe-string -open Tezos_base__TzPervasives -open Tezos_test_helpers - -open Tezos_storage - -open Tezos_shell)))) + -open Tezos_storage)))) (alias ((name buildtest) (deps (test_context.exe - test_state.exe test_store.exe)))) (alias ((name runtest_context) (action (run ${exe:test_context.exe})))) -(alias - ((name runtest_state) - (action (run ${exe:test_state.exe})))) - (alias ((name runtest_store) (action (run ${exe:test_store.exe})))) @@ -39,7 +28,6 @@ (alias ((name runtest) (deps ((alias runtest_context) - (alias runtest_state) (alias runtest_store))))) (alias diff --git a/test/shell/test_context.ml b/src/lib_storage/test/test_context.ml similarity index 97% rename from test/shell/test_context.ml rename to src/lib_storage/test/test_context.ml index c9a54760a..5cd1bc2ac 100644 --- a/test/shell/test_context.ml +++ b/src/lib_storage/test/test_context.ml @@ -26,12 +26,6 @@ let genesis_protocol = let genesis_time = Time.of_seconds 0L -let genesis : State.Net.genesis = { - time = genesis_time ; - block = genesis_block ; - protocol = genesis_protocol ; -} - let net_id = Net_id.of_block_hash genesis_block (** Context creation *) @@ -95,8 +89,8 @@ let wrap_context_init f base_dir = Context.init ~root ?patch_context:None >>= fun idx -> Context.commit_genesis idx ~net_id - ~time:genesis.time - ~protocol:genesis.protocol >>= fun genesis -> + ~time:genesis_time + ~protocol:genesis_protocol >>= fun genesis -> create_block2 idx genesis >>= fun block2 -> create_block3a idx block2 >>= fun block3a -> create_block3b idx block2 >>= fun block3b -> diff --git a/test/shell/test_store.ml b/src/lib_storage/test/test_store.ml similarity index 99% rename from test/shell/test_store.ml rename to src/lib_storage/test/test_store.ml index 66c36fc65..3f8ab706c 100644 --- a/test/shell/test_store.ml +++ b/src/lib_storage/test/test_store.ml @@ -26,12 +26,6 @@ let genesis_protocol = let genesis_time = Time.of_seconds 0L -let genesis = { - State.Net.time = genesis_time ; - block = genesis_block ; - protocol = genesis_protocol ; -} - (** *) let wrap_store_init f base_dir =