summaryrefslogtreecommitdiffstats
path: root/src/test/test-open-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test-open-file.c')
-rw-r--r--src/test/test-open-file.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/test/test-open-file.c b/src/test/test-open-file.c
index 4314d0d..22f58af 100644
--- a/src/test/test-open-file.c
+++ b/src/test/test-open-file.c
@@ -11,32 +11,32 @@ TEST(open_file_parse) {
r = open_file_parse("/proc/1/ns/mnt:host-mount-namespace:read-only", &of);
assert_se(r >= 0);
- assert_se(streq(of->path, "/proc/1/ns/mnt"));
- assert_se(streq(of->fdname, "host-mount-namespace"));
+ ASSERT_STREQ(of->path, "/proc/1/ns/mnt");
+ ASSERT_STREQ(of->fdname, "host-mount-namespace");
assert_se(of->flags == OPENFILE_READ_ONLY);
of = open_file_free(of);
r = open_file_parse("/proc/1/ns/mnt", &of);
assert_se(r >= 0);
- assert_se(streq(of->path, "/proc/1/ns/mnt"));
- assert_se(streq(of->fdname, "mnt"));
+ ASSERT_STREQ(of->path, "/proc/1/ns/mnt");
+ ASSERT_STREQ(of->fdname, "mnt");
assert_se(of->flags == 0);
of = open_file_free(of);
r = open_file_parse("/proc/1/ns/mnt:host-mount-namespace", &of);
assert_se(r >= 0);
- assert_se(streq(of->path, "/proc/1/ns/mnt"));
- assert_se(streq(of->fdname, "host-mount-namespace"));
+ ASSERT_STREQ(of->path, "/proc/1/ns/mnt");
+ ASSERT_STREQ(of->fdname, "host-mount-namespace");
assert_se(of->flags == 0);
of = open_file_free(of);
r = open_file_parse("/proc/1/ns/mnt::read-only", &of);
assert_se(r >= 0);
- assert_se(streq(of->path, "/proc/1/ns/mnt"));
- assert_se(streq(of->fdname, "mnt"));
+ ASSERT_STREQ(of->path, "/proc/1/ns/mnt");
+ ASSERT_STREQ(of->fdname, "mnt");
assert_se(of->flags == OPENFILE_READ_ONLY);
of = open_file_free(of);
@@ -53,16 +53,16 @@ TEST(open_file_parse) {
r = open_file_parse("/proc/1/ns/mnt:host-mount-namespace:append", &of);
assert_se(r >= 0);
- assert_se(streq(of->path, "/proc/1/ns/mnt"));
- assert_se(streq(of->fdname, "host-mount-namespace"));
+ ASSERT_STREQ(of->path, "/proc/1/ns/mnt");
+ ASSERT_STREQ(of->fdname, "host-mount-namespace");
assert_se(of->flags == OPENFILE_APPEND);
of = open_file_free(of);
r = open_file_parse("/proc/1/ns/mnt:host-mount-namespace:truncate", &of);
assert_se(r >= 0);
- assert_se(streq(of->path, "/proc/1/ns/mnt"));
- assert_se(streq(of->fdname, "host-mount-namespace"));
+ ASSERT_STREQ(of->path, "/proc/1/ns/mnt");
+ ASSERT_STREQ(of->fdname, "host-mount-namespace");
assert_se(of->flags == OPENFILE_TRUNCATE);
of = open_file_free(of);
@@ -89,16 +89,16 @@ TEST(open_file_parse) {
r = open_file_parse("/proc/1/ns/mnt:host-mount-namespace:graceful", &of);
assert_se(r >= 0);
- assert_se(streq(of->path, "/proc/1/ns/mnt"));
- assert_se(streq(of->fdname, "host-mount-namespace"));
+ ASSERT_STREQ(of->path, "/proc/1/ns/mnt");
+ ASSERT_STREQ(of->fdname, "host-mount-namespace");
assert_se(of->flags == OPENFILE_GRACEFUL);
of = open_file_free(of);
r = open_file_parse("/proc/1/ns/mnt:host-mount-namespace:read-only,graceful", &of);
assert_se(r >= 0);
- assert_se(streq(of->path, "/proc/1/ns/mnt"));
- assert_se(streq(of->fdname, "host-mount-namespace"));
+ ASSERT_STREQ(of->path, "/proc/1/ns/mnt");
+ ASSERT_STREQ(of->fdname, "host-mount-namespace");
assert_se(of->flags == (OPENFILE_READ_ONLY | OPENFILE_GRACEFUL));
of = open_file_free(of);
@@ -120,7 +120,7 @@ TEST(open_file_to_string) {
r = open_file_to_string(of, &s);
assert_se(r >= 0);
- assert_se(streq(s, "/proc/1/ns/mnt:host-mount-namespace:read-only"));
+ ASSERT_STREQ(s, "/proc/1/ns/mnt:host-mount-namespace:read-only");
s = mfree(s);
of->flags = OPENFILE_APPEND;
@@ -128,7 +128,7 @@ TEST(open_file_to_string) {
r = open_file_to_string(of, &s);
assert_se(r >= 0);
- assert_se(streq(s, "/proc/1/ns/mnt:host-mount-namespace:append"));
+ ASSERT_STREQ(s, "/proc/1/ns/mnt:host-mount-namespace:append");
s = mfree(s);
of->flags = OPENFILE_TRUNCATE;
@@ -136,7 +136,7 @@ TEST(open_file_to_string) {
r = open_file_to_string(of, &s);
assert_se(r >= 0);
- assert_se(streq(s, "/proc/1/ns/mnt:host-mount-namespace:truncate"));
+ ASSERT_STREQ(s, "/proc/1/ns/mnt:host-mount-namespace:truncate");
s = mfree(s);
of->flags = OPENFILE_GRACEFUL;
@@ -144,7 +144,7 @@ TEST(open_file_to_string) {
r = open_file_to_string(of, &s);
assert_se(r >= 0);
- assert_se(streq(s, "/proc/1/ns/mnt:host-mount-namespace:graceful"));
+ ASSERT_STREQ(s, "/proc/1/ns/mnt:host-mount-namespace:graceful");
s = mfree(s);
of->flags = OPENFILE_READ_ONLY | OPENFILE_GRACEFUL;
@@ -152,7 +152,7 @@ TEST(open_file_to_string) {
r = open_file_to_string(of, &s);
assert_se(r >= 0);
- assert_se(streq(s, "/proc/1/ns/mnt:host-mount-namespace:read-only,graceful"));
+ ASSERT_STREQ(s, "/proc/1/ns/mnt:host-mount-namespace:read-only,graceful");
s = mfree(s);
of->flags = 0;
@@ -160,7 +160,7 @@ TEST(open_file_to_string) {
r = open_file_to_string(of, &s);
assert_se(r >= 0);
- assert_se(streq(s, "/proc/1/ns/mnt:host-mount-namespace"));
+ ASSERT_STREQ(s, "/proc/1/ns/mnt:host-mount-namespace");
s = mfree(s);
assert_se(free_and_strdup(&of->fdname, "mnt"));
@@ -169,15 +169,15 @@ TEST(open_file_to_string) {
r = open_file_to_string(of, &s);
assert_se(r >= 0);
- assert_se(streq(s, "/proc/1/ns/mnt::read-only"));
+ ASSERT_STREQ(s, "/proc/1/ns/mnt::read-only");
s = mfree(s);
- assert_se(free_and_strdup(&of->path, "/path:with:colon") >= 0);
- assert_se(free_and_strdup(&of->fdname, "path:with:colon") >= 0);
+ ASSERT_OK(free_and_strdup(&of->path, "/path:with:colon"));
+ ASSERT_OK(free_and_strdup(&of->fdname, "path:with:colon"));
of->flags = 0;
- assert_se(open_file_to_string(of, &s) >= 0);
- assert_se(streq(s, "/path\\x3awith\\x3acolon"));
+ ASSERT_OK(open_file_to_string(of, &s));
+ ASSERT_STREQ(s, "/path\\x3awith\\x3acolon");
}
DEFINE_TEST_MAIN(LOG_INFO);