chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
34a3e4e
)
test-cap-list: always check libcap comes to the same names as we do, for the names...
author
Lennart Poettering
<lennart@poettering.net>
Fri, 12 Dec 2014 17:42:19 +0000
(18:42 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Fri, 12 Dec 2014 17:42:19 +0000
(18:42 +0100)
src/test/test-cap-list.c
patch
|
blob
|
history
diff --git
a/src/test/test-cap-list.c
b/src/test/test-cap-list.c
index a536522646ad78a59f30f584c374618dcdb9131c..238f876f2a1fb5b7ca870abac5ac83c80fd3e77d 100644
(file)
--- a/
src/test/test-cap-list.c
+++ b/
src/test/test-cap-list.c
@@
-45,5
+45,24
@@
int main(int argc, char *argv[]) {
assert_se(capability_from_name("15") == 15);
assert_se(capability_from_name("-1") == -EINVAL);
assert_se(capability_from_name("15") == 15);
assert_se(capability_from_name("-1") == -EINVAL);
+ for (i = 0; i <= (int) cap_last_cap(); i++) {
+ _cleanup_cap_free_charp_ char *a = NULL;
+ const char *b;
+ unsigned u;
+
+ assert_se(a = cap_to_name(i));
+
+ /* quite the loop as soon as libcap only returns
+ * numeric ids, formatted as string */
+ if (safe_atou(a, &u) >= 0)
+ break;
+
+ assert_se(b = capability_to_name(i));
+
+ printf("%s vs. %s\n", a, b);
+
+ assert_se(streq(a, b));
+ }
+
return 0;
}
return 0;
}