tests: remove more stray flag/temporary files with 'make clean'
PATCH 1/1 tests: remove more stray flag/temporary files with 'make clean'
Building upon a similar cleanup being done in the binder test, remove any temporary files that may have been left behind by a failed or interrupted test run as part of 'make clean'.
For now, skip doing this for the filesystem/fs_filesystem tests, as those can leave behind directories with mounts, which are harder to clean up reliably.
--- tests/bounds/Makefile | 2 +- tests/bpf/Makefile | 2 +- tests/capable_file/Makefile | 2 +- tests/entrypoint/Makefile | 1 + tests/execute_no_trans/Makefile | 1 + tests/fdreceive/Makefile | 2 +- tests/fdreceive/test | 4 +++- tests/file/Makefile | 2 +- tests/inet_socket/Makefile | 2 +- tests/inherit/Makefile | 2 +- tests/ioctl/Makefile | 2 +- tests/link/Makefile | 1 + tests/mac_admin/Makefile | 1 + tests/mkdir/Makefile | 1 + tests/mmap/Makefile | 2 +- tests/nnp_nosuid/Makefile | 2 +- tests/notify/Makefile | 2 +- tests/open/Makefile | 2 +- tests/ptrace/Makefile | 2 +- tests/readlink/Makefile | 1 + tests/relabel/Makefile | 1 + tests/rename/Makefile | 1 + tests/rxdir/Makefile | 1 + tests/sctp/Makefile | 2 +- tests/setattr/Makefile | 1 + tests/sigkill/Makefile | 2 +- tests/stat/Makefile | 1 + tests/task_getpgid/Makefile | 2 +- tests/task_getscheduler/Makefile | 2 +- tests/task_getsid/Makefile | 2 +- tests/task_setnice/Makefile | 1 + tests/task_setscheduler/Makefile | 2 +- tests/unix_socket/Makefile | 2 +- tests/vsock_socket/Makefile | 2 +- 34 files changed, 36 insertions(+), 22 deletions(-)
tests/bounds/Makefile +1 -1
@@ -4,4 +4,4 @@ LDLIBS += -lselinux -lpthread all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) bounds_file*
tests/bpf/Makefile +1 -1
@@ -11,7 +11,7 @@ all: $(TARGETS) @set -e; for i in $(BPF_ENABLED); do $(MAKE) -C $$i all ; done clean: - rm -f $(TARGETS) + rm -f $(TARGETS) test_sock flag *_flag @set -e; for i in $(BPF_ENABLED); do $(MAKE) -C $$i clean ; done $(TARGETS): $(DEPS)
tests/capable_file/Makefile +1 -1
@@ -1,5 +1,5 @@ TARGETS=$(patsubst %.c,%,$(wildcard *.c)) all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) temp_file temp_file2
tests/entrypoint/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -f true
tests/execute_no_trans/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -f true
tests/fdreceive/Makefile +1 -1
@@ -8,6 +8,6 @@ endif all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) test_file test_file2 test_sock flag client: $(DEPS)
tests/fdreceive/test +3 -1
@@ -7,7 +7,9 @@ $basedir = $0; $basedir =~ s|(.*)/[^/]*|$1|; # Remove any leftover test file from prior failed runs. -system("rm -rf $basedir/test_file $basedir/test_file2 $basedir/test_sock"); +system( +"rm -rf $basedir/test_file $basedir/test_file2 $basedir/test_sock $basedir/flag" +); # Create and label the test files. system("touch $basedir/test_file $basedir/test_file2");
tests/file/Makefile +1 -1
@@ -3,4 +3,4 @@ LDLIBS += -lselinux test_sigiotask: LDLIBS += -lutil all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) temp_file temp_file2 temp_file3
tests/inet_socket/Makefile +1 -1
@@ -4,4 +4,4 @@ LDLIBS+= -lselinux all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) flag
tests/inherit/Makefile +1 -1
@@ -4,4 +4,4 @@ LDLIBS += -lselinux all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) test_file
tests/ioctl/Makefile +1 -1
@@ -1,4 +1,4 @@ TARGETS=$(patsubst %.c,%,$(wildcard *.c)) all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) temp_file
tests/link/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -rf test_dir
tests/mac_admin/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -rf test_dir test_file
tests/mkdir/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -rf test_dir
tests/mmap/Makefile +1 -1
@@ -5,4 +5,4 @@ LDLIBS += -lpthread all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) temp_file
tests/nnp_nosuid/Makefile +1 -1
@@ -4,4 +4,4 @@ LDLIBS += -lselinux all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) true
tests/notify/Makefile +1 -1
@@ -2,4 +2,4 @@ TARGETS=test_inotify test_fanotify all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -rf $(TARGETS) watch_me watch_dir
tests/open/Makefile +1 -1
@@ -2,4 +2,4 @@ TARGETS=append2write fopen all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) test_file
tests/ptrace/Makefile +1 -1
@@ -1,3 +1,3 @@ all: ptrace clean: - rm -f ptrace + rm -f ptrace flag
tests/readlink/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -f test_file test_symlink
tests/relabel/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -f test_file
tests/rename/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -rf src_dir dst_dir
tests/rxdir/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -rf test_dir
tests/sctp/Makefile +1 -1
@@ -10,6 +10,6 @@ LDLIBS += -lselinux -lsctp all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) flag $(TARGETS): $(DEPS)
tests/setattr/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -f test_file
tests/sigkill/Makefile +1 -1
@@ -1,3 +1,3 @@ all: server clean: - rm -f server + rm -f server flag
tests/stat/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -f test_file
tests/task_getpgid/Makefile +1 -1
@@ -1,3 +1,3 @@ all: source clean: - rm -f source + rm -f source flag
tests/task_getscheduler/Makefile +1 -1
@@ -1,3 +1,3 @@ all: source clean: - rm -f source + rm -f source flag
tests/task_getsid/Makefile +1 -1
@@ -1,3 +1,3 @@ all: source clean: - rm -f source + rm -f source flag
tests/task_setnice/Makefile +1 -0
@@ -1,2 +1,3 @@ all: clean: + rm -f flag
tests/task_setscheduler/Makefile +1 -1
@@ -1,3 +1,3 @@ all: source clean: - rm -f source + rm -f source flag
tests/unix_socket/Makefile +1 -1
@@ -4,4 +4,4 @@ LDLIBS+= -lselinux all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) flag test_client_sock test_server_sock
tests/vsock_socket/Makefile +1 -1
@@ -4,4 +4,4 @@ LDLIBS+= -lselinux all: $(TARGETS) clean: - rm -f $(TARGETS) + rm -f $(TARGETS) flag
Signature · 1 line
2.37.2
Quoted 38 lines · Ondrej Mosnacek
Building upon a similar cleanup being done in the binder test, remove any temporary files that may have been left behind by a failed or interrupted test run as part of 'make clean'.
For now, skip doing this for the filesystem/fs_filesystem tests, as those can leave behind directories with mounts, which are harder to clean up reliably.
Signed-off-by Ondrej Mosnacek <[email protected]>--- tests/bounds/Makefile | 2 +- tests/bpf/Makefile | 2 +- tests/capable_file/Makefile | 2 +- tests/entrypoint/Makefile | 1 + tests/execute_no_trans/Makefile | 1 + tests/fdreceive/Makefile | 2 +- tests/fdreceive/test | 4 +++- tests/file/Makefile | 2 +- tests/inet_socket/Makefile | 2 +- tests/inherit/Makefile | 2 +- tests/ioctl/Makefile | 2 +- tests/link/Makefile | 1 + tests/mac_admin/Makefile | 1 + tests/mkdir/Makefile | 1 + tests/mmap/Makefile | 2 +- tests/nnp_nosuid/Makefile | 2 +- tests/notify/Makefile | 2 +- tests/open/Makefile | 2 +- tests/ptrace/Makefile | 2 +- tests/readlink/Makefile | 1 + tests/relabel/Makefile | 1 + tests/rename/Makefile | 1 + tests/rxdir/Makefile | 1 + tests/sctp/Makefile | 2 +- tests/setattr/Makefile | 1 + tests/sigkill/Makefile | 2 +- tests/stat/Makefile | 1 +
Quoted 8 lines
tests/task_getpgid/Makefile | 2 +- tests/task_getscheduler/Makefile | 2 +- tests/task_getsid/Makefile | 2 +- tests/task_setnice/Makefile | 1 + tests/task_setscheduler/Makefile | 2 +- tests/unix_socket/Makefile | 2 +- tests/vsock_socket/Makefile | 2 +- 34 files changed, 36 insertions(+), 22 deletions(-)
Now applied as:
https://github.com/SELinuxProject/selinux-testsuite/commit/724807fba3c7a5946d50674961be8b9b2ec1535f
Signature · 3 lines
Ondrej Mosnacek Senior Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.