diff --git a/docs/TESTS.md b/docs/TESTS.md index 1e9a6c3..9b403c7 100644 --- a/docs/TESTS.md +++ b/docs/TESTS.md @@ -5,7 +5,7 @@ Install bubblewrap: `apt-get install bubblewrap`. -Run with `cargo test -p vuinputd-tests --features "requires-root requires-uinput requires-bwrap"`. +Run with `cargo test -p vuinputd-tests --features "requires-privileges requires-uinput requires-bwrap"`. ## Manual end-to-end tests diff --git a/vuinputd-tests/Cargo.toml b/vuinputd-tests/Cargo.toml index 0bdd7b3..5207d3a 100644 --- a/vuinputd-tests/Cargo.toml +++ b/vuinputd-tests/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [[bin]] -name = "keyboard-in-container" +name = "test-keyboard" [[bin]] name = "bwrap-ipc" @@ -17,6 +17,6 @@ libudev = "0.3" # enumerate-udev vuinputd = { path = "../vuinputd" } [features] -requires-root = [] +requires-privileges = [] requires-uinput = [] requires-bwrap = [] \ No newline at end of file diff --git a/vuinputd-tests/src/bin/keyboard-in-container.rs b/vuinputd-tests/src/bin/test-keyboard.rs similarity index 100% rename from vuinputd-tests/src/bin/keyboard-in-container.rs rename to vuinputd-tests/src/bin/test-keyboard.rs diff --git a/vuinputd-tests/tests/integration_tests.rs b/vuinputd-tests/tests/integration_tests.rs index 0c95947..00414d2 100644 --- a/vuinputd-tests/tests/integration_tests.rs +++ b/vuinputd-tests/tests/integration_tests.rs @@ -6,7 +6,7 @@ use std::{process::Command, time::Duration}; use vuinputd_tests::bwrap; use vuinputd_tests::run_vuinputd; -#[cfg(all(feature = "requires-root", feature = "requires-bwrap"))] +#[cfg(all(feature = "requires-privileges", feature = "requires-bwrap"))] #[test] fn test_bwrap_simple() { let out = bwrap::BwrapBuilder::new() @@ -23,7 +23,7 @@ fn test_bwrap_simple() { println!("stderr: {}", str::from_utf8(&out.stderr).unwrap()); } -#[cfg(all(feature = "requires-root", feature = "requires-bwrap"))] +#[cfg(all(feature = "requires-privileges", feature = "requires-bwrap"))] #[test] fn test_bwrap_ipc() { let bwrap_ipc = env!("CARGO_BIN_EXE_bwrap-ipc"); @@ -60,12 +60,12 @@ fn test_bwrap_ipc() { } -#[cfg(all(feature = "requires-root", feature = "requires-uinput"))] +#[cfg(all(feature = "requires-privileges", feature = "requires-uinput"))] #[test] fn test_keyboard_on_host() { - let keyboard_in_container = env!("CARGO_BIN_EXE_keyboard-in-container"); + let test_keyboard = env!("CARGO_BIN_EXE_test-keyboard"); - let status = Command::new(keyboard_in_container) + let status = Command::new(test_keyboard) .status() .expect("failed to launch keyboard-in-container"); @@ -73,10 +73,10 @@ fn test_keyboard_on_host() { } -#[cfg(all(feature = "requires-root", feature = "requires-uinput", feature = "requires-bwrap"))] +#[cfg(all(feature = "requires-privileges", feature = "requires-uinput", feature = "requires-bwrap"))] #[test] fn test_keyboard_in_container_with_uinput() { - let keyboard_in_container = env!("CARGO_BIN_EXE_keyboard-in-container"); + let test_keyboard = env!("CARGO_BIN_EXE_test-keyboard"); let out = bwrap::BwrapBuilder::new() .unshare_net() @@ -84,7 +84,7 @@ fn test_keyboard_in_container_with_uinput() { .tmpfs("/tmp") .dev_bind("/dev/uinput", "/dev/uinput") .die_with_parent() - .command(keyboard_in_container,&[]) + .command(test_keyboard,&[]) .run() .unwrap_or_else(|e| panic!("failed to run bwrap!: {e}")); @@ -95,12 +95,12 @@ fn test_keyboard_in_container_with_uinput() { assert!(out.status.success()); } -#[cfg(all(feature = "requires-root", feature = "requires-uinput", feature = "requires-bwrap"))] +#[cfg(all(feature = "requires-privileges", feature = "requires-uinput", feature = "requires-bwrap"))] #[test] fn test_keyboard_in_container_with_vuinput() { run_vuinputd::ensure_vuinputd_running(); - let keyboard_in_container = env!("CARGO_BIN_EXE_keyboard-in-container"); + let test_keyboard = env!("CARGO_BIN_EXE_test-keyboard"); let out = bwrap::BwrapBuilder::new() .unshare_net() @@ -112,7 +112,7 @@ fn test_keyboard_in_container_with_vuinput() { .tmpfs("/run") .dev_bind("/dev/vuinput-test", "/dev/uinput") .die_with_parent() - .command(keyboard_in_container,&[]) + .command(test_keyboard,&[]) .run() .unwrap_or_else(|e| panic!("failed to run bwrap!: {e}"));