mirror of
https://github.com/uutils/shadow.git
synced 2026-06-10 16:14:57 -07:00
96f9c40ca3
Replace 13 local copies across all test files with a shared import from tests/common/mod.rs. Fix getuid/geteuid inconsistency in test_useradd.rs and test_userdel.rs (effective UID is correct for setuid-root tools). Fixes #133
16 lines
500 B
Rust
16 lines
500 B
Rust
// This file is part of the shadow-rs package.
|
|
//
|
|
// For the full copyright and license information, please view the LICENSE
|
|
// file that was distributed with this source code.
|
|
|
|
//! Shared test helpers for shadow-rs integration tests.
|
|
//!
|
|
//! Import with `#[path = "../common/mod.rs"] mod common;` in test files.
|
|
|
|
/// Skip the test when not running as root (euid != 0).
|
|
///
|
|
/// Returns `true` if the test should be skipped.
|
|
pub fn skip_unless_root() -> bool {
|
|
!nix::unistd::geteuid().is_root()
|
|
}
|