mm(1): fixes to pledge(2) now; tests: bonsai/mm.mk: adds test for regression

This commit is contained in:
Emma Tebibyte 2024-08-17 14:58:56 -06:00
parent a4a556a5b6
commit e9058803d3
Signed by: emma
GPG Key ID: 06FA419A1698C270
2 changed files with 10 additions and 3 deletions

View File

@ -52,7 +52,7 @@ fn main() -> ExitCode {
let usage = format!("Usage: {} [-aetu] [-i input] [-o output]", argv[0]);
if cfg!(target_os="openbsd") {
let promises = Promises::new("rpath stdio unveil");
let promises = Promises::new("cpath rpath stdio unveil wpath");
if let Err(e) = pledge(Some(promises), None) {
eprintln!("{}: {}", argv[0], e.strerror());
return ExitCode::from(EX_OSERR as u8);

View File

@ -1,4 +1,4 @@
# Copyright (c) 2024 E$(NAME)a Tebibyte <e$(NAME)a@tebibyte.media>
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
# SPDX-License-Identifier: FSFAP
#
# Copying and distribution of this file, with or without modification, are
@ -6,7 +6,7 @@
# notice are preserved. This file is offered as-is, without any warranty.
.PHONY: mm_tests
mm_tests: mm_args mm_help mm_stderr
mm_tests: mm_args mm_help mm_stderr mm_remaining
.PHONY: mm_none
mm_none: $(BIN)/mm
@ -25,3 +25,10 @@ mm_help: $(BIN)/mm
# check if stderr is empty upon specifying -e
mm_stderr: $(BIN)/mm
test "$$(printf 'test\n' | $(BIN)/mm -e 2>&1 >/dev/null )" = "test"
.PHONY: mm_remaining
# check to make sure remaining arguments are used
mm_remaining: $(BIN)/mm
test "$$($(BIN)/mm -i README COPYING)" = "$$(cat README COPYING)"
$(BIN)/mm -i README -o /tmp/mm_test0 /tmp/mm_test1
diff /tmp/mm_test0 /tmp/mm_test1