summaryrefslogtreecommitdiff
path: root/tests/test-repo.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2021-04-07 21:03:15 +0000
committerColin Walters <walters@verbum.org>2021-04-08 21:10:00 +0000
commitfce69cdf70ca959410ffd324ee978300cc72a5e0 (patch)
treecb0030610190b0375d5bf97766750a7a1aee33d0 /tests/test-repo.c
parent9332955b5f523b730cf332a8bd9619c40894bbe7 (diff)
downloadostree-fce69cdf70ca959410ffd324ee978300cc72a5e0.tar.gz
repo: Add ostree_repo_write_symlink
Continuation of the addition of `ostree_repo_write_regfile_inline()`. This will be helpful for ostree-rs-ext and importing from tar, it's quite inefficient and awkward for small files to end up creating a whole `GInputStream` and `GFileInfo` and etc. for small files.
Diffstat (limited to 'tests/test-repo.c')
-rw-r--r--tests/test-repo.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test-repo.c b/tests/test-repo.c
index ad81a7d6..35e929f9 100644
--- a/tests/test-repo.c
+++ b/tests/test-repo.c
@@ -236,6 +236,18 @@ test_write_regfile_api (Fixture *fixture,
g_assert_no_error (error);
g_assert_cmpstr (checksum, ==, "4f600d252338f93279c51c964915cb2c26f0d09082164c54890d1a3c78cdeb1e");
g_clear_pointer (&checksum, g_free);
+
+ // Test symlinks
+ g_clear_pointer (&xattrs, g_variant_unref);
+ g_variant_builder_init (&xattrs_builder, (GVariantType*)"a(ayay)");
+ g_variant_builder_add (&xattrs_builder, "(^ay^ay)", "security.selinux", "system_u:object_r:bin_t:s0");
+ g_clear_pointer (&xattrs, g_variant_unref);
+ xattrs = g_variant_ref_sink (g_variant_builder_end (&xattrs_builder));
+
+ g_clear_pointer (&checksum, g_free);
+ checksum = ostree_repo_write_symlink (repo, NULL, 0, 0, xattrs, "bash", NULL, &error);
+ g_assert_no_error (error);
+ g_assert_cmpstr (checksum, ==, "23a2e97d21d960ac7a4e39a8721b1baff7b213e00e5e5641334f50506012fcff");
}
int