Skip to content

Commit 10e3a9c

Browse files
committed
tests,stdbuf: adapt to change in ctor
1 parent 17cb678 commit 10e3a9c

5 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::io::{Write, stderr};
1010
use std::{env, ptr};
1111

1212
// This runs automatically when the library is loaded via LD_PRELOAD
13-
#[ctor]
13+
#[ctor(unsafe)]
1414
fn init() {
1515
unsafe { __stdbuf() };
1616
}

tests/test_util_name.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ pub const TESTS_BINARY: &str = env!("CARGO_BIN_EXE_coreutils");
1616
// Set the environment variable for any tests
1717

1818
// Use the ctor attribute to run this function before any tests
19-
#[ctor::ctor]
19+
#[ctor::ctor(unsafe)]
2020
fn init() {
21-
// No need for unsafe here
2221
unsafe {
2322
env::set_var("UUTESTS_BINARY_PATH", TESTS_BINARY);
2423
}

tests/test_uudoc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ pub const TESTS_BINARY: &str = env!("CARGO_BIN_EXE_uudoc");
2323
// Set the environment variable for any tests
2424

2525
// Use the ctor attribute to run this function before any tests
26-
#[ctor::ctor]
26+
#[ctor::ctor(unsafe)]
2727
fn init() {
28-
// No need for unsafe here
2928
unsafe {
3029
env::set_var("UUTESTS_BINARY_PATH", TESTS_BINARY);
3130
}

tests/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::env;
88
pub const TESTS_BINARY: &str = env!("CARGO_BIN_EXE_coreutils");
99

1010
// Use the ctor attribute to run this function before any tests
11-
#[ctor::ctor]
11+
#[ctor::ctor(unsafe)]
1212
fn init() {
1313
// Allow overriding the binary path (e.g. to test a WASI binary via wasmtime)
1414
if env::var("UUTESTS_BINARY_PATH").is_err() {

tests/uutests/src/lib/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3244,7 +3244,7 @@ mod tests {
32443244

32453245
// Create a init for the test with a fake value (not needed)
32463246
#[cfg(test)]
3247-
#[ctor::ctor]
3247+
#[ctor::ctor(unsafe)]
32483248
fn init() {
32493249
unsafe {
32503250
env::set_var("UUTESTS_BINARY_PATH", "");

0 commit comments

Comments
 (0)