From 1498d48b9aec6d5f43a781f00de9bbdb8f64de3f Mon Sep 17 00:00:00 2001 From: driftluo Date: Tue, 8 Oct 2019 21:56:49 +0800 Subject: [PATCH 1/5] test: disconncet check by all part --- test/src/specs/sync/ibd_process.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/src/specs/sync/ibd_process.rs b/test/src/specs/sync/ibd_process.rs index ee2b02c7c59..a5176c9dca7 100644 --- a/test/src/specs/sync/ibd_process.rs +++ b/test/src/specs/sync/ibd_process.rs @@ -139,6 +139,17 @@ impl Spec for IBDProcessWithWhiteList { } node6.disconnect(node0); + + // Make sure both sides are disconnected + let is_disconnect_already = wait_until(10, || { + let peers = rpc_client0.get_peers(); + peers.iter().any(|peer| peer.node_id == node6.node_id()) + }); + + if is_disconnect_already { + panic!("node6 can't disconnect with node0"); + } + node6.generate_blocks(2); let generate_res = wait_until(10, || net.nodes[6].get_tip_block_number() == 2); @@ -147,7 +158,8 @@ impl Spec for IBDProcessWithWhiteList { panic!("node6 can't generate blocks to 2"); } - node0.connect_uncheck(node6); + // Make sure node0 re-connect with node6 + node0.connect(node6); // IBD only with outbound/whitelist node let rpc_client1 = node1.rpc_client(); From 61f898d489be5d07a20ada84103aa4b31f228c8e Mon Sep 17 00:00:00 2001 From: Xuejie Xiao Date: Thu, 10 Oct 2019 04:59:37 +0000 Subject: [PATCH 2/5] fix: WebAssembly build for core packages --- .travis.yml | 7 +++++++ Makefile | 4 ++++ util/types/Cargo.toml | 2 ++ wasm-build-test/Cargo.toml | 18 ++++++++++++++++++ wasm-build-test/src/lib.rs | 0 5 files changed, 31 insertions(+) create mode 100644 wasm-build-test/Cargo.toml create mode 100644 wasm-build-test/src/lib.rs diff --git a/.travis.yml b/.travis.yml index f15ed451d92..e993a135f9a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,6 +81,13 @@ matrix: - make check-whitespaces - make check-dirty-rpc-doc + - name: WASM build + if: 'tag IS NOT present AND (type = pull_request OR branch in (master, staging, trying) OR repo != nervosnetwork/ckb)' + os: linux + script: + - rustup target add wasm32-unknown-unknown + - make wasm-build-test + - name: Test benchmarks on Linux env: CACHE_NAME=bench if: 'tag IS NOT present AND type != pull_request AND (branch IN (master, staging, trying) OR branch =~ /^rc\// OR (branch = develop AND commit_message !~ /^Merge #\d+/))' diff --git a/Makefile b/Makefile index f58ec2f5b82..d515e3c2700 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,10 @@ test: ## Run all tests. cov: ## Run code coverage. RUSTC="$$(pwd)/devtools/cov/rustc-proptest-fix" taskset -c 0 cargo tarpaulin --timeout 300 --exclude-files "*/generated/" "test/*" "*/tests/" --all -v --out Xml +.PHONY: wasm-build-test +wasm-build-test: ## Build core packages for wasm target + cd wasm-build-test && cargo build --target=wasm32-unknown-unknown + .PHONY: setup-ckb-test setup-ckb-test: cp -f Cargo.lock test/Cargo.lock diff --git a/util/types/Cargo.toml b/util/types/Cargo.toml index 4754e460f46..11a57a4b2b8 100644 --- a/util/types/Cargo.toml +++ b/util/types/Cargo.toml @@ -18,4 +18,6 @@ bit-vec = "0.5.1" failure = "0.1.5" ckb-error = { path = "../../error" } ckb-rational = { path = "../rational" } + +[dev-dependencies] proptest = "0.9" diff --git a/wasm-build-test/Cargo.toml b/wasm-build-test/Cargo.toml new file mode 100644 index 00000000000..65fc3c3eccf --- /dev/null +++ b/wasm-build-test/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "ckb-wasm-test" +version = "0.23.0-pre" +license = "MIT" +authors = ["Nervos Core Dev "] +edition = "2018" + +[dependencies] +ckb-types = { path = "../util/types" } + +[dependencies.ckb-script] +path = "../script" +default-features = false +features = [] + +# Prevent this from interfering with workspaces +[workspace] +members = ["."] diff --git a/wasm-build-test/src/lib.rs b/wasm-build-test/src/lib.rs new file mode 100644 index 00000000000..e69de29bb2d From c124a1342137a2a948737ffa1338e2a2f2f43d73 Mon Sep 17 00:00:00 2001 From: Xuejie Xiao Date: Thu, 10 Oct 2019 06:07:46 +0000 Subject: [PATCH 3/5] fix: Install clang 8 for WASM build --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index e993a135f9a..deeac82c254 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,9 @@ env: addons: apt: + sources: + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" packages: - libssl-dev - autoconf @@ -25,6 +28,7 @@ addons: - bison - texinfo - libtool + - clang-8 before_script: - if [ "$TRAVIS_OS_NAME" = "osx" ]; then ulimit -n 8192; fi @@ -85,6 +89,7 @@ matrix: if: 'tag IS NOT present AND (type = pull_request OR branch in (master, staging, trying) OR repo != nervosnetwork/ckb)' os: linux script: + - export PATH=/usr/lib/llvm-8/bin:$PATH - rustup target add wasm32-unknown-unknown - make wasm-build-test From e46fd30a0eff4e6f02bc2810435b454f495896fa Mon Sep 17 00:00:00 2001 From: Xuejie Xiao Date: Thu, 10 Oct 2019 06:13:22 +0000 Subject: [PATCH 4/5] fix: Add missing i386 libc package --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index deeac82c254..f2516384c2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,7 @@ addons: - texinfo - libtool - clang-8 + - libc6-dev-i386 before_script: - if [ "$TRAVIS_OS_NAME" = "osx" ]; then ulimit -n 8192; fi From 565ba0c515fcf7ef40b9d936049490b5de131c96 Mon Sep 17 00:00:00 2001 From: Xuejie Xiao Date: Thu, 10 Oct 2019 06:48:42 +0000 Subject: [PATCH 5/5] fix: cargo check --- wasm-build-test/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wasm-build-test/src/lib.rs b/wasm-build-test/src/lib.rs index e69de29bb2d..b30dde965ca 100644 --- a/wasm-build-test/src/lib.rs +++ b/wasm-build-test/src/lib.rs @@ -0,0 +1,4 @@ +// We just need a dummy package to test building dependencies, those +// lines here prevent errors from devtools/ci/check-cargotoml.sh +extern crate ckb_script; +extern crate ckb_types;