diff options
author | Ivan Kruglov <mail@ikruglov.com> | 2024-04-10 13:19:39 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-04-15 08:13:50 +0200 |
commit | c79e88b37d3f8b94cdd2aeba1edbe09d06c08f7a (patch) | |
tree | 88c426bab7e104bc11ff4289e878bb676c083a9a /src/test/test-mount-util.c | |
parent | Merge pull request #32266 from yuwata/libsystemd-network-trivial-cleanups (diff) | |
download | systemd-c79e88b37d3f8b94cdd2aeba1edbe09d06c08f7a.tar.xz systemd-c79e88b37d3f8b94cdd2aeba1edbe09d06c08f7a.zip |
ASSERT_STREQ for simple cases
Diffstat (limited to 'src/test/test-mount-util.c')
-rw-r--r-- | src/test/test-mount-util.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/test/test-mount-util.c b/src/test/test-mount-util.c index 9bacc7b511..a2711f059e 100644 --- a/src/test/test-mount-util.c +++ b/src/test/test-mount-util.c @@ -43,44 +43,44 @@ TEST(mount_option_mangle) { assert_se(mount_option_mangle("ro,nosuid,nodev,noexec,mode=0755", 0, &f, &opts) == 0); assert_se(f == (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC)); - assert_se(streq(opts, "mode=0755")); + ASSERT_STREQ(opts, "mode=0755"); opts = mfree(opts); assert_se(mount_option_mangle("rw,nosuid,foo,hogehoge,nodev,mode=0755", 0, &f, &opts) == 0); assert_se(f == (MS_NOSUID|MS_NODEV)); - assert_se(streq(opts, "foo,hogehoge,mode=0755")); + ASSERT_STREQ(opts, "foo,hogehoge,mode=0755"); opts = mfree(opts); assert_se(mount_option_mangle("rw,nosuid,nodev,noexec,relatime,net_cls,net_prio", MS_RDONLY, &f, &opts) == 0); assert_se(f == (MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_RELATIME)); - assert_se(streq(opts, "net_cls,net_prio")); + ASSERT_STREQ(opts, "net_cls,net_prio"); opts = mfree(opts); assert_se(mount_option_mangle("rw,nosuid,nodev,relatime,size=1630748k,mode=0700,uid=1000,gid=1000", MS_RDONLY, &f, &opts) == 0); assert_se(f == (MS_NOSUID|MS_NODEV|MS_RELATIME)); - assert_se(streq(opts, "size=1630748k,mode=0700,uid=1000,gid=1000")); + ASSERT_STREQ(opts, "size=1630748k,mode=0700,uid=1000,gid=1000"); opts = mfree(opts); assert_se(mount_option_mangle("size=1630748k,rw,gid=1000,,,nodev,relatime,,mode=0700,nosuid,uid=1000", MS_RDONLY, &f, &opts) == 0); assert_se(f == (MS_NOSUID|MS_NODEV|MS_RELATIME)); - assert_se(streq(opts, "size=1630748k,gid=1000,mode=0700,uid=1000")); + ASSERT_STREQ(opts, "size=1630748k,gid=1000,mode=0700,uid=1000"); opts = mfree(opts); assert_se(mount_option_mangle("rw,exec,size=8143984k,nr_inodes=2035996,mode=0755", MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV, &f, &opts) == 0); assert_se(f == (MS_NOSUID|MS_NODEV)); - assert_se(streq(opts, "size=8143984k,nr_inodes=2035996,mode=0755")); + ASSERT_STREQ(opts, "size=8143984k,nr_inodes=2035996,mode=0755"); opts = mfree(opts); assert_se(mount_option_mangle("rw,relatime,fmask=0022,,,dmask=0022", MS_RDONLY, &f, &opts) == 0); assert_se(f == MS_RELATIME); - assert_se(streq(opts, "fmask=0022,dmask=0022")); + ASSERT_STREQ(opts, "fmask=0022,dmask=0022"); opts = mfree(opts); assert_se(mount_option_mangle("rw,relatime,fmask=0022,dmask=0022,\"hogehoge", MS_RDONLY, &f, &opts) < 0); assert_se(mount_option_mangle("mode=01777,size=10%,nr_inodes=400k,uid=496107520,gid=496107520,context=\"system_u:object_r:svirt_sandbox_file_t:s0:c0,c1\"", 0, &f, &opts) == 0); assert_se(f == 0); - assert_se(streq(opts, "mode=01777,size=10%,nr_inodes=400k,uid=496107520,gid=496107520,context=\"system_u:object_r:svirt_sandbox_file_t:s0:c0,c1\"")); + ASSERT_STREQ(opts, "mode=01777,size=10%,nr_inodes=400k,uid=496107520,gid=496107520,context=\"system_u:object_r:svirt_sandbox_file_t:s0:c0,c1\""); opts = mfree(opts); } @@ -91,7 +91,7 @@ static void test_mount_flags_to_string_one(unsigned long flags, const char *expe r = mount_flags_to_string(flags, &x); log_info("flags: %#lX → %d/\"%s\"", flags, r, strnull(x)); assert_se(r >= 0); - assert_se(streq(x, expected)); + ASSERT_STREQ(x, expected); } TEST(mount_flags_to_string) { |