Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: re-enable napi uv test #27787

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/napi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ thiserror.workspace = true
windows-sys.workspace = true

[dev-dependencies]
libuv-sys-lite = "=1.48.2"
libuv-sys-lite = { version = "=1.48.3", features = ["dyn-symbols"] }
2 changes: 1 addition & 1 deletion tests/napi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository.workspace = true
crate-type = ["cdylib"]

[dependencies]
libuv-sys-lite = "=1.48.2"
libuv-sys-lite = "=1.48.3"
napi-sys = { version = "=2.2.2", default-features = false, features = ["napi7"] }

[dev-dependencies]
Expand Down
16 changes: 7 additions & 9 deletions tests/napi/src/uv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ unsafe extern "C" fn callback(handle: *mut uv_async_t) {
&mut result,
));
uv_mutex_unlock((*async_).mutex);
if value == 5 {
if value == 1 {
uv_close(handle.cast(), Some(close_cb));
}
}
Expand Down Expand Up @@ -166,7 +166,6 @@ extern "C" fn test_uv_async(
let uv_async = uv_async.cast::<uv_async_t>();
let mut js_cb = null_mut();
assert_napi_ok!(napi_create_reference(env, args[0], 1, &mut js_cb));
// let mut tsfn = null_mut();

let data = new_raw(Async {
env,
Expand All @@ -181,14 +180,13 @@ extern "C" fn test_uv_async(
let uv_async = UvAsyncPtr(uv_async);
std::thread::spawn({
move || {
std::thread::sleep(Duration::from_millis(50));
let data = (*uv_async.0).data as *mut Async;
for _ in 0..5 {
uv_mutex_lock((*data).mutex);
(*data).value += 1;
uv_mutex_unlock((*data).mutex);
std::thread::sleep(Duration::from_millis(10));
uv_async_send(uv_async);
}
uv_mutex_lock((*data).mutex);
(*data).value += 1;
uv_mutex_unlock((*data).mutex);
std::thread::sleep(Duration::from_millis(10));
uv_async_send(uv_async);
}
});
}
Expand Down
3 changes: 1 addition & 2 deletions tests/napi/uv_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ const uv = loadTestLibrary();

Deno.test({
name: "napi uv async",
ignore: true,
fn: async () => {
let called = false;
await new Promise((resolve) => {
uv.test_uv_async((value) => {
called = true;
if (value === 5) {
if (value === 1) {
resolve();
}
});
Expand Down
Loading