New upstream version 2018.5

This commit is contained in:
Simon McVittie committed 2018-05-15 11:05:08 +01:00
commit 144d8ab093
74 files changed
+2347 -4165

No files matched your search

+19 -3
View File
@@ -21,7 +21,7 @@
set -euo pipefail
echo "1..$((23 + ${extra_admin_tests:-0}))"
echo "1..$((25 + ${extra_admin_tests:-0}))"
function validate_bootloader() {
cd ${test_tmpdir};
@@ -78,6 +78,12 @@ assert_ostree_deployment_refs 1/1/0
${CMD_PREFIX} ostree admin status
echo "ok layout"
if ${CMD_PREFIX} ostree admin deploy --stage --os=testos testos:testos/buildmaster/x86_64-runtime 2>err.txt; then
fatal "staged when not booted"
fi
assert_file_has_content_literal err.txt "Cannot stage a deployment when not currently booted into an OSTree system"
echo "ok staging does not work when not booted"
orig_mtime=$(stat -c '%.Y' sysroot/ostree/deploy)
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
new_mtime=$(stat -c '%.Y' sysroot/ostree/deploy)
@@ -147,8 +153,13 @@ ln -s /ENOENT sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-broken-syml
${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
assert_not_has_dir sysroot/boot/loader.0
assert_has_dir sysroot/boot/loader.1
linktarget=$(readlink sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-broken-symlink)
test "${linktarget}" = /ENOENT
link=sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-broken-symlink
if ! test -L ${link}; then
ls -al ${link}
fatal "Not a symlink: ${link}"
fi
linktarget=$(readlink ${link})
assert_streq "${linktarget}" /ENOENT
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-config-file 'a new local config file'
@@ -204,6 +215,11 @@ validate_bootloader
echo "ok upgrade bare"
os_repository_new_commit
if env OSTREE_EX_STAGE_DEPLOYMENTS=1 ${CMD_PREFIX} ostree admin upgrade --os=testos 2>err.txt; then
fatal "staged when not booted"
fi
echo "ok upgrade failed when staged"
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
${CMD_PREFIX} ostree admin upgrade --os=testos
origrev=${rev}
+1 -1
View File
@@ -851,7 +851,7 @@ $OSTREE show --print-metadata-key=ostree.ref-binding test2 > test2-ref-binding
assert_file_has_content test2-ref-binding 'test2'
$OSTREE commit ${COMMIT_ARGS} -b test2-unbound --no-bindings --tree=dir=${test_tmpdir}/checkout-test2
if $OSTREE show --print-metadata-key=ostree.ref-binding; then
if $OSTREE show --print-metadata-key=ostree.ref-binding test2-unbound; then
fatal "ref bindings found with --no-bindings?"
fi
echo "ok refbinding"
+1 -1
View File
@@ -491,7 +491,7 @@ os_repository_new_commit ()
echo "content iteration ${content_iteration}" > usr/bin/content-iteration
version=$(date "+%Y%m%d.${content_iteration}")
export version=$(date "+%Y%m%d.${content_iteration}")
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string "version=${version}" -b $branch -s "Build"
cd ${test_tmpdir}
+14 -1
View File
@@ -26,7 +26,7 @@ set -euo pipefail
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive" "syslinux"
echo "1..6"
echo "1..7"
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
@@ -64,6 +64,19 @@ assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-r
echo "ok manual cleanup"
# Commit + upgrade twice, so that we'll rotate out the original deployment
os_repository_new_commit "1"
${CMD_PREFIX} ostree admin upgrade --os=testos
oldversion=${version}
# another commit with *same* bootcsum but *new* content
os_repository_new_commit "1" "2"
newversion=${version}
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf ${oldversion}
${CMD_PREFIX} ostree admin upgrade --os=testos
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf ${newversion}
echo "ok new version same bootcsum"
assert_n_pinned() {
local n=$1
${CMD_PREFIX} ostree admin status > status.txt
-1
View File
@@ -44,7 +44,6 @@ subprocess.check_call(['ostree', '--repo=repo', 'init', '--mode=bare'])
# and we don't need xattr coverage for this
with open('repo/config', 'a') as f:
f.write('disable-xattrs=true\n')
f.write('locking=true\n')
def commit(v):
tdir='tree{}'.format(v)
+41 -1
View File
@@ -21,7 +21,7 @@
set -euo pipefail
echo "1..6"
echo "1..8"
. $(dirname $0)/libtest.sh
@@ -89,3 +89,43 @@ if ${CMD_PREFIX} ostree --repo=ostree-path-traverse/repo checkout pathtraverse-t
fi
assert_file_has_content_literal err.txt 'Invalid / in filename ../afile'
echo "ok path traverse checkout"
cd ${test_tmpdir}
rm repo files -rf
setup_test_repository "bare"
rev=$($OSTREE rev-parse test2)
filechecksum=$(ostree_file_path_to_checksum repo test2 /firstfile)
rm repo/$(ostree_checksum_to_relative_object_path repo $filechecksum)
assert_not_has_file repo/state/${rev}.commitpartial
if $OSTREE fsck -q 2>err.txt; then
assert_not_reached "fsck unexpectedly succeeded"
fi
assert_file_has_content_literal err.txt "Object missing:"
assert_file_has_content_literal err.txt "Marking commit as partial: $rev"
assert_has_file repo/state/${rev}.commitpartial
echo "ok missing file"
cd ${test_tmpdir}
rm repo files -rf
setup_test_repository "bare"
rev=$($OSTREE rev-parse test2)
filechecksum=$(ostree_file_path_to_checksum repo test2 /firstfile)
echo corrupted >> repo/$(ostree_checksum_to_relative_object_path repo $filechecksum)
assert_not_has_file repo/state/${rev}.commitpartial
if $OSTREE fsck -q --delete 2>err.txt; then
assert_not_reached "fsck unexpectedly succeeded"
fi
assert_file_has_content_literal err.txt "Corrupted file object;"
assert_file_has_content_literal err.txt "Marking commit as partial: $rev"
assert_has_file repo/state/${rev}.commitpartial
echo "ok corrupt file"
+5 -2
View File
@@ -94,9 +94,12 @@ assert_has_dir "dest-mount3/some-dest"
assert_symlink_has_content "dest-mount3/.ostree/repos.d/00-generated" "/some-dest$"
${CMD_PREFIX} ostree --repo=dest-mount3/.ostree/repos.d/00-generated refs --collections > dest-refs
assert_file_has_content dest-refs "^(org.example.Collection1, test-1)$"
assert_file_has_content dest-refs "^(org.example.Collection1, test-1)$"
assert_file_has_content dest-refs "^(org.example.Collection1, test-2)$"
assert_file_has_content dest-refs "^(org.example.Collection1, test-3)$"
assert_has_file dest-mount3/.ostree/repos.d/00-generated/summary
${CMD_PREFIX} ostree --repo=dest-mount3/.ostree/repos.d/00-generated summary -v > dest-summary
assert_file_has_content dest-summary "(org.example.Collection1, test-1)$"
assert_file_has_content dest-summary "(org.example.Collection1, test-2)$"
assert_file_has_content dest-summary "(org.example.Collection1, test-3)$"
echo "ok 4 adding ref to an existing usb"
+126
View File
@@ -303,6 +303,130 @@ test_repo_finder_config_mixed_configs (Fixture *fixture,
g_main_context_pop_thread_default (context);
}
/* Test that using ostree_repo_find_remotes_async() works too.*/
static void
test_repo_finder_config_find_remotes (Fixture *fixture,
gconstpointer test_data)
{
g_autoptr(OstreeRepoFinder) finder = NULL;
g_autoptr(GMainContext) context = NULL;
g_autoptr(GAsyncResult) result = NULL;
g_auto(OstreeRepoFinderResultv) results = NULL;
g_autoptr(GError) error = NULL;
gsize i;
const OstreeCollectionRef ref0 = { "org.example.Collection0", "exampleos/x86_64/ref0" };
const OstreeCollectionRef ref1 = { "org.example.Collection0", "exampleos/x86_64/ref1" };
const OstreeCollectionRef ref2 = { "org.example.Collection1", "exampleos/x86_64/ref1" };
const OstreeCollectionRef ref3 = { "org.example.Collection1", "exampleos/x86_64/ref2" };
const OstreeCollectionRef ref4 = { "org.example.Collection2", "exampleos/x86_64/ref3" };
const OstreeCollectionRef * const refs[] = { &ref0, &ref1, &ref2, &ref3, &ref4, NULL };
OstreeRepoFinder *finders[2] = {NULL, };
context = g_main_context_new ();
g_main_context_push_thread_default (context);
/* Put together various ref configuration files. */
g_autofree gchar *collection0_uri = assert_create_remote (fixture, "org.example.Collection0",
"exampleos/x86_64/ref0",
"exampleos/x86_64/ref1",
NULL);
g_autofree gchar *collection1_uri = assert_create_remote (fixture, "org.example.Collection1",
"exampleos/x86_64/ref2",
NULL);
g_autofree gchar *no_collection_uri = assert_create_remote (fixture, NULL,
"exampleos/x86_64/ref3",
NULL);
assert_create_remote_config (fixture->parent_repo, "remote0", collection0_uri, "org.example.Collection0");
assert_create_remote_config (fixture->parent_repo, "remote1", collection1_uri, "org.example.Collection1");
assert_create_remote_config (fixture->parent_repo, "remote0-copy", collection0_uri, "org.example.Collection0");
assert_create_remote_config (fixture->parent_repo, "remote1-bad-copy", collection1_uri, "org.example.NotCollection1");
assert_create_remote_config (fixture->parent_repo, "remote2", no_collection_uri, NULL);
finders[0] = OSTREE_REPO_FINDER (ostree_repo_finder_config_new ());
/* Resolve the refs. */
ostree_repo_find_remotes_async (fixture->parent_repo, refs,
NULL, finders,
NULL, NULL, result_cb, &result);
while (result == NULL)
g_main_context_iteration (context, TRUE);
results = ostree_repo_find_remotes_finish (fixture->parent_repo,
result, &error);
g_assert_no_error (error);
g_assert_nonnull (results);
g_assert_cmpuint (g_strv_length ((char **) results), ==, 3);
/* Check that the results are correct: the invalid refs should have been
* ignored, and the valid results canonicalised and deduplicated. */
for (i = 0; results[i] != NULL; i++)
{
const char *ref0_checksum, *ref1_checksum, *ref2_checksum, *ref3_checksum;
guint64 *ref0_timestamp, *ref1_timestamp, *ref2_timestamp, *ref3_timestamp;
if (g_strcmp0 (ostree_remote_get_name (results[i]->remote), "remote0") == 0 ||
g_strcmp0 (ostree_remote_get_name (results[i]->remote), "remote0-copy") == 0)
{
g_assert_cmpuint (g_hash_table_size (results[i]->ref_to_checksum), ==, 5);
ref0_checksum = g_hash_table_lookup (results[i]->ref_to_checksum, &ref0);
g_assert_true (ostree_validate_checksum_string (ref0_checksum, NULL));
ref1_checksum = g_hash_table_lookup (results[i]->ref_to_checksum, &ref1);
g_assert_true (ostree_validate_checksum_string (ref1_checksum, NULL));
ref2_checksum = g_hash_table_lookup (results[i]->ref_to_checksum, &ref2);
g_assert (ref2_checksum == NULL);
g_assert_cmpuint (g_hash_table_size (results[i]->ref_to_timestamp), ==, 5);
ref0_timestamp = g_hash_table_lookup (results[i]->ref_to_timestamp, &ref0);
*ref0_timestamp = GUINT64_FROM_BE (*ref0_timestamp);
g_assert_cmpuint (*ref0_timestamp, >, 0);
ref1_timestamp = g_hash_table_lookup (results[i]->ref_to_timestamp, &ref1);
*ref1_timestamp = GUINT64_FROM_BE (*ref1_timestamp);
g_assert_cmpuint (*ref1_timestamp, >, 0);
ref2_timestamp = g_hash_table_lookup (results[i]->ref_to_timestamp, &ref2);
*ref2_timestamp = GUINT64_FROM_BE (*ref2_timestamp);
g_assert_cmpuint (*ref2_timestamp, ==, 0);
g_assert_cmpstr (ostree_remote_get_url (results[i]->remote), ==, collection0_uri);
}
else if (g_strcmp0 (ostree_remote_get_name (results[i]->remote), "remote1") == 0)
{
g_assert_cmpuint (g_hash_table_size (results[i]->ref_to_checksum), ==, 5);
ref3_checksum = g_hash_table_lookup (results[i]->ref_to_checksum, &ref3);
g_assert_true (ostree_validate_checksum_string (ref3_checksum, NULL));
ref0_checksum = g_hash_table_lookup (results[i]->ref_to_checksum, &ref0);
g_assert (ref0_checksum == NULL);
g_assert_cmpuint (g_hash_table_size (results[i]->ref_to_timestamp), ==, 5);
ref3_timestamp = g_hash_table_lookup (results[i]->ref_to_timestamp, &ref3);
*ref3_timestamp = GUINT64_FROM_BE (*ref3_timestamp);
g_assert_cmpuint (*ref3_timestamp, >, 0);
ref0_timestamp = g_hash_table_lookup (results[i]->ref_to_timestamp, &ref0);
*ref0_timestamp = GUINT64_FROM_BE (*ref0_timestamp);
g_assert_cmpuint (*ref0_timestamp, ==, 0);
g_assert_cmpstr (ostree_remote_get_url (results[i]->remote), ==, collection1_uri);
}
else
{
g_assert_not_reached ();
}
}
g_main_context_pop_thread_default (context);
}
int main (int argc, char **argv)
{
setlocale (LC_ALL, "");
@@ -313,6 +437,8 @@ int main (int argc, char **argv)
test_repo_finder_config_no_configs, teardown);
g_test_add ("/repo-finder-config/mixed-configs", Fixture, NULL, setup,
test_repo_finder_config_mixed_configs, teardown);
g_test_add ("/repo-finder-config/find-remotes", Fixture, NULL, setup,
test_repo_finder_config_find_remotes, 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
d77bacdfe04f2a150e4d5e1637410e851c273b238468d820c0d2a168971900f3 ${released_syms}
60c9d53a0ab64f018ad51d835caf7aae27a3d50918ca8ac401fd49945ba636cc ${released_syms}
EOF
sha256sum -c released-sha256.txt