Makefile, tests/bonsai/scrut.mk: cleanup

This commit is contained in:
Emma Tebibyte 2025-02-24 23:17:10 -07:00
parent 941f931f8b
commit 9b699d7298
Signed by: emma
GPG Key ID: 427287A2F16F44FA
2 changed files with 13 additions and 13 deletions

View File

@ -114,7 +114,7 @@ build/bin/false: src/false.c build
.PHONY: fileis
fileis: build/bin/fileis
build/bin/fileis: src/fileis.rs build
build/bin/fileis: src/fileis.rs build rustlibs
$(RUSTC) $(RUSTFLAGS) $(RUSTLIBS) -o $@ src/fileis.rs
.PHONY: fop

View File

@ -8,20 +8,20 @@
.PRAGMA: command_comment
.PHONY: scrut_tests
scrut_tests: scrut_help scrut_options
.PHONY: fileis_tests
fileis_tests: fileis_help fileis_options
.PHONY: scrut_help
scrut_help: $(BIN)/scrut
! $(BIN)/scrut -h
.PHONY: fileis_help
fileis_help: $(BIN)/fileis
! $(BIN)/fileis -h
.PHONY: scrut_options
# scrut tests file attributes, but files of a certain attribute aren't
.PHONY: fileis_options
# fileis tests file attributes, but files of a certain attribute aren't
# guaranteed to be present on a system. This test checks all of the files in
# harakit and, if test(1p) says a file matches a certain attribute, then checks
# scrut.
# fileis.
# opts are space-delimited (for command splitting), sel is not
scrut_options: $(BIN)/scrut
fileis_options: $(BIN)/fileis
set -e; \
opts="b c d e f g k p r s u w x L S"; \
sel=; \
@ -30,12 +30,12 @@ scrut_options: $(BIN)/scrut
for opt in $$opts; \
do if ! printf "%s\n" $$sel | grep $$opt >/dev/null; then \
if test -$$opt "$$f"; then \
if ! $(BIN)/scrut -$$opt "$$f"; \
then printf "[!!] scrut -%s failed on %s.\n" \
if ! $(BIN)/fileis -$$opt "$$f"; \
then printf "[!!] fileis -%s failed on %s.\n" \
$$opt "$$f"; \
fi; \
sel="$$sel$$opt"; \
printf "[OK] Tested scrut -%s using %s\n" \
printf "[OK] Tested fileis -%s using %s\n" \
$$opt "$$f"; \
fi; \
fi; \