Skip to content

Commit

Permalink
fix wasm32 run
Browse files Browse the repository at this point in the history
  • Loading branch information
a10y committed Dec 12, 2024
1 parent 8c4a93f commit 4c21b35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
- name: "wasm32 with default features"
command: "build"
target: wasm32-unknown-unknown
args: "--target wasm32-unknown-unknown"
args: "--target wasm32-unknown-unknown --exclude vortex-roaring --exclude vortex-datafusion "
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cleanup
Expand Down
20 changes: 8 additions & 12 deletions vortex-io/src/dispatcher/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,30 +116,26 @@ impl Dispatch for TokioDispatcher {
}
}

#[cfg(all(test, feature = "tokio"))]
#[cfg(test)]
mod tests {
use std::io::Write;

use tempfile::NamedTempFile;
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::Arc;

use super::TokioDispatcher;
use crate::dispatcher::Dispatch;
use crate::{TokioFile, VortexReadAt};

#[tokio::test]
async fn test_tokio_dispatch_simple() {
let dispatcher = TokioDispatcher::new(4);
let mut tmpfile = NamedTempFile::new().unwrap();
write!(tmpfile, "5678").unwrap();

let atomic_number = Arc::new(AtomicU32::new(0));
let atomic_number_clone = Arc::clone(&atomic_number);
let rx = dispatcher
.dispatch(|| async move {
let file = TokioFile::open(tmpfile.path()).unwrap();

file.read_byte_range(0, 4).await.unwrap()
atomic_number_clone.fetch_add(1, Ordering::SeqCst);
})
.unwrap();

assert_eq!(&rx.await.unwrap(), "5678".as_bytes());
rx.await.unwrap();
assert_eq!(atomic_number.load(Ordering::SeqCst), 1u32);
}
}

0 comments on commit 4c21b35

Please sign in to comment.