From d141cb475b356a4c5b24e7b49c9919b1cea865f5 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Tue, 20 Oct 2020 19:59:21 +0000 Subject: [PATCH] test(std/wasi): reduce test duplication This fast-forwards wasi-test-suite a couple of commits removed duplicate, or near duplicate tests with not much additional value. Other tests have been merged to reduce the number of modules to make tests topical to the syscall that is being tested. --- cli/repl.rs | 12 +---- std/wasi/snapshot_preview1_test.ts | 78 ++++++++++-------------------- std/wasi/testdata | 2 +- 3 files changed, 29 insertions(+), 63 deletions(-) diff --git a/cli/repl.rs b/cli/repl.rs index 1cc866a6fd7dff..e6a64e5c29ec10 100644 --- a/cli/repl.rs +++ b/cli/repl.rs @@ -285,7 +285,7 @@ async fn post_message_and_poll( // A zero delay is long enough to yield the thread in order to prevent the loop from // running hot for messages that are taking longer to resolve like for example an // evaluation of top level await. - tokio::time::delay_for(tokio::time::Duration::from_millis(0)).await; + tokio::task::yield_now().await; } } } @@ -310,20 +310,12 @@ async fn read_line_and_poll( .unwrap(); } - // Because an inspector websocket client may choose to connect at anytime when we have an - // inspector server we need to keep polling the worker to pick up new connections. - let mut timeout = - tokio::time::delay_for(tokio::time::Duration::from_millis(100)); - tokio::select! { result = &mut line => { return result.unwrap(); } _ = worker.run_event_loop(), if poll_worker => { - poll_worker = false; - } - _ = &mut timeout => { - poll_worker = true + tokio::task::yield_now(); } } } diff --git a/std/wasi/snapshot_preview1_test.ts b/std/wasi/snapshot_preview1_test.ts index 963509a3fec900..99f9145c72b191 100644 --- a/std/wasi/snapshot_preview1_test.ts +++ b/std/wasi/snapshot_preview1_test.ts @@ -4,77 +4,51 @@ import { copy } from "../fs/mod.ts"; import * as path from "../path/mod.ts"; const tests = [ - "testdata/std_env_args_none.wasm", - "testdata/std_env_args_some.wasm", - "testdata/std_env_vars_none.wasm", - "testdata/std_env_vars_some.wasm", - "testdata/std_fs_create_dir_absolute.wasm", - "testdata/std_fs_create_dir_relative.wasm", - "testdata/std_fs_file_create_absolute.wasm", - "testdata/std_fs_file_create_relative.wasm", - "testdata/std_fs_file_metadata_absolute.wasm", - "testdata/std_fs_file_metadata_relative.wasm", - "testdata/std_fs_file_seek_absolute.wasm", - "testdata/std_fs_file_seek_relative.wasm", - "testdata/std_fs_file_set_len_absolute.wasm", - "testdata/std_fs_file_set_len_relative.wasm", - "testdata/std_fs_file_sync_all_absolute.wasm", - "testdata/std_fs_file_sync_all_relative.wasm", - "testdata/std_fs_file_sync_data_absolute.wasm", - "testdata/std_fs_file_sync_data_relative.wasm", - "testdata/std_fs_hard_link_absolute.wasm", - "testdata/std_fs_hard_link_relative.wasm", - "testdata/std_fs_metadata_absolute.wasm", - "testdata/std_fs_metadata_relative.wasm", - "testdata/std_fs_read_absolute.wasm", - "testdata/std_fs_read_dir_absolute.wasm", - "testdata/std_fs_read_dir_relative.wasm", - "testdata/std_fs_read_relative.wasm", - "testdata/std_fs_remove_dir_all_absolute.wasm", - "testdata/std_fs_remove_dir_all_relative.wasm", - "testdata/std_fs_rename_absolute.wasm", - "testdata/std_fs_rename_relative.wasm", - "testdata/std_fs_symlink_metadata_absolute.wasm", - "testdata/std_fs_symlink_metadata_relative.wasm", - "testdata/std_fs_write_absolute.wasm", - "testdata/std_fs_write_relative.wasm", + "testdata/std_env_args.wasm", + "testdata/std_env_vars.wasm", + "testdata/std_fs_create_dir.wasm", + "testdata/std_fs_file_create.wasm", + "testdata/std_fs_file_metadata.wasm", + "testdata/std_fs_file_seek.wasm", + "testdata/std_fs_file_set_len.wasm", + "testdata/std_fs_file_sync_all.wasm", + "testdata/std_fs_file_sync_data.wasm", + "testdata/std_fs_hard_link.wasm", + "testdata/std_fs_metadata.wasm", + "testdata/std_fs_read.wasm", + "testdata/std_fs_read_dir.wasm", + "testdata/std_fs_remove_dir_all.wasm", + "testdata/std_fs_rename.wasm", + "testdata/std_fs_symlink_metadata.wasm", + "testdata/std_fs_write.wasm", "testdata/std_io_stderr.wasm", "testdata/std_io_stdin.wasm", "testdata/std_io_stdout.wasm", "testdata/std_process_exit.wasm", - "testdata/wasi_clock_res_get_monotonic.wasm", - "testdata/wasi_clock_res_get_process.wasm", - "testdata/wasi_clock_res_get_realtime.wasm", - "testdata/wasi_clock_res_get_thread.wasm", - "testdata/wasi_clock_time_get_monotonic.wasm", - "testdata/wasi_clock_time_get_process.wasm", - "testdata/wasi_clock_time_get_realtime.wasm", - "testdata/wasi_clock_time_get_thread.wasm", - "testdata/wasi_fd_fdstat_get_stderr.wasm", - "testdata/wasi_fd_fdstat_get_stdin.wasm", - "testdata/wasi_fd_fdstat_get_stdout.wasm", + "testdata/wasi_clock_res_get.wasm", + "testdata/wasi_clock_time_get.wasm", + "testdata/wasi_fd_fdstat_get.wasm", + "testdata/wasi_fd_fdstat_get.wasm", + "testdata/wasi_fd_fdstat_get.wasm", "testdata/wasi_fd_renumber.wasm", "testdata/wasi_fd_tell_file.wasm", "testdata/wasi_fd_write_file.wasm", "testdata/wasi_fd_write_stderr.wasm", "testdata/wasi_fd_write_stdout.wasm", - "testdata/wasi_proc_exit_one.wasm", - "testdata/wasi_proc_exit_zero.wasm", + "testdata/wasi_proc_exit.wasm", "testdata/wasi_random_get.wasm", "testdata/wasi_sched_yield.wasm", ]; const ignore = [ - "testdata/wasi_clock_time_get_realtime.wasm", + "testdata/wasi_clock_time_get.wasm", ]; // TODO(caspervonb) investigate why these tests are failing on windows and fix // them. if (Deno.build.os == "windows") { - ignore.push("testdata/std_fs_metadata_absolute.wasm"); - ignore.push("testdata/std_fs_metadata_relative.wasm"); - ignore.push("testdata/std_fs_read_dir_absolute.wasm"); - ignore.push("testdata/std_fs_read_dir_relative.wasm"); + ignore.push("testdata/std_fs_metadata.wasm"); + ignore.push("testdata/std_fs_read_dir.wasm"); } const rootdir = path.dirname(path.fromFileUrl(import.meta.url)); diff --git a/std/wasi/testdata b/std/wasi/testdata index 7f8aa6ba628a2b..ffbe85d2315ae0 160000 --- a/std/wasi/testdata +++ b/std/wasi/testdata @@ -1 +1 @@ -Subproject commit 7f8aa6ba628a2bea3612e50638b8c9c9c4bb71a8 +Subproject commit ffbe85d2315ae0104534f38037903de38b6f2e63