mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
tests,stdbuf: adapt to change in ctor
This commit is contained in:
@@ -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() };
|
||||
}
|
||||
|
||||
@@ -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
@@ -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
@@ -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() {
|
||||
|
||||
@@ -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", "");
|
||||
|
||||
Reference in New Issue
Block a user