From 6b5151d75d37c0184300bf4f3332f474c8540a40 Mon Sep 17 00:00:00 2001 From: Marc Schoolderman Date: Fri, 23 Aug 2024 16:33:25 +0200 Subject: [PATCH] add regression test --- test-framework/e2e-tests/src/lib.rs | 1 + test-framework/e2e-tests/src/regression.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test-framework/e2e-tests/src/regression.rs diff --git a/test-framework/e2e-tests/src/lib.rs b/test-framework/e2e-tests/src/lib.rs index a9f98cbdf..3d9008f26 100644 --- a/test-framework/e2e-tests/src/lib.rs +++ b/test-framework/e2e-tests/src/lib.rs @@ -1,6 +1,7 @@ #![cfg(test)] mod pty; +mod regression; mod su; type Error = Box; diff --git a/test-framework/e2e-tests/src/regression.rs b/test-framework/e2e-tests/src/regression.rs new file mode 100644 index 000000000..967aaf75a --- /dev/null +++ b/test-framework/e2e-tests/src/regression.rs @@ -0,0 +1,17 @@ +use sudo_test::{Command, Env, TextFile}; + +use crate::Result; + +#[test] +fn syslog_writer_should_not_hang() -> Result<()> { + let env = Env(TextFile("ALL ALL=(ALL:ALL) NOPASSWD: ALL").chmod("644")).build()?; + + let stdout = Command::new("sudo") + .args(["env", "CC=clang-18", "CXX=clang++-18", "FOO=\"........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................\"", "whoami"]) + .output(&env)? + .stdout()?; + + assert_eq!(stdout, "root"); + + Ok(()) +}