tests,stdbuf: adapt to change in ctor

This commit is contained in:
Daniel Hofstetter
2026-05-03 13:56:09 +02:00
parent 17cb6787c6
commit 10e3a9c3b8
5 changed files with 5 additions and 7 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ use std::io::{Write, stderr};
use std::{env, ptr};
// This runs automatically when the library is loaded via LD_PRELOAD
#[ctor]
#[ctor(unsafe)]
fn init() {
unsafe { __stdbuf() };
}
+1 -2
View File
@@ -16,9 +16,8 @@ pub const TESTS_BINARY: &str = env!("CARGO_BIN_EXE_coreutils");
// Set the environment variable for any tests
// Use the ctor attribute to run this function before any tests
#[ctor::ctor]
#[ctor::ctor(unsafe)]
fn init() {
// No need for unsafe here
unsafe {
env::set_var("UUTESTS_BINARY_PATH", TESTS_BINARY);
}
+1 -2
View File
@@ -23,9 +23,8 @@ pub const TESTS_BINARY: &str = env!("CARGO_BIN_EXE_uudoc");
// Set the environment variable for any tests
// Use the ctor attribute to run this function before any tests
#[ctor::ctor]
#[ctor::ctor(unsafe)]
fn init() {
// No need for unsafe here
unsafe {
env::set_var("UUTESTS_BINARY_PATH", TESTS_BINARY);
}
+1 -1
View File
@@ -8,7 +8,7 @@ use std::env;
pub const TESTS_BINARY: &str = env!("CARGO_BIN_EXE_coreutils");
// Use the ctor attribute to run this function before any tests
#[ctor::ctor]
#[ctor::ctor(unsafe)]
fn init() {
// Allow overriding the binary path (e.g. to test a WASI binary via wasmtime)
if env::var("UUTESTS_BINARY_PATH").is_err() {
+1 -1
View File
@@ -3244,7 +3244,7 @@ mod tests {
// Create a init for the test with a fake value (not needed)
#[cfg(test)]
#[ctor::ctor]
#[ctor::ctor(unsafe)]
fn init() {
unsafe {
env::set_var("UUTESTS_BINARY_PATH", "");