On 7/23/24 04:28, Abdulrasaq Lawani wrote:
The acct() system call enables or disables process accounting.
If accounting is turned on, records for each terminating process
are appended to a specified filename as it terminates. An argument of NULL
causes accounting to be turned off.

This patch will add a test for the acct() syscall.

Signed-off-by: Abdulrasaq Lawani <[email protected]>
---
Changes in v3:
- Add geteuid to check if test is ran as root.
- Simplify error conditions for acct function.
- Remove unecessary messages.
- Add more informative messages.
- Update commit message.
- Add error test case for file creation failure.
- Link to v2: 
https://lore.kernel.org/r/[email protected]

Changes in v2:
Add testcases to test error conditions.
Add kselftest function for reporting results.

- Link to v1: 
https://lore.kernel.org/r/[email protected]
---
  tools/testing/selftests/Makefile            |  1 +
  tools/testing/selftests/acct/.gitignore     |  3 ++
  tools/testing/selftests/acct/Makefile       |  4 ++
  tools/testing/selftests/acct/acct_syscall.c | 78 +++++++++++++++++++++++++++++
  4 files changed, 86 insertions(+)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 9039f3709aff..45a58ef5ad92 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -1,4 +1,5 @@
  # SPDX-License-Identifier: GPL-2.0
+TARGETS += acct
  TARGETS += alsa
  TARGETS += amd-pstate
  TARGETS += arm64
diff --git a/tools/testing/selftests/acct/.gitignore 
b/tools/testing/selftests/acct/.gitignore
new file mode 100644
index 000000000000..7e78aac19038
--- /dev/null
+++ b/tools/testing/selftests/acct/.gitignore
@@ -0,0 +1,3 @@
+acct_syscall
+config
+process_log
\ No newline at end of file
diff --git a/tools/testing/selftests/acct/Makefile 
b/tools/testing/selftests/acct/Makefile
new file mode 100644
index 000000000000..ff3e238c5634
--- /dev/null
+++ b/tools/testing/selftests/acct/Makefile
@@ -0,0 +1,4 @@

Missing SPDX-License-Identifier: GPL-2.0

The rest looks good to me. Please send v4 adding the SPDX
to acct/Makefile

thanks,
-- Shuah

Reply via email to