From 60f8c02626369db69769474307a95caf61ec3d81 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 14 Aug 2012 20:21:30 -0400 Subject: [PATCH] Add a 'test' makefile target. Fix the group execute removal so that the last test passes. Add a new test. --- makefile | 5 ++++ run-tests.sh | 26 +++++++++++++++- src/aclq.c | 84 +++++++++++++++++++++++++++++++++------------------- 3 files changed, 83 insertions(+), 32 deletions(-) diff --git a/makefile b/makefile index ffe3a9e..ae7d943 100644 --- a/makefile +++ b/makefile @@ -12,6 +12,11 @@ OBJS := $(patsubst %.c, %.o, $(SOURCES)) aclq: $(OBJS) $(CC) $(CFLAGS) $(LIBS) -o $@ $^ +.PHONY: clean test + clean: rm -f $(OBJS) rm -f aclq + +test: + ./run-tests.sh diff --git a/run-tests.sh b/run-tests.sh index a5f7692..75414ca 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -9,7 +9,7 @@ TESTDIR=test acl_reset() { # Remove any ACLs on our test directory and remove its contents. setfacl --remove-all --recursive "$TESTDIR" - rm -f "${TESTDIR}"/* + rm -rf "${TESTDIR}"/* } compare() { @@ -92,3 +92,27 @@ EOF ACTUAL=`getfacl --omit-header "${TARGET}"` compare + +# Same test as before except with a directory. +setfacl -d -m group:mail:rwx "${TESTDIR}" +mkdir "${TARGET}" +chmod 755 "${TARGET}" +./aclq "${TARGET}" + +EXPECTED=$(cat <