[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200312131531.3615556-1-christian.brauner@ubuntu.com>
Date: Thu, 12 Mar 2020 14:15:29 +0100
From: Christian Brauner <christian.brauner@...ntu.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Todd Kjos <tkjos@...roid.com>
Cc: ard.biesheuvel@...aro.org, ardb@...nel.org, john.stultz@...aro.org,
keescook@...omium.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, naresh.kamboju@...aro.org,
shuah@...nel.org,
Arve Hjønnevåg <arve@...roid.com>,
Martijn Coenen <maco@...roid.com>,
Joel Fernandes <joel@...lfernandes.org>, hridya@...gle.com,
kernel-team@...roid.com,
Christian Brauner <christian.brauner@...ntu.com>
Subject: [PATCH 1/3] binderfs: port tests to test harness infrastructure
Makes for nicer output and prepares for additional tests.
Signed-off-by: Christian Brauner <christian.brauner@...ntu.com>
---
.../selftests/filesystems/binderfs/Makefile | 2 ++
.../filesystems/binderfs/binderfs_test.c | 16 ++++++----------
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/tools/testing/selftests/filesystems/binderfs/Makefile b/tools/testing/selftests/filesystems/binderfs/Makefile
index 58cb659b56b4..75315d9ba7a9 100644
--- a/tools/testing/selftests/filesystems/binderfs/Makefile
+++ b/tools/testing/selftests/filesystems/binderfs/Makefile
@@ -3,4 +3,6 @@
CFLAGS += -I../../../../../usr/include/
TEST_GEN_PROGS := binderfs_test
+binderfs_test: binderfs_test.c ../../kselftest.h ../../kselftest_harness.h
+
include ../../lib.mk
diff --git a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
index 8c2ed962e1c7..d03ed8eed5eb 100644
--- a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
+++ b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
@@ -15,7 +15,9 @@
#include <unistd.h>
#include <linux/android/binder.h>
#include <linux/android/binderfs.h>
+
#include "../../kselftest.h"
+#include "../../kselftest_harness.h"
static ssize_t write_nointr(int fd, const void *buf, size_t count)
{
@@ -252,24 +254,18 @@ static void __do_binderfs_test(void)
ksft_inc_pass_cnt();
}
-static void binderfs_test_privileged()
+TEST(binderfs_test_privileged)
{
if (geteuid() != 0)
- ksft_print_msg(
- "Tests are not run as root. Skipping privileged tests\n");
+ ksft_print_msg("Tests are not run as root. Skipping privileged tests\n");
else
__do_binderfs_test();
}
-static void binderfs_test_unprivileged()
+TEST(binderfs_test_unprivileged)
{
change_to_userns();
__do_binderfs_test();
}
-int main(int argc, char *argv[])
-{
- binderfs_test_privileged();
- binderfs_test_unprivileged();
- ksft_exit_pass();
-}
+TEST_HARNESS_MAIN
base-commit: 2c523b344dfa65a3738e7039832044aa133c75fb
--
2.25.1
Powered by blists - more mailing lists