Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add $HOME/.config/build-wrap/allow.txt test #105

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions tests/integration/config_allow.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use crate::util;
use std::fs::{create_dir_all, write};

#[test]
fn config_allow() {
let temp_package = util::temp_package(Some("tests/build_scripts/ping.rs"), []).unwrap();

let home = util::tempdir().unwrap();
let config_build_wrap = home.path().join(".config/build-wrap");
create_dir_all(&config_build_wrap).unwrap();
write(config_build_wrap.join("allow.txt"), "temp-package\n").unwrap();

for allow in [false, true] {
let mut command = util::build_with_build_wrap();
command.env_remove("XDG_CONFIG_HOME");
if allow {
command.env("HOME", home.path());
}
command.current_dir(&temp_package);

let output = util::exec_forwarding_output(command, false).unwrap();
// smoelius: The command should succeed precisely when `HOME` is set.
assert_eq!(allow, output.status.success());
let stderr = std::str::from_utf8(&output.stderr).unwrap();
assert!(stderr.contains("command failed"));
}
}
1 change: 1 addition & 0 deletions tests/integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mod build_scripts;
mod build_wrap_cmd_changed;
mod cargo_target_dir;
mod ci;
mod config_allow;
mod custom_build_name;
mod dogfood;
mod enabled;
Expand Down
Loading