projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6e0a388
)
test: add really basic in_gid() test
author
Lennart Poettering
<lennart@poettering.net>
Thu, 31 Oct 2019 19:28:49 +0000
(20:28 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Thu, 31 Oct 2019 20:00:00 +0000
(21:00 +0100)
src/test/test-user-util.c
patch
|
blob
|
history
diff --git
a/src/test/test-user-util.c
b/src/test/test-user-util.c
index
9475b99
..
47baacb
100644
(file)
--- a/
src/test/test-user-util.c
+++ b/
src/test/test-user-util.c
@@
-286,6
+286,15
@@
static void test_make_salt(void) {
assert(!streq(s, t));
}
+static void test_in_gid(void) {
+
+ assert(in_gid(getgid()) >= 0);
+ assert(in_gid(getegid()) >= 0);
+
+ assert(in_gid(GID_INVALID) < 0);
+ assert(in_gid(TTY_GID) == 0); /* The TTY gid is for owning ttys, it would be really really weird if we were in it. */
+}
+
int main(int argc, char *argv[]) {
test_uid_to_name_one(0, "root");
test_uid_to_name_one(UID_NOBODY, NOBODY_USER_NAME);
@@
-320,5
+329,7
@@
int main(int argc, char *argv[]) {
test_make_salt();
+ test_in_gid();
+
return 0;
}