New upstream version 2018.9.1

This commit is contained in:
Simon McVittie committed 2018-10-30 10:59:22 +00:00
commit 854d02fbe3
49 files changed
+973 -356

No files matched your search

+30 -1
View File
@@ -21,7 +21,7 @@
set -euo pipefail
echo "1..$((83 + ${extra_basic_tests:-0}))"
echo "1..$((85 + ${extra_basic_tests:-0}))"
CHECKOUT_U_ARG=""
CHECKOUT_H_ARGS="-H"
@@ -694,6 +694,35 @@ for v in bin link; do
done
echo "ok checkout union identical conflicts"
cd ${test_tmpdir}
rm files -rf && mkdir files
touch files/anemptyfile
touch files/anotheremptyfile
$CMD_PREFIX ostree --repo=repo commit --consume -b tree-with-empty-files --tree=dir=files
$CMD_PREFIX ostree --repo=repo checkout ${CHECKOUT_H_ARGS} -z tree-with-empty-files tree-with-empty-files
if files_are_hardlinked tree-with-empty-files/an{,other}emptyfile; then
fatal "--force-copy-zerosized failed"
fi
rm tree-with-empty-files -rf
$CMD_PREFIX ostree --repo=repo checkout ${CHECKOUT_H_ARGS} tree-with-empty-files tree-with-empty-files
assert_files_hardlinked tree-with-empty-files/an{,other}emptyfile
rm tree-with-empty-files -rf
echo "ok checkout --force-copy-zerosized"
# These should merge, they're identical
$CMD_PREFIX ostree --repo=repo checkout ${CHECKOUT_H_ARGS} --union-identical -z tree-with-empty-files tree-with-empty-files
$CMD_PREFIX ostree --repo=repo checkout ${CHECKOUT_H_ARGS} --union-identical -z tree-with-empty-files tree-with-empty-files
echo notempty > tree-with-empty-files/anemptyfile.new && mv tree-with-empty-files/anemptyfile{.new,}
$CMD_PREFIX ostree --repo=repo commit --consume -b tree-with-conflicting-empty-files --tree=dir=tree-with-empty-files
# Reset back to base
rm tree-with-empty-files -rf
$CMD_PREFIX ostree --repo=repo checkout ${CHECKOUT_H_ARGS} --union-identical -z tree-with-empty-files tree-with-empty-files
if $CMD_PREFIX ostree --repo=repo checkout ${CHECKOUT_H_ARGS} --union-identical -z tree-with-conflicting-empty-files tree-with-empty-files 2>err.txt; then
fatal "--union-identical --force-copy-zerosized unexpectedly succeeded with non-identical files"
fi
assert_file_has_content err.txt 'error:.*File exists'
echo "ok checkout --union-identical --force-copy-zerosized"
cd ${test_tmpdir}
rm files -rf && mkdir files
mkdir files/worldwritable-dir
+49
View File
@@ -430,6 +430,54 @@ test_devino_cache_xattrs (void)
g_assert_cmpint (stats.content_objects_written, ==, 1);
}
/* https://github.com/ostreedev/ostree/issues/1721
* We should be able to commit large metadata objects now.
*/
static void
test_big_metadata (void)
{
g_autoptr(GError) error = NULL;
gboolean ret = FALSE;
g_autoptr(GFile) repo_path = g_file_new_for_path ("repo");
/* init as bare-user-only so we run everywhere */
ret = ot_test_run_libtest ("setup_test_repository bare-user-only", &error);
g_assert_no_error (error);
g_assert (ret);
g_autoptr(OstreeRepo) repo = ostree_repo_new (repo_path);
ret = ostree_repo_open (repo, NULL, &error);
g_assert_no_error (error);
g_assert (ret);
g_autoptr(GFile) object_to_commit = NULL;
ret = ostree_repo_read_commit (repo, "test2", &object_to_commit, NULL, NULL, &error);
g_assert_no_error (error);
g_assert (ret);
g_autoptr(OstreeMutableTree) mtree = ostree_mutable_tree_new ();
ret = ostree_repo_write_directory_to_mtree (repo, object_to_commit, mtree, NULL,
NULL, &error);
g_assert_no_error (error);
g_assert (ret);
const size_t len = 20 * 1024 * 1024;
g_assert_cmpint (len, >, OSTREE_MAX_METADATA_SIZE);
g_autofree char *large_buf = g_malloc (len);
memset (large_buf, 0x42, len);
g_autoptr(GVariantBuilder) builder =
g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
g_autofree char *commit_checksum = NULL;
g_variant_builder_add (builder, "{sv}", "large-value",
g_variant_new_fixed_array ((GVariantType*)"y",
large_buf, len, sizeof (char)));
ret = ostree_repo_write_commit (repo, NULL, NULL, NULL, g_variant_builder_end (builder),
OSTREE_REPO_FILE (object_to_commit), &commit_checksum, NULL, &error);
g_assert_no_error (error);
g_assert (ret);
}
int main (int argc, char **argv)
{
g_autoptr(GError) error = NULL;
@@ -447,6 +495,7 @@ int main (int argc, char **argv)
g_test_add_func ("/xattrs-devino-cache", test_devino_cache_xattrs);
g_test_add_func ("/break-hardlink", test_break_hardlink);
g_test_add_func ("/remotename", test_validate_remotename);
g_test_add_func ("/big-metadata", test_big_metadata);
return g_test_run();
out:
+5
View File
@@ -192,6 +192,11 @@ done
${CMD_PREFIX} ostree --repo=repo refs -A > refs.txt
assert_file_has_content_literal refs.txt 'exampleos/x86_64/stable/server -> exampleos/x86_64/27/server'
# Test that we don't delete a ref having aliases
if ${CMD_PREFIX} ostree --repo=repo refs --delete exampleos/x86_64/27/server; then
assert_not_reached "refs --delete unexpectedly succeeded in deleting a ref containing alias!"
fi
${CMD_PREFIX} ostree --repo=repo summary -u
echo "ok ref symlink"
+49
View File
@@ -151,6 +151,52 @@ test_repo_equal (Fixture *fixture,
g_assert_false (ostree_repo_equal (closed_repo, closed_repo));
}
static void
test_repo_get_min_free_space (Fixture *fixture,
gconstpointer test_data)
{
g_autoptr (GKeyFile) config = NULL;
g_autoptr(GError) error = NULL;
guint64 bytes = 0;
typedef struct
{
const char *val;
gboolean should_succeed;
} min_free_space_value;
g_autoptr(OstreeRepo) repo = ostree_repo_create_at (fixture->tmpdir.fd, ".",
OSTREE_REPO_MODE_ARCHIVE,
NULL,
NULL, &error);
g_assert_no_error (error);
min_free_space_value values_to_test[] = {
{"500MB", TRUE },
{ "0MB", TRUE },
{ "17179869185GB", FALSE }, /* Overflow parameter: bytes > G_MAXUINT64 */
{ NULL, FALSE }
};
config = ostree_repo_copy_config (repo);
for (guint i = 0; values_to_test[i].val != NULL; i++)
{
g_key_file_remove_key (config, "core", "min-free-space-size", NULL);
g_key_file_set_string (config, "core", "min-free-space-size", values_to_test[i].val);
ostree_repo_write_config (repo, config, &error);
g_assert_no_error (error);
ostree_repo_reload_config (repo, NULL, &error);
g_assert_no_error (error);
ostree_repo_get_min_free_space_bytes (repo, &bytes, &error);
if (values_to_test[i].should_succeed)
g_assert_no_error (error);
else
continue;
}
}
int
main (int argc,
char **argv)
@@ -164,6 +210,9 @@ main (int argc,
test_repo_hash_closed, teardown);
g_test_add ("/repo/equal", Fixture, NULL, setup,
test_repo_equal, teardown);
g_test_add ("/repo/get_min_free_space", Fixture, NULL, setup,
test_repo_get_min_free_space, teardown);
return g_test_run ();
}
+1 -1
View File
@@ -54,7 +54,7 @@ echo 'ok documented symbols'
# ONLY update this checksum in release commits!
cat > released-sha256.txt <<EOF
a34e3681f1705ed3c6fcf25238e486365cb5b53ffde905ba28a2954ef6eb0269 ${released_syms}
ae2946567160d4a47c8a7d000b87306895ee72cdd339e157d21c839e4b2c003a ${released_syms}
EOF
sha256sum -c released-sha256.txt