Skip to content

Commit

Permalink
Replace parking_lot with std::sync, and improve CI (#2733)
Browse files Browse the repository at this point in the history
Fix #2732
  • Loading branch information
tomaka authored Sep 12, 2022
1 parent cd8e7fb commit 2e756d4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,22 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v1
- run: RUSTFLAGS=-Dwarnings cargo check --package smoldot --locked --no-default-features
- run: RUSTFLAGS=-Dwarnings cargo check --package smoldot --locked --no-default-features --features database-sqlite
- run: RUSTFLAGS=-Dwarnings cargo check --package smoldot --locked --no-default-features --features std
- run: RUSTFLAGS=-Dwarnings cargo check --package smoldot --locked --no-default-features --features database-sqlite --features std
- run: RUSTFLAGS=-Dwarnings cargo check --package smoldot-light --locked --no-default-features
- run: RUSTFLAGS=-Dwarnings cargo check --package smoldot-light --locked --no-default-features --features std
- run: apt-get update && apt install -y libc6-dev-i386
- run: rustup target add i686-unknown-linux-gnu
# We test for both x86_64 and i686 because there is some `cfg(target_arch = "x86_64")`
# conditional compilation within the source code.
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot --locked --no-default-features
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot --locked --no-default-features
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot --locked --no-default-features --features std
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot --locked --no-default-features --features std
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite --features std
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite --features std
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot-light --locked --no-default-features
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot-light --locked --no-default-features
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot-light --locked --no-default-features --features std
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot-light --locked --no-default-features --features std

fuzzing-binaries-compile:
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ database-sqlite = [
std = [
"async-std",
"futures/thread-pool",
"parking_lot",
"pin-project",
"schnorrkel/getrandom", # TODO: necessary for signing; clarify in docs and in source code
"soketto",
Expand Down
5 changes: 3 additions & 2 deletions src/executor/vm/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ use core::{
fmt, mem, slice,
task::{Context, Poll, Waker},
};
use parking_lot::Mutex;
// TODO: we use std::sync::Mutex rather than parking_lot::Mutex due to issues with Cargo features, see <https://github.com/paritytech/smoldot/issues/2732>
use std::sync::Mutex;

use futures::{
future::{self, Future},
Expand Down Expand Up @@ -250,7 +251,7 @@ impl JitPrototype {
.map_err(|err| NewErr::ModuleError(ModuleError(err.to_string())))?;

// Now that we are passed the `start` stage, update the state of execution.
*shared.lock() = Shared::Poisoned;
*shared.lock().unwrap() = Shared::Poisoned;

let exported_memory = if let Some(mem) = instance.get_export(&mut store, "memory") {
if let Some(mem) = mem.into_memory() {
Expand Down

0 comments on commit 2e756d4

Please sign in to comment.