Skip to content

Visual Studio Code, rebuilt in Rust

Rust

test(windows): build the app tests for Windows

rokartur43b3f2ccf1de
diff --git a/native/crates/app/src/terminal/completion_service/tests.rs b/native/crates/app/src/terminal/completion_service/tests.rs
index 9c57a7a5f08..3f7b83df6bf 100644
--- a/native/crates/app/src/terminal/completion_service/tests.rs
+++ b/native/crates/app/src/terminal/completion_service/tests.rs
@@ -34,10 +34,15 @@ impl Fixture {
}
fn file(&self, path: &str, executable: bool) -> &Self {
- use std::os::unix::fs::PermissionsExt;
let path = self.path(path);
fs::write(&path, "").expect("create a fixture file");
- fs::set_permissions(&path, fs::Permissions::from_mode(if executable { 0o755 } else { 0o644 })).expect("set the fixture file mode");
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::PermissionsExt;
+ fs::set_permissions(&path, fs::Permissions::from_mode(if executable { 0o755 } else { 0o644 })).expect("set the fixture file mode");
+ }
+ #[cfg(windows)]
+ let _ = executable;
self
}
@@ -378,6 +383,7 @@ fn cdpath_needs_the_setting_and_cd() {
}
// The gitbash path conversion suite is skipped: it is Windows only.
+#[cfg(unix)]
#[test]
fn symlinks_show_their_target() {
use std::os::unix::fs::symlink;
diff --git a/native/crates/app/src/update/install/tests.rs b/native/crates/app/src/update/install/tests.rs
index e5d00a7e530..3c0792d6dc1 100644
--- a/native/crates/app/src/update/install/tests.rs
+++ b/native/crates/app/src/update/install/tests.rs
@@ -73,6 +73,7 @@ fn the_sha256_matches_shasum() {
assert_eq!(sha256_file(&dir.join("file")).unwrap(), "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
}
+#[cfg(unix)]
#[test]
fn a_read_only_or_translocated_bundle_cannot_update() {
let dir = scratch("writable");
diff --git a/native/crates/app/src/workbench/explorer_actions/tests.rs b/native/crates/app/src/workbench/explorer_actions/tests.rs
index e3cbdad51d5..406973cdbef 100644
--- a/native/crates/app/src/workbench/explorer_actions/tests.rs
+++ b/native/crates/app/src/workbench/explorer_actions/tests.rs
@@ -364,6 +364,7 @@ fn readonly_keys_follow_the_focused_item_and_its_parent(cx: &mut TestAppContext)
}
/// fileActions.ts `onErrorWithRetry`: a failed create is an error notification with Retry, not a dialog.
+#[cfg(unix)]
#[gpui::test]
fn a_failed_create_offers_retry_in_a_notification(cx: &mut TestAppContext) {
use std::os::unix::fs::PermissionsExt;
diff --git a/native/crates/app/src/workbench/readonly/tests.rs b/native/crates/app/src/workbench/readonly/tests.rs
index a29b58a0e08..19b272c9d5b 100644
--- a/native/crates/app/src/workbench/readonly/tests.rs
+++ b/native/crates/app/src/workbench/readonly/tests.rs
@@ -1,3 +1,4 @@
+#[cfg(unix)]
use std::os::unix::fs::PermissionsExt;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -67,6 +68,7 @@ fn the_session_commands_set_toggle_and_reset_the_override(cx: &mut TestAppContex
std::fs::remove_dir_all(dir).unwrap();
}
+#[cfg(unix)]
#[gpui::test]
fn include_minus_exclude_then_permissions_decide_and_the_session_wins(cx: &mut TestAppContext) {
let settings = r#"{"files.readonlyInclude": {"**/*.txt": true}, "files.readonlyExclude": {"keep.txt": true}, "files.readonlyFromPermissions": true}"#;
diff --git a/native/crates/app/src/workbench/terminal_contrib.rs b/native/crates/app/src/workbench/terminal_contrib.rs
index bcb9b3054ae..b7489ef4f86 100644
--- a/native/crates/app/src/workbench/terminal_contrib.rs
+++ b/native/crates/app/src/workbench/terminal_contrib.rs
@@ -312,7 +312,7 @@ mod tests {
#[test]
fn signals_and_font_sizes() {
assert_eq!(signal_number("SIGTERM"), Some(libc::SIGTERM));
- assert_eq!(signal_number("kill"), Some(libc::SIGKILL));
+ assert_eq!(signal_number("kill"), Some(9));
assert_eq!(signal_number("9"), Some(9));
assert_eq!(signal_number("SIGNOPE"), None);
assert_eq!(clamp_font_size(120.), 100.);
diff --git a/native/crates/app/src/workbench/text_files/tests.rs b/native/crates/app/src/workbench/text_files/tests.rs
index ffc773101aa..f125e664884 100644
--- a/native/crates/app/src/workbench/text_files/tests.rs
+++ b/native/crates/app/src/workbench/text_files/tests.rs
@@ -245,6 +245,7 @@ fn files_associations_change_the_language_of_models_without_a_picked_one(cx: &mu
std::fs::remove_dir_all(dir).unwrap();
}
+#[cfg(unix)]
#[gpui::test]
fn a_write_locked_file_saves_after_overwrite(cx: &mut TestAppContext) {
use std::os::unix::fs::PermissionsExt;
diff --git a/port/ledger.md b/port/ledger.md
index a76e278b2ea..fe615ef6ae6 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -66,7 +66,7 @@ Status: `open`, `in progress`, `waiting on Artur`, `later` (postponed), `done`,
| M23 Linux | app/src/workbench/menubar.rs:173 | open | [linux M] menu bar in the custom title bar. Linux shows now: no menu bar; gpui_linux `set_menus` keeps the menus and draws none. | |
| M23 Linux | .github/workflows/linux.yml:1 | done | [linux S] move actions/checkout, actions/setup-node and actions/upload-artifact from v4 to their Node 24 majors (pinned by SHA). | checkout v7.0.1, setup-node v7.1.0, upload-artifact v7.0.2 by SHA; the workflow not run yet |
| M23 Linux | port/tools/package-linux:1 | done | [linux M] Linux builds of the host's native modules (@vscode/spdlog, kerberos): package-linux rebuilds them with node-gyp; a dev run in the Studio container still loads the reference's macOS builds (its pnpm install ran on macOS), a Linux install of upstream builds them for Linux. | the extracted `VSRustium-1.147.0-linux-arm64.tar.gz` writes `logs/<session>/window1/exthost/exthost.log` (spdlog) and passes `port/tools/linux/smoke` |
-| M24 Windows | port/tools/windows-build:1 | done | [windows M] cross build on the Studio: `cargo gc xwin` with Homebrew llvm and lld on PATH, for `x86_64-pc-windows-msvc` and `aarch64-pc-windows-msvc`; the Unix-only std and libc calls (files/src/disk.rs:58, exthost/src/lib.rs:31, app/src/cli.rs:7, app/src/launch.rs:5, app/src/shell_env.rs:5, app/src/update/install.rs:39) behind `cfg(unix)` with a Windows counterpart or an M24 row naming what Windows shows meanwhile. | `port/tools/windows-build 'cargo gc xwin build -p app --target x86_64-pc-windows-msvc'` and the same for `aarch64-pc-windows-msvc` exit 0 |
+| M24 Windows | port/tools/windows-build:1 | done | [windows M] cross build on the Studio: `cargo gc xwin` with Homebrew llvm and lld on PATH, for `x86_64-pc-windows-msvc` and `aarch64-pc-windows-msvc`; the Unix-only std and libc calls (files/src/disk.rs:58, exthost/src/lib.rs:31, app/src/cli.rs:7, app/src/launch.rs:5, app/src/shell_env.rs:5, app/src/update/install.rs:39) behind `cfg(unix)` with a Windows counterpart or an M24 row naming what Windows shows meanwhile. The app's tests build for Windows: the tests that lock files or folders through Unix modes or make symlinks are `cfg(unix)` (their Windows counterparts are the files/src/disk.rs:58 row). | `port/tools/windows-build 'cargo gc xwin build --bins --tests -p app --target x86_64-pc-windows-msvc'` and the same for `aarch64-pc-windows-msvc` exit 0 |
| M24 Windows | app/src/update/install/tests.rs:80 | open | [windows S] the app's tests compile for Windows, so the runner rows can run them: 15 errors in Unix-only test code (`std::os::unix` permissions in terminal/completion_service, workbench/readonly, explorer_actions, text_files; `libc::SIGKILL` in terminal_contrib; `check_writable` in update/install). The exthost and storage tests compile. | `port/tools/windows-build 'cargo gc xwin check -p app --tests --target x86_64-pc-windows-msvc'` exits 0 |
| M24 Windows | app/src/terminal/pty.rs:1 | in progress | [windows L] terminal through ConPTY (terminal/pty/conpty.rs, windows-sys), as node-pty's conpty.cc and windowsPtyAgent.ts: spawn with the command line `argsToCommandLine` builds, resize, kill (signals ignored, as node-pty on Windows), `hasChildProcesses` from a process snapshot, cwd as the initial cwd (terminalProcess.ts `getCwd` on Windows). Built, not yet run on Windows; the foreground process is the started file (windowsTerminal.ts `process`), not windowsShellHelper.ts's tracking. | `cargo gc test -p app pty` on the windows runner; `cargo gc test -p app args_to_command_line` on the host, with node-pty lib/windowsPtyAgent.js's output |
| M24 Windows | app/src/terminal/profiles.rs:133 | open | [windows M] Windows terminal profiles (terminalProfiles.ts `detectAvailableWindowsProfiles`): PowerShell (pwsh, then Windows PowerShell), Command Prompt, Git Bash, WSL distributions; `terminal.integrated.defaultProfile.windows`; shell integration for pwsh (shellIntegration.ps1). | `cargo gc test -p app terminal::profiles` on the windows runner |
@@ -83,7 +83,7 @@ Status: `open`, `in progress`, `waiting on Artur`, `later` (postponed), `done`,
| M24 Windows | app/src/keyboard_layout.rs:7 | open | [windows M] keyboard layout info and raw mapping (native-keymap's Windows `GetKeyboardLayout`, `MapVirtualKeyEx`, `ToUnicodeEx`). | `cargo gc test -p app keyboard` on the windows runner |
| M24 Windows | app/src/clipboard.rs:91 | open | [windows M] clipboard file lists, HTML and custom formats (Chromium's registered clipboard formats); GPUI's Windows clipboard has text and images. Windows shows now: text only. | `cargo gc test -p app clipboard` on the windows runner |
| M24 Windows | files/src/disk.rs:58 | open | [windows M] file system on NTFS: read-only through `FILE_ATTRIBUTE_READONLY`, file and directory symlinks, case-insensitive path compare, Recycle Bin (trash crate), ReadDirectoryChangesW (notify). | `cargo gc test -p files` on the windows runner |
-| M24 Windows | app/src/editor_history.rs:59 | open | [windows L] drive-letter paths and file URIs (`file:///c%3A/...`, uri.ts `fsPath` on Windows, backslash separators in labels): the per-file `file_uri` helpers go through one conversion. | `cargo gc test -p app uri` on the host for the conversion; api-tests on the windows runner |
+| M24 Windows | app/src/editor_history.rs:59 | in progress | [windows L] drive-letter paths and file URIs (`file:///c%3A/...`, uri.ts `fsPath` on Windows, backslash separators in labels). Done: uri.rs `Uri::file` and `fs_path` as uri.ts `URI.file` and `uriToFsPath` (backslashes, drive letters, UNC authorities), used by editor_history.rs, the editor's model URIs (editor.rs `uri_value`, `uri_string`, host_requests.rs `uri_parts`, on Windows only: elsewhere a `//host` path keeps the port's form), backup_tracker.rs, file_dialogs.rs, language_features.rs and webview resources (`file_roots`, `is_contained` comparing `fsPath`s ignoring case as `extUri` on Windows, the WebView2 file read). Open: the other `file` URI reads (`uri["path"]` of a `file` URI taken as the path: debug, scm, search, notebooks, tasks and the rest), backslash separators in labels (labels.ts `getPathLabel`), and the UNC host check (`security.restrictUNCAccess`, `security.allowedUNCHosts`, Electron's node `ERR_UNC_HOST_NOT_ALLOWED`): a `file://host/share` URI now reaches `\\host\share`, so a link to it sends the user's NTLM credentials to that host. | `cargo gc test -p app uri::tests::file_uris_and_fs_paths_per_platform` and `cargo gc test -p app webview::tests::maps_resource_urls` on the host; [windows] api-tests and a webview image from the workspace on the windows runner |
| M24 Windows | app/src/settings_import.rs:28 | open | [windows S] settings import from `%APPDATA%\Code`, `%APPDATA%\Cursor`, `%APPDATA%\VSCodium`, extensions from `%USERPROFILE%\.vscode\extensions` and the others. | `cargo gc test -p app settings_import` on the windows runner |
| M24 Windows | app/src/workbench/shell_command.rs:70 | in progress | [windows S] no Shell Command on Windows (upstream has it on macOS only): the user setup puts `{app}\bin` on the user PATH (code.iss `addtopath`), the zip leaves PATH alone. | the commands absent from the palette on the windows runner; the installer row's check |
| M24 Windows | app/src/update/install.rs:21 | in progress | [windows M] updates as a download link, as on Linux (decision "Windows updates"). | `cargo gc test -p app update::` on the host |