diff mbox series

[testsuite] tests: remove more stray flag/temporary files with 'make clean'

Message ID 20220826082948.30747-1-omosnace@redhat.com (mailing list archive)
State Accepted
Delegated to: Ondrej Mosnáček
Headers show
Series [testsuite] tests: remove more stray flag/temporary files with 'make clean' | expand

Commit Message

Ondrej Mosnacek Aug. 26, 2022, 8:29 a.m. UTC
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 <omosnace@redhat.com>
---
 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(-)

Comments

Ondrej Mosnacek Aug. 30, 2022, 11:15 a.m. UTC | #1
On Fri, Aug 26, 2022 at 10:29 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> 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 <omosnace@redhat.com>
> ---
>  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(-)

Now applied as:
https://github.com/SELinuxProject/selinux-testsuite/commit/724807fba3c7a5946d50674961be8b9b2ec1535f
diff mbox series

Patch

diff --git a/tests/bounds/Makefile b/tests/bounds/Makefile
index 0e671ac..cd65b68 100644
--- a/tests/bounds/Makefile
+++ b/tests/bounds/Makefile
@@ -4,4 +4,4 @@  LDLIBS += -lselinux -lpthread
 
 all: $(TARGETS)
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) bounds_file*
diff --git a/tests/bpf/Makefile b/tests/bpf/Makefile
index 6fb230d..1ae8ce9 100644
--- a/tests/bpf/Makefile
+++ b/tests/bpf/Makefile
@@ -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)
diff --git a/tests/capable_file/Makefile b/tests/capable_file/Makefile
index 42a18c8..794cade 100644
--- a/tests/capable_file/Makefile
+++ b/tests/capable_file/Makefile
@@ -1,5 +1,5 @@ 
 TARGETS=$(patsubst %.c,%,$(wildcard *.c))
 all: $(TARGETS)
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) temp_file temp_file2
 
diff --git a/tests/entrypoint/Makefile b/tests/entrypoint/Makefile
index e7c006f..c99e0db 100644
--- a/tests/entrypoint/Makefile
+++ b/tests/entrypoint/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -f true
diff --git a/tests/execute_no_trans/Makefile b/tests/execute_no_trans/Makefile
index e7c006f..c99e0db 100644
--- a/tests/execute_no_trans/Makefile
+++ b/tests/execute_no_trans/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -f true
diff --git a/tests/fdreceive/Makefile b/tests/fdreceive/Makefile
index 895f91c..d9f8927 100644
--- a/tests/fdreceive/Makefile
+++ b/tests/fdreceive/Makefile
@@ -8,6 +8,6 @@  endif
 all: $(TARGETS)
 
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) test_file test_file2 test_sock flag
 
 client: $(DEPS)
diff --git a/tests/fdreceive/test b/tests/fdreceive/test
index 51cf132..1eaf0f7 100755
--- a/tests/fdreceive/test
+++ b/tests/fdreceive/test
@@ -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");
diff --git a/tests/file/Makefile b/tests/file/Makefile
index a9ff509..8619b32 100644
--- a/tests/file/Makefile
+++ b/tests/file/Makefile
@@ -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
diff --git a/tests/inet_socket/Makefile b/tests/inet_socket/Makefile
index 5bfd561..2dbfe7b 100644
--- a/tests/inet_socket/Makefile
+++ b/tests/inet_socket/Makefile
@@ -4,4 +4,4 @@  LDLIBS+= -lselinux
 
 all: $(TARGETS)
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) flag
diff --git a/tests/inherit/Makefile b/tests/inherit/Makefile
index f7f4133..7c12ab3 100644
--- a/tests/inherit/Makefile
+++ b/tests/inherit/Makefile
@@ -4,4 +4,4 @@  LDLIBS += -lselinux
 
 all: $(TARGETS)
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) test_file
diff --git a/tests/ioctl/Makefile b/tests/ioctl/Makefile
index 8dce555..53e4ec3 100644
--- a/tests/ioctl/Makefile
+++ b/tests/ioctl/Makefile
@@ -1,4 +1,4 @@ 
 TARGETS=$(patsubst %.c,%,$(wildcard *.c))
 all: $(TARGETS)
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) temp_file
diff --git a/tests/link/Makefile b/tests/link/Makefile
index e7c006f..85456cf 100644
--- a/tests/link/Makefile
+++ b/tests/link/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -rf test_dir
diff --git a/tests/mac_admin/Makefile b/tests/mac_admin/Makefile
index e7c006f..8fe1321 100644
--- a/tests/mac_admin/Makefile
+++ b/tests/mac_admin/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -rf test_dir test_file
diff --git a/tests/mkdir/Makefile b/tests/mkdir/Makefile
index e7c006f..85456cf 100644
--- a/tests/mkdir/Makefile
+++ b/tests/mkdir/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -rf test_dir
diff --git a/tests/mmap/Makefile b/tests/mmap/Makefile
index e330f3e..917a754 100644
--- a/tests/mmap/Makefile
+++ b/tests/mmap/Makefile
@@ -5,4 +5,4 @@  LDLIBS += -lpthread
 all: $(TARGETS)
 
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) temp_file
diff --git a/tests/nnp_nosuid/Makefile b/tests/nnp_nosuid/Makefile
index 4e8e400..434f3c0 100644
--- a/tests/nnp_nosuid/Makefile
+++ b/tests/nnp_nosuid/Makefile
@@ -4,4 +4,4 @@  LDLIBS += -lselinux
 
 all: $(TARGETS)
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) true
diff --git a/tests/notify/Makefile b/tests/notify/Makefile
index d237338..0c2564c 100644
--- a/tests/notify/Makefile
+++ b/tests/notify/Makefile
@@ -2,4 +2,4 @@  TARGETS=test_inotify test_fanotify
 
 all: $(TARGETS)
 clean:
