From: Carlos Llamas <cmllamas@google.com>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Todd Kjos" <tkjos@android.com>,
"Martijn Coenen" <maco@android.com>,
"Christian Brauner" <christian@brauner.io>
Cc: Joel Fernandes <joel@joelfernandes.org>,
Steven Moreland <smoreland@google.com>,
kernel-team@android.com, linux-kernel@vger.kernel.org,
Carlos Llamas <cmllamas@google.com>
Subject: [PATCH v2 3/3] selftests/binderfs: add test for feature files
Date: Thu, 15 Jul 2021 03:18:05 +0000 [thread overview]
Message-ID: <20210715031805.1725878-3-cmllamas@google.com> (raw)
In-Reply-To: <20210715031805.1725878-1-cmllamas@google.com>
Verify that feature files are created successfully after mounting a
binderfs instance. Note that only "oneway_spam_detection" feature is
tested with this patch as it is currently the only feature listed.
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
.../filesystems/binderfs/binderfs_test.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
index 477cbb042f5b..0315955ff0f4 100644
--- a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
+++ b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
@@ -62,6 +62,9 @@ static int __do_binderfs_test(struct __test_metadata *_metadata)
struct binder_version version = { 0 };
char binderfs_mntpt[] = P_tmpdir "/binderfs_XXXXXX",
device_path[sizeof(P_tmpdir "/binderfs_XXXXXX/") + BINDERFS_MAX_NAME];
+ static const char * const binder_features[] = {
+ "oneway_spam_detection",
+ };
change_mountns(_metadata);
@@ -150,6 +153,20 @@ static int __do_binderfs_test(struct __test_metadata *_metadata)
}
/* success: binder-control device removal failed as expected */
+
+ for (int i = 0; i < ARRAY_SIZE(binder_features); i++) {
+ snprintf(device_path, sizeof(device_path), "%s/features/%s",
+ binderfs_mntpt, binder_features[i]);
+ fd = open(device_path, O_CLOEXEC | O_RDONLY);
+ EXPECT_GE(fd, 0) {
+ TH_LOG("%s - Failed to open binder feature: %s",
+ strerror(errno), binder_features[i]);
+ goto umount;
+ }
+ close(fd);
+ }
+
+ /* success: binder feature files found */
result = 0;
umount:
--
2.32.0.93.g670b81a890-goog
next prev parent reply other threads:[~2021-07-15 3:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 16:24 [PATCH] ANDROID: binderfs: add capabilities support Carlos Llamas
2021-07-07 16:59 ` Greg Kroah-Hartman
2021-07-08 16:33 ` Carlos Llamas
2021-07-09 8:39 ` Christian Brauner
2021-07-09 8:55 ` Christian Brauner
2021-07-09 16:32 ` Carlos Llamas
2021-07-15 3:18 ` [PATCH v2 1/3] binderfs: add support for feature files Carlos Llamas
2021-07-15 3:18 ` [PATCH v2 2/3] docs: binderfs: add section about " Carlos Llamas
2021-07-15 8:08 ` Christian Brauner
2021-07-15 3:18 ` Carlos Llamas [this message]
2021-07-15 8:09 ` [PATCH v2 3/3] selftests/binderfs: add test for " Christian Brauner
2021-07-15 8:07 ` [PATCH v2 1/3] binderfs: add support " Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210715031805.1725878-3-cmllamas@google.com \
--to=cmllamas@google.com \
--cc=arve@android.com \
--cc=christian@brauner.io \
--cc=gregkh@linuxfoundation.org \
--cc=joel@joelfernandes.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
--cc=smoreland@google.com \
--cc=tkjos@android.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox