From b2c393c120e9901381bedf9973453e64c73c95a4 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Fri, 19 Feb 2021 19:07:04 +0000 Subject: [PATCH] Add test coverage for the code path touched in the previous commit Signed-off-by: Simon McVittie <smcv@collabora.com> --- tests/pressure-vessel/resolve-in-sysroot.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/pressure-vessel/resolve-in-sysroot.c b/tests/pressure-vessel/resolve-in-sysroot.c index b57839996..ec6e928a9 100644 --- a/tests/pressure-vessel/resolve-in-sysroot.c +++ b/tests/pressure-vessel/resolve-in-sysroot.c @@ -120,6 +120,7 @@ test_resolve_in_sysroot (Fixture *f, { "a/b/symlink_to_c", "c" }, { "a/b/symlink_to_b2", "../b2" }, { "a/b/symlink_to_c2", "../../a/b2/c2" }, + { "a/b/symlink_to_itself", "." }, { "a/b/abs_symlink_to_run", "/run" }, { "a/b/long_symlink_to_dev", "../../../../../../../../../../../dev" }, { "x", "create_me" }, @@ -178,6 +179,15 @@ test_resolve_in_sysroot (Fixture *f, { { "a/b/symlink_to_b2" }, { "a/b2" } }, { { "a/b/symlink_to_c2" }, { "a/b2/c2" } }, { { "a/b/abs_symlink_to_run" }, { NULL, G_IO_ERROR_NOT_FOUND } }, + { + { "a/b/symlink_to_itself", SRT_RESOLVE_FLAGS_KEEP_FINAL_SYMLINK }, + { "a/b/symlink_to_itself" }, + }, + { + { "a/b/symlink_to_itself", + SRT_RESOLVE_FLAGS_KEEP_FINAL_SYMLINK|SRT_RESOLVE_FLAGS_READABLE }, + { NULL, G_IO_ERROR_TOO_MANY_LINKS }, + }, { { "a/b/abs_symlink_to_run", SRT_RESOLVE_FLAGS_KEEP_FINAL_SYMLINK }, { "a/b/abs_symlink_to_run" } @@ -282,6 +292,7 @@ test_resolve_in_sysroot (Fixture *f, else { g_assert_error (error, G_IO_ERROR, it->expect.code); + g_test_message ("Got error as expected: %s", error->message); g_assert_cmpint (fd, ==, -1); if (out_path != NULL) -- GitLab