-	rm -f $(TARGETS)
+	rm -rf $(TARGETS) watch_me watch_dir
diff --git a/tests/open/Makefile b/tests/open/Makefile
index 7c3c9c4..dc56899 100644
--- a/tests/open/Makefile
+++ b/tests/open/Makefile
@@ -2,4 +2,4 @@  TARGETS=append2write fopen
 
 all: $(TARGETS)
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) test_file
diff --git a/tests/ptrace/Makefile b/tests/ptrace/Makefile
index a1a4e35..8872c6c 100644
--- a/tests/ptrace/Makefile
+++ b/tests/ptrace/Makefile
@@ -1,3 +1,3 @@ 
 all: ptrace
 clean:
-	rm -f ptrace
+	rm -f ptrace flag
diff --git a/tests/readlink/Makefile b/tests/readlink/Makefile
index e7c006f..b6b8848 100644
--- a/tests/readlink/Makefile
+++ b/tests/readlink/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -f test_file test_symlink
diff --git a/tests/relabel/Makefile b/tests/relabel/Makefile
index e7c006f..88c9ac5 100644
--- a/tests/relabel/Makefile
+++ b/tests/relabel/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -f test_file
diff --git a/tests/rename/Makefile b/tests/rename/Makefile
index e7c006f..adc84df 100644
--- a/tests/rename/Makefile
+++ b/tests/rename/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -rf src_dir dst_dir
diff --git a/tests/rxdir/Makefile b/tests/rxdir/Makefile
index e7c006f..85456cf 100644
--- a/tests/rxdir/Makefile
+++ b/tests/rxdir/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -rf test_dir
diff --git a/tests/sctp/Makefile b/tests/sctp/Makefile
index 5e03650..c77b919 100644
--- a/tests/sctp/Makefile
+++ b/tests/sctp/Makefile
@@ -10,6 +10,6 @@  LDLIBS += -lselinux -lsctp
 all: $(TARGETS)
 
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) flag
 
 $(TARGETS): $(DEPS)
diff --git a/tests/setattr/Makefile b/tests/setattr/Makefile
index e7c006f..88c9ac5 100644
--- a/tests/setattr/Makefile
+++ b/tests/setattr/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -f test_file
diff --git a/tests/sigkill/Makefile b/tests/sigkill/Makefile
index 1aa01ef..a055b24 100644
--- a/tests/sigkill/Makefile
+++ b/tests/sigkill/Makefile
@@ -1,3 +1,3 @@ 
 all: server
 clean:
-	rm -f server
+	rm -f server flag
diff --git a/tests/stat/Makefile b/tests/stat/Makefile
index e7c006f..88c9ac5 100644
--- a/tests/stat/Makefile
+++ b/tests/stat/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -f test_file
diff --git a/tests/task_getpgid/Makefile b/tests/task_getpgid/Makefile
index 20e1e63..79501b4 100644
--- a/tests/task_getpgid/Makefile
+++ b/tests/task_getpgid/Makefile
@@ -1,3 +1,3 @@ 
 all: source
 clean:
-	rm -f source
+	rm -f source flag
diff --git a/tests/task_getscheduler/Makefile b/tests/task_getscheduler/Makefile
index 20e1e63..79501b4 100644
--- a/tests/task_getscheduler/Makefile
+++ b/tests/task_getscheduler/Makefile
@@ -1,3 +1,3 @@ 
 all: source
 clean:
-	rm -f source
+	rm -f source flag
diff --git a/tests/task_getsid/Makefile b/tests/task_getsid/Makefile
index 20e1e63..79501b4 100644
--- a/tests/task_getsid/Makefile
+++ b/tests/task_getsid/Makefile
@@ -1,3 +1,3 @@ 
 all: source
 clean:
-	rm -f source
+	rm -f source flag
diff --git a/tests/task_setnice/Makefile b/tests/task_setnice/Makefile
index e7c006f..e6a3be0 100644
--- a/tests/task_setnice/Makefile
+++ b/tests/task_setnice/Makefile
@@ -1,2 +1,3 @@ 
 all:
 clean:
+	rm -f flag
diff --git a/tests/task_setscheduler/Makefile b/tests/task_setscheduler/Makefile
index 20e1e63..79501b4 100644
--- a/tests/task_setscheduler/Makefile
+++ b/tests/task_setscheduler/Makefile
@@ -1,3 +1,3 @@ 
 all: source
 clean:
-	rm -f source
+	rm -f source flag
diff --git a/tests/unix_socket/Makefile b/tests/unix_socket/Makefile
index 51ba2c6..f8db20b 100644
--- a/tests/unix_socket/Makefile
+++ b/tests/unix_socket/Makefile
@@ -4,4 +4,4 @@  LDLIBS+= -lselinux
 
 all: $(TARGETS)
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) flag test_client_sock test_server_sock
diff --git a/tests/vsock_socket/Makefile b/tests/vsock_socket/Makefile
index 5266096..7802552 100644
--- a/tests/vsock_socket/Makefile
+++ b/tests/vsock_socket/Makefile
@@ -4,4 +4,4 @@  LDLIBS+= -lselinux
 
 all: $(TARGETS)
 clean:
-	rm -f $(TARGETS)
+	rm -f $(TARGETS) flag