snapshot of https://github.com/tauri-apps/tauri.git (dev, 2026-09-23; blobs > 131072B omitted)
Some checks failed
Audit / audit-js (push) Failing after 0s
bench / bench (map[os:ubuntu-latest runner:xvfb-run --auto-servernum target:x86_64-unknown-linux-gnu], nightly) (push) Failing after 0s
covector version or publish / run-integration-tests (ubuntu-latest) (push) Failing after 0s
Audit / audit-rust (push) Failing after 0s
test `@tauri-apps/cli` / test (ubuntu-latest) (push) Failing after 0s
test `tauri-cli` / test (map[os:ubuntu-latest target:x86_64-unknown-linux-gnu]) (push) Failing after 0s
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:ubuntu-latest target:x86_64-unknown-linux-gnu toolchain:1.90]) (push) Failing after 0s
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:ubuntu-latest target:x86_64-unknown-linux-gnu toolchain:1.90]) (push) Failing after 0s
test core / test (map[args:--no-default-features key:no-default], map[cargo:cross command:build os:ubuntu-latest target:aarch64-linux-android toolchain:1.90]) (push) Failing after 0s
deploy schema worker / deploy (push) Failing after 0s
lint rust / clippy (map[cargo:cargo include: os:ubuntu-latest target:x86_64-unknown-linux-gnu]) (push) Failing after 0s
lint rust / clippy (map[cargo:cross include:--package api os:ubuntu-latest target:aarch64-linux-android]) (push) Failing after 0s
supply chain health status / check rust dependencies with cargo vet (push) Failing after 0s
test `@tauri-apps/api` e2e (mobile) / android (push) Failing after 0s
test `@tauri-apps/api` e2e / test (map[name:Linux os:ubuntu-latest]) (push) Failing after 0s
test core / test (map[args:--all-features key:all], map[cargo:cross command:build os:ubuntu-latest target:aarch64-linux-android toolchain:1.90]) (push) Failing after 0s
Udeps / changes (push) Failing after 0s
Udeps / setup (push) Has been skipped
Udeps / udeps (push) Has been skipped
bench / bench (map[os:macos-latest runner: target:aarch64-apple-darwin], nightly) (push) Has been cancelled
bench / bench (map[os:windows-latest runner: target:x86_64-pc-windows-msvc], nightly) (push) Has been cancelled
covector version or publish / run-integration-tests (macos-latest) (push) Has been cancelled
covector version or publish / run-integration-tests (windows-latest) (push) Has been cancelled
covector version or publish / version-or-publish (push) Has been cancelled
test `@tauri-apps/cli` / test (macos-latest) (push) Has been cancelled
test `tauri-cli` / test (map[args:--no-default-features --features native-tls-vendored os:windows-latest restore-only:true target:aarch64-pc-windows-msvc]) (push) Has been cancelled
test `tauri-cli` / test (map[os:macos-latest target:x86_64-apple-darwin]) (push) Has been cancelled
test `tauri-cli` / test (map[os:windows-latest target:x86_64-pc-windows-msvc]) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:build os:macos-latest target:aarch64-apple-ios toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:macos-14 target:aarch64-apple-darwin toolchain:1.90]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include: os:macos-latest target:aarch64-apple-darwin]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include: os:windows-latest target:x86_64-pc-windows-msvc]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include:--package api os:macos-latest target:aarch64-apple-ios]) (push) Has been cancelled
test `@tauri-apps/api` e2e (mobile) / ios (push) Has been cancelled
test `@tauri-apps/api` e2e / test (map[name:Windows os:windows-latest]) (push) Has been cancelled
test `@tauri-apps/api` e2e / test (map[name:macOS os:macos-latest]) (push) Has been cancelled
test `@tauri-apps/cli` / test (windows-latest) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:windows-latest target:x86_64-pc-windows-msvc toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:build os:macos-latest target:aarch64-apple-ios toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:macos-14 target:aarch64-apple-darwin toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:windows-latest target:x86_64-pc-windows-msvc toolchain:1.90]) (push) Has been cancelled
Some checks failed
Audit / audit-js (push) Failing after 0s
bench / bench (map[os:ubuntu-latest runner:xvfb-run --auto-servernum target:x86_64-unknown-linux-gnu], nightly) (push) Failing after 0s
covector version or publish / run-integration-tests (ubuntu-latest) (push) Failing after 0s
Audit / audit-rust (push) Failing after 0s
test `@tauri-apps/cli` / test (ubuntu-latest) (push) Failing after 0s
test `tauri-cli` / test (map[os:ubuntu-latest target:x86_64-unknown-linux-gnu]) (push) Failing after 0s
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:ubuntu-latest target:x86_64-unknown-linux-gnu toolchain:1.90]) (push) Failing after 0s
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:ubuntu-latest target:x86_64-unknown-linux-gnu toolchain:1.90]) (push) Failing after 0s
test core / test (map[args:--no-default-features key:no-default], map[cargo:cross command:build os:ubuntu-latest target:aarch64-linux-android toolchain:1.90]) (push) Failing after 0s
deploy schema worker / deploy (push) Failing after 0s
lint rust / clippy (map[cargo:cargo include: os:ubuntu-latest target:x86_64-unknown-linux-gnu]) (push) Failing after 0s
lint rust / clippy (map[cargo:cross include:--package api os:ubuntu-latest target:aarch64-linux-android]) (push) Failing after 0s
supply chain health status / check rust dependencies with cargo vet (push) Failing after 0s
test `@tauri-apps/api` e2e (mobile) / android (push) Failing after 0s
test `@tauri-apps/api` e2e / test (map[name:Linux os:ubuntu-latest]) (push) Failing after 0s
test core / test (map[args:--all-features key:all], map[cargo:cross command:build os:ubuntu-latest target:aarch64-linux-android toolchain:1.90]) (push) Failing after 0s
Udeps / changes (push) Failing after 0s
Udeps / setup (push) Has been skipped
Udeps / udeps (push) Has been skipped
bench / bench (map[os:macos-latest runner: target:aarch64-apple-darwin], nightly) (push) Has been cancelled
bench / bench (map[os:windows-latest runner: target:x86_64-pc-windows-msvc], nightly) (push) Has been cancelled
covector version or publish / run-integration-tests (macos-latest) (push) Has been cancelled
covector version or publish / run-integration-tests (windows-latest) (push) Has been cancelled
covector version or publish / version-or-publish (push) Has been cancelled
test `@tauri-apps/cli` / test (macos-latest) (push) Has been cancelled
test `tauri-cli` / test (map[args:--no-default-features --features native-tls-vendored os:windows-latest restore-only:true target:aarch64-pc-windows-msvc]) (push) Has been cancelled
test `tauri-cli` / test (map[os:macos-latest target:x86_64-apple-darwin]) (push) Has been cancelled
test `tauri-cli` / test (map[os:windows-latest target:x86_64-pc-windows-msvc]) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:build os:macos-latest target:aarch64-apple-ios toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:macos-14 target:aarch64-apple-darwin toolchain:1.90]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include: os:macos-latest target:aarch64-apple-darwin]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include: os:windows-latest target:x86_64-pc-windows-msvc]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include:--package api os:macos-latest target:aarch64-apple-ios]) (push) Has been cancelled
test `@tauri-apps/api` e2e (mobile) / ios (push) Has been cancelled
test `@tauri-apps/api` e2e / test (map[name:Windows os:windows-latest]) (push) Has been cancelled
test `@tauri-apps/api` e2e / test (map[name:macOS os:macos-latest]) (push) Has been cancelled
test `@tauri-apps/cli` / test (windows-latest) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:windows-latest target:x86_64-pc-windows-msvc toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:build os:macos-latest target:aarch64-apple-ios toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:macos-14 target:aarch64-apple-darwin toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:windows-latest target:x86_64-pc-windows-msvc toolchain:1.90]) (push) Has been cancelled
This commit is contained in:
15
crates/tests/restart/Cargo.toml
Normal file
15
crates/tests/restart/Cargo.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "restart"
|
||||
version = "0.1.0"
|
||||
authors = ["Tauri Programme within The Commons Conservancy"]
|
||||
license = "Apache-2.0 OR MIT"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies.tauri]
|
||||
workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
|
||||
[features]
|
||||
process-relaunch-dangerous-allow-symlink-macos = []
|
||||
1
crates/tests/restart/LICENSE-APACHE-2.0
Normal file
1
crates/tests/restart/LICENSE-APACHE-2.0
Normal file
@@ -0,0 +1 @@
|
||||
../../../LICENSE-APACHE-2.0
|
||||
1
crates/tests/restart/LICENSE-MIT
Normal file
1
crates/tests/restart/LICENSE-MIT
Normal file
@@ -0,0 +1 @@
|
||||
../../../LICENSE-MIT
|
||||
1
crates/tests/restart/LICENSE.spdx
Normal file
1
crates/tests/restart/LICENSE.spdx
Normal file
@@ -0,0 +1 @@
|
||||
../../../LICENSE.spdx
|
||||
5
crates/tests/restart/build.rs
Normal file
5
crates/tests/restart/build.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {}
|
||||
30
crates/tests/restart/src/main.rs
Normal file
30
crates/tests/restart/src/main.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use tauri::Env;
|
||||
|
||||
fn main() {
|
||||
let mut argv = std::env::args();
|
||||
let argc = argv.len();
|
||||
if argc == 0 || argc > 2 {
|
||||
panic!("restart test binary expect either no arguments or `restart`.")
|
||||
}
|
||||
|
||||
println!(
|
||||
"{}",
|
||||
tauri::process::current_binary(&Default::default())
|
||||
.expect("tauri::process::current_binary could not resolve")
|
||||
.display()
|
||||
);
|
||||
|
||||
match argv.nth(1).as_deref() {
|
||||
Some("restart") => {
|
||||
let mut env = Env::default();
|
||||
env.args_os.clear();
|
||||
tauri::process::restart(&env)
|
||||
}
|
||||
Some(invalid) => panic!("only argument `restart` is allowed, {invalid} is invalid"),
|
||||
None => {}
|
||||
};
|
||||
}
|
||||
125
crates/tests/restart/tests/restart.rs
Normal file
125
crates/tests/restart/tests/restart.rs
Normal file
@@ -0,0 +1,125 @@
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
||||
/// Helper for generic catch-all errors.
|
||||
type Result = std::result::Result<(), Box<dyn std::error::Error>>;
|
||||
|
||||
/// <https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--1300-1699->
|
||||
#[cfg(windows)]
|
||||
const ERROR_PRIVILEGE_NOT_HELD: i32 = 1314;
|
||||
|
||||
/// Represents a successfully created symlink.
|
||||
enum Symlink {
|
||||
/// Path to the created symlink
|
||||
Created(PathBuf),
|
||||
|
||||
/// A symlink that failed due to missing permissions (Windows).
|
||||
#[allow(dead_code)]
|
||||
Privilege,
|
||||
}
|
||||
|
||||
/// Compile the test binary, run it, and compare it with expected output.
|
||||
///
|
||||
/// Failing to create a symlink due to permissions issues is also a success
|
||||
/// for the purpose of this runner.
|
||||
fn symlink_runner(create_symlinks: impl Fn(&Path) -> io::Result<Symlink>) -> Result {
|
||||
let mut compiled_binary = PathBuf::from(env!("OUT_DIR")).join("../../../restart");
|
||||
if cfg!(windows) {
|
||||
compiled_binary.set_extension("exe");
|
||||
}
|
||||
println!("{compiled_binary:?}");
|
||||
|
||||
// set up all the temporary file paths
|
||||
let temp = tempfile::TempDir::new()?;
|
||||
let bin = temp.path().canonicalize()?.join("restart.exe");
|
||||
|
||||
// copy the built restart test binary to our temporary directory
|
||||
std::fs::copy(compiled_binary, &bin)?;
|
||||
|
||||
if let Symlink::Created(link) = create_symlinks(&bin)? {
|
||||
// run the command from the symlink, so that we can test if restart resolves it correctly
|
||||
let mut cmd = Command::new(link);
|
||||
|
||||
// add the restart parameter so that the invocation will call tauri::process::restart
|
||||
cmd.arg("restart");
|
||||
|
||||
let output = cmd.output()?;
|
||||
|
||||
// run `TempDir` destructors to prevent resource leaking if the assertion fails
|
||||
drop(temp);
|
||||
|
||||
if output.status.success() {
|
||||
// gather the output into a string
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
|
||||
// we expect the output to be the bin path, twice
|
||||
assert_eq!(stdout, format!("{bin}\n{bin}\n", bin = bin.display()));
|
||||
} else if cfg!(all(
|
||||
target_os = "macos",
|
||||
not(feature = "process-relaunch-dangerous-allow-symlink-macos")
|
||||
)) {
|
||||
// we expect this to fail on macOS without the dangerous symlink flag set
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
|
||||
// make sure it's the error that we expect
|
||||
assert!(stderr.contains(
|
||||
"StartingBinary found current_exe() that contains a symlink on a non-allowed platform"
|
||||
));
|
||||
} else {
|
||||
// we didn't expect the program to fail in this configuration, just panic
|
||||
panic!("restart integration test runner failed for unknown reason");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Cross-platform way to create a symlink
|
||||
///
|
||||
/// Symlinks that failed to create due to permissions issues (like on Windows)
|
||||
/// are also seen as successful for the purpose of this testing suite.
|
||||
fn create_symlink(original: &Path, link: PathBuf) -> io::Result<Symlink> {
|
||||
#[cfg(unix)]
|
||||
return std::os::unix::fs::symlink(original, &link).map(|()| Symlink::Created(link));
|
||||
|
||||
#[cfg(windows)]
|
||||
return match std::os::windows::fs::symlink_file(original, &link) {
|
||||
Ok(()) => Ok(Symlink::Created(link)),
|
||||
Err(e) => match e.raw_os_error() {
|
||||
Some(ERROR_PRIVILEGE_NOT_HELD) => Ok(Symlink::Privilege),
|
||||
_ => Err(e),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/// Only use 1 test to prevent cargo from waiting on itself.
|
||||
///
|
||||
/// While not ideal, this is fine because they use the same solution for both cases.
|
||||
#[test]
|
||||
fn restart_symlinks() -> Result {
|
||||
// single symlink
|
||||
symlink_runner(|bin| {
|
||||
let mut link = bin.to_owned();
|
||||
link.set_file_name("symlink");
|
||||
link.set_extension("exe");
|
||||
create_symlink(bin, link)
|
||||
})?;
|
||||
|
||||
// nested symlinks
|
||||
symlink_runner(|bin| {
|
||||
let mut link1 = bin.to_owned();
|
||||
link1.set_file_name("symlink1");
|
||||
link1.set_extension("exe");
|
||||
create_symlink(bin, link1.clone())?;
|
||||
|
||||
let mut link2 = bin.to_owned();
|
||||
link2.set_file_name("symlink2");
|
||||
link2.set_extension("exe");
|
||||
create_symlink(&link1, link2)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user