Skip to content

Commit

Permalink
Merge #1671 #1698
Browse files Browse the repository at this point in the history
1671: test: disconnect check by all part r=u2,keroro520,quake a=driftluo

Disconnect check by all part

1698: fix: WebAssembly build for core packages r=driftluo,zhangsoledad,u2 a=xxuejie



Co-authored-by: driftluo <[email protected]>
Co-authored-by: Xuejie Xiao <[email protected]>
  • Loading branch information
3 people authored Oct 10, 2019
3 parents 8c62561 + 1498d48 + 565ba0c commit b862879
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ 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
- flex
- bison
- texinfo
- libtool
- clang-8
- libc6-dev-i386

before_script:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then ulimit -n 8192; fi
Expand Down Expand Up @@ -86,6 +91,14 @@ matrix:
rust: nightly
script: make security-audit

- 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:
- export PATH=/usr/lib/llvm-8/bin:$PATH
- 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+/))'
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion test/src/specs/sync/ibd_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions util/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
18 changes: 18 additions & 0 deletions wasm-build-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "ckb-wasm-test"
version = "0.23.0-pre"
license = "MIT"
authors = ["Nervos Core Dev <[email protected]>"]
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 = ["."]
4 changes: 4 additions & 0 deletions wasm-build-test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit b862879

Please sign in to comment.