Skip to content

Commit

Permalink
fix: update failing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Lohachov Mykhailo <[email protected]>
  • Loading branch information
aoyako committed Nov 11, 2024
1 parent fc8f661 commit 77b8d44
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 29 deletions.
1 change: 0 additions & 1 deletion .github/workflows/iroha2-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ env:
WASM_TARGET_DIR: wasm/target/prebuilt
TEST_NETWORK_TMP_DIR: /tmp
NEXTEST_PROFILE: ci
PROFILE: profiling

jobs:
consistency:
Expand Down
9 changes: 9 additions & 0 deletions crates/iroha/tests/extra_functional/connected_peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ async fn connected_peers_with_f(faults: usize) -> Result<()> {
.await?;
assert_peers_status(randomized_peers.iter().copied(), 2, n_peers as u64 - 2).await;

timeout(network.sync_timeout(),
async {
loop{
let status = removed_peer.status().await?;
if status.peers == 0 { break; }
}
Ok::<(), eyre::Report>(())
}).await??;

let status = removed_peer.status().await?;
// Peer might have been disconnected before getting the block
assert_matches!(status.blocks, 1 | 2);
Expand Down
2 changes: 1 addition & 1 deletion crates/iroha_wasm_builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ mod internal {

fn build_options(&self) -> impl Iterator<Item = &'static str> {
[
if self.release { "--release" } else { "" },
"--release",
"-Z",
"build-std",
"-Z",
Expand Down
51 changes: 27 additions & 24 deletions scripts/build_wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ DEFAULTS_DIR="defaults"
CARGO_DIR="wasm"
TARGET_DIR="$CARGO_DIR/target/prebuilt"
PROFILE="deploy"
TARGET="all"
SHOW_HELP=false

main() {
targets=()

# Parse args
for arg in "$@"; do
case $arg in
Expand All @@ -18,12 +19,8 @@ main() {
--help)
SHOW_HELP=true
;;
--target=*)
TARGET="${arg#*=}"
;;
*)
echo "error: unrecognized arg: $arg"
exit 1
targets+=("$arg")
;;
esac
done
Expand All @@ -47,20 +44,25 @@ main() {
fi

# Parse target
case $TARGET in
"libs")
command "libs"
;;
"samples")
command "samples"
;;
"all")
command "libs"
command "samples"
;;
*)
echo "error: unrecognized target: $TARGET. Target can be either [libs, samples, all]"
esac
if [ ${#targets[@]} -eq 0 ]; then
targets=("all")
fi
for target in "${targets[@]}"; do
case $target in
"libs")
command "libs"
;;
"samples")
command "samples"
;;
"all")
command "libs"
command "samples"
;;
*)
echo "error: unrecognized target: $target. Target can be either [libs, samples, all]"
esac
done
}

build() {
Expand Down Expand Up @@ -112,11 +114,12 @@ Usage: $0 [OPTIONS]
Options:
--profile=<value> Specify build profile (default: deploy)
Possible values: profiling, deploy
--target=<value> Specify build target (default: all)
Possible values: samples, libs, all
--help Show help message
Positional Arguments:
samples Build samples
libs Build libraries
all Build all targets
END
}

Expand Down
3 changes: 2 additions & 1 deletion wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ members = [
[profile.dev]
panic = "abort"

[profile.release]
[profile.deploy]
inherits = "release"
strip = "debuginfo" # Remove debugging info from the binary
panic = "abort" # Panics are transcribed to Traps when compiling for wasm anyways
lto = true # Link-time-optimization produces notable decrease in binary size
Expand Down
4 changes: 2 additions & 2 deletions wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ bash scripts/build_wasm.sh
## WASM libraries only

```bash
bash scripts/build_wasm.sh --target=libs
bash scripts/build_wasm.sh libs
```

## WASM samples only

```bash
bash scripts/build_wasm.sh --target=samples
bash scripts/build_wasm.sh samples
```

## WASM in specific profile
Expand Down

0 comments on commit 77b8d44

Please sign in to comment.