New upstream version 2016.8

This commit is contained in:
Simon McVittie committed 2016-09-06 09:01:54 +01:00
commit ba02f3eb2f
250 files changed
+80671 -11685

No files matched your search

-14
View File
@@ -1,14 +0,0 @@
!Makefile
ostree-http-server
run-apache
tmpdir-lifecycle
test-rollsum
test-bsdiff
test-checksum
test-gpg-verify-result
test-keyfile-utils
test-mutable-tree
test-ot-opt-utils
test-ot-tool-util
test-ot-unix-utils
test-rollsum-cli
+39 -30
View File
@@ -19,7 +19,7 @@
set -euo pipefail
echo "1..57"
echo "1..58"
$OSTREE checkout test2 checkout-test2
echo "ok checkout"
@@ -41,6 +41,12 @@ echo "ok shortened checksum"
(cd repo && ${CMD_PREFIX} ostree rev-parse test2)
echo "ok repo-in-cwd"
rm test-repo -rf
$OSTREE --repo=test-repo init --mode=bare-user
$OSTREE --repo=test-repo init --mode=bare-user
rm test-repo -rf
echo "ok repo-init on existing repo"
cd checkout-test2
assert_has_file firstfile
assert_has_file baz/cow
@@ -446,38 +452,41 @@ echo "ok test error pre commit/bootid"
# Whiteouts
cd ${test_tmpdir}
mkdir -p overlay/baz/
touch overlay/baz/.wh.cow
touch overlay/.wh.deeper
touch overlay/anewfile
mkdir overlay/anewdir/
touch overlay/anewdir/blah
$OSTREE --repo=repo commit -b overlay -s 'overlay' --tree=dir=overlay
rm overlay -rf
if touch overlay/baz/.wh.cow && touch overlay/.wh.deeper; then
touch overlay/anewfile
mkdir overlay/anewdir/
touch overlay/anewdir/blah
$OSTREE --repo=repo commit -b overlay -s 'overlay' --tree=dir=overlay
rm overlay -rf
for branch in test2 overlay; do
$OSTREE --repo=repo checkout --union --whiteouts ${branch} overlay-co
done
for f in .wh.deeper baz/cow baz/.wh.cow; do
assert_not_has_file overlay-co/${f}
done
assert_not_has_dir overlay-co/deeper
assert_has_file overlay-co/anewdir/blah
assert_has_file overlay-co/anewfile
for branch in test2 overlay; do
$OSTREE --repo=repo checkout --union --whiteouts ${branch} overlay-co
done
for f in .wh.deeper baz/cow baz/.wh.cow; do
assert_not_has_file overlay-co/${f}
done
assert_not_has_dir overlay-co/deeper
assert_has_file overlay-co/anewdir/blah
assert_has_file overlay-co/anewfile
echo "ok whiteouts enabled"
echo "ok whiteouts enabled"
# Now double check whiteouts are not processed without --whiteouts
rm overlay-co -rf
for branch in test2 overlay; do
$OSTREE --repo=repo checkout --union ${branch} overlay-co
done
for f in .wh.deeper baz/cow baz/.wh.cow; do
assert_has_file overlay-co/${f}
done
assert_not_has_dir overlay-co/deeper
assert_has_file overlay-co/anewdir/blah
assert_has_file overlay-co/anewfile
echo "ok whiteouts disabled"
# Now double check whiteouts are not processed without --whiteouts
rm overlay-co -rf
for branch in test2 overlay; do
$OSTREE --repo=repo checkout --union ${branch} overlay-co
done
for f in .wh.deeper baz/cow baz/.wh.cow; do
assert_has_file overlay-co/${f}
done
assert_not_has_dir overlay-co/deeper
assert_has_file overlay-co/anewdir/blah
assert_has_file overlay-co/anewfile
echo "ok whiteouts disabled"
else
echo "ok # SKIP whiteouts do not work, are you using aufs?"
echo "ok # SKIP whiteouts do not work, are you using aufs?"
fi
cd ${test_tmpdir}
rm -rf test2-checkout
-535
View File
@@ -1,535 +0,0 @@
# This GLib suppressions file is known to be used at least by:
#
# - rpm-software-management/libhif
#
# Please use the upstream verison in libhif for changes.
{
gobject_init_1
Memcheck:Leak
...
fun:gobject_init
}
{
g_type_register_static_1
Memcheck:Leak
...
fun:g_type_register_static
}
{
g_type_register_fundamental
Memcheck:Leak
...
fun:g_type_register_fundamental
}
{
g_type_init_with_debug_flags
Memcheck:Leak
...
fun:g_type_init_with_debug_flags
}
{
g_type_class_ref_1
Memcheck:Leak
...
fun:type_iface_vtable_base_init_Wm
...
fun:g_type_class_ref
}
{
g_type_class_ref_2
Memcheck:Leak
...
fun:type_class_init_Wm
...
fun:g_type_class_ref
}
{
g_type_add_interface_static
Memcheck:Leak
...
fun:g_type_add_interface_static
}
{
g_param_spec_internal
Memcheck:Leak
...
fun:g_type_class_ref
fun:g_type_create_instance
fun:g_param_spec_internal
}
{
g_param_spec_enum
Memcheck:Leak
...
fun:g_type_class_ref
fun:g_param_spec_enum
}
{
g_param_spec_flags
Memcheck:Leak
...
fun:g_type_class_ref
fun:g_param_spec_flags
}
{
g_quark_from_static_string
Memcheck:Leak
...
fun:g_quark_from_static_string
}
{
g_quark_from_string
Memcheck:Leak
...
fun:g_quark_from_string
}
{
g_value_register_transform_func
Memcheck:Leak
...
fun:g_value_register_transform_func
}
{
test_run_seed
Memcheck:Leak
...
fun:g_rand_new_with_seed_array
fun:test_run_seed
...
fun:g_test_run_suite
}
{
g_test_init
Memcheck:Leak
...
fun:g_rand_new_with_seed_array
...
fun:g_test_init
}
{
g_intern_static_string
Memcheck:Leak
...
fun:g_intern_static_string
}
{
g_main_context_push_thread_default
Memcheck:Leak
...
fun:g_queue_new
fun:g_main_context_push_thread_default
}
{
g_main_context_push_thread_default_inlined
Memcheck:Leak
...
fun:g_slice_alloc0
fun:g_main_context_push_thread_default
}
{
g_dbus_error_register_error
Memcheck:Leak
...
fun:g_dbus_error_register_error
}
{
g_param_spec_pool_insert
Memcheck:Leak
...
fun:g_param_spec_pool_insert
}
{
g_main_context_default
Memcheck:Leak
...
fun:g_main_context_default
}
{
g_main_context_check
Memcheck:Leak
...
fun:g_ptr_array_add
fun:g_main_context_check
}
{
g_test_run_suite
Memcheck:Leak
...
fun:g_slist_copy
fun:g_test_run_suite_internal
fun:g_test_run_suite
}
{
g_dbus_interface_info_cache_build
Memcheck:Leak
...
fun:g_dbus_interface_info_cache_build
}
{
g_cancellable_push_current
Memcheck:Leak
...
fun:thread_memory_from_self
...
fun:g_cancellable_push_current
}
{
_g_io_module_get_default
Memcheck:Leak
...
fun:g_io_module_new
fun:g_io_modules_scan_all_in_directory_with_scope
fun:_g_io_modules_ensure_loaded
fun:_g_io_module_get_default
}
{
g_io_scheduler_push_job
Memcheck:Leak
...
fun:init_scheduler
fun:g_once_impl
fun:g_io_scheduler_push_job
}
{
g_io_scheduler_push_job_2
Memcheck:Leak
...
fun:g_system_thread_new
...
fun:g_io_scheduler_push_job
}
{
g_bus_get_sync__available_connections
Memcheck:Leak
...
fun:g_hash_table_new
fun:initable_init
fun:g_initable_init
fun:g_bus_get_sync
}
{
g_socket_connection_factory_register_type
Memcheck:Leak
...
fun:g_socket_connection_factory_register_type
}
{
g_test_add_vtable
Memcheck:Leak
...
fun:g_test_add_vtable
}
{
g_mutex_lock
Memcheck:Leak
...
fun:g_mutex_impl_new
fun:g_mutex_get_impl
fun:g_mutex_lock
}
{
g_thread_self
Memcheck:Leak
...
fun:g_thread_self
}
{
g_rec_mutex_lock
Memcheck:Leak
...
fun:g_rec_mutex_impl_new
fun:g_rec_mutex_get_impl
fun:g_rec_mutex_lock
}
{
test_case_run
Memcheck:Leak
...
fun:g_malloc0
fun:test_case_run
...
fun:g_test_run_suite
}
{
g_get_charset
Memcheck:Leak
...
fun:g_get_charset
}
{
g_test_run_suite__timer_new
Memcheck:Leak
...
fun:g_timer_new
fun:test_case_run
...
fun:g_test_run_suite
}
{
g_test_run_suite__timer_new2
Memcheck:Leak
...
fun:g_timer_new
fun:test_case_run_suite_internal
...
fun:g_test_run_suite
}
{
g_test_run_suite__strconcat
Memcheck:Leak
...
fun:g_strconcat
fun:test_case_run
...
fun:g_test_run_suite
fun:g_test_run
}
{
g_type_interface_add_prerequisite
Memcheck:Leak
...
fun:g_type_interface_add_prerequisite
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:g_slist_copy
fun:g_test_run_suite_internal
...
fun:g_test_run_suite
}
{
g_set_prgname
Memcheck:Leak
...
fun:g_set_prgname
}
{
g_test_run_suite__strconcat_2
Memcheck:Leak
...
fun:g_strconcat
fun:g_test_run_suite_internal
}
{
g_test_run_suite__strdup
Memcheck:Leak
...
fun:g_strdup
fun:g_test_run_suite_internal
}
{
g_private_get
Memcheck:Leak
...
fun:g_private_get
}
{
g_private_set
Memcheck:Leak
...
fun:g_private_set
}
{
g_static_mutex_get_mutex_impl
Memcheck:Leak
...
fun:g_static_mutex_get_mutex_impl
}
{
g_variant_type_info_unref
Memcheck:Leak
...
fun:g_hash_table_remove
fun:g_variant_type_info_unref
}
{
g_rw_lock_reader_lock
Memcheck:Leak
...
fun:g_rw_lock_impl_new
fun:g_rw_lock_get_impl
fun:g_rw_lock_reader_lock
}
{
g_child_watch_finalize__rt_sigaction
Memcheck:Param
rt_sigaction(act->sa_flags)
fun:__libc_sigaction
...
fun:g_child_watch_finalize
}
{
g_dbus_worker_new
Memcheck:Leak
fun:calloc
...
fun:_g_dbus_worker_new
}
{
gdbus_shared_thread_func
Memcheck:Leak
match-leak-kinds: definite
...
fun:g_malloc
...
fun:gdbus_shared_thread_func
}
{
g_task_start_task_thread
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
...
fun:g_thread_pool_push
fun:g_task_start_task_thread
}
{
g_get_language_names
Memcheck:Leak
match-leak-kinds: definite
fun:calloc
fun:g_malloc0
fun:g_get_language_names
}
{
g_get_filename_charsets
Memcheck:Leak
match-leak-kinds: definite
...
fun:g_get_filename_charsets
fun:g_filename_display_name
}
{
g_main_current_source
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
...
fun:g_main_current_source
fun:g_task_return
fun:g_task_thread_pool_thread
}
{
g_once_init_enter
Memcheck:Leak
match-leak-kinds: definite
...
fun:g_once_init_enter
}
{
g_child_watch_source_new
Memcheck:Leak
match-leak-kinds: definite
...
fun:g_thread_new
...
fun:g_child_watch_source_new
}
{
continue_writing_in_idle_cb
Memcheck:Leak
match-leak-kinds: definite
...
fun:g_task_new
...
fun:continue_writing_in_idle_cb
fun:g_main_context_dispatch
}
{
g_main_current_source
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:g_main_current_source
}
{
g_thread_pool_push
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:g_thread_pool_push
}
{
leak_test_dbus_dispose
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:g_main_loop_run
fun:g_test_dbus_down
}
{
leak_test_dbus_down
Memcheck:Leak
match-leak-kinds: definite
fun:calloc
fun:g_malloc0
fun:g_main_loop_new
fun:g_test_dbus_down
}
{
leak_socket_client_connect
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:g_socket_client_connect_async
fun:g_socket_client_connect_to_uri_async
}
{
leak_signal_handlers_disconnect_matched
Memcheck:Leak
match-leak-kinds: definite
fun:calloc
fun:g_malloc0
...
fun:g_slice_alloc
...
fun:g_signal_handlers_disconnect_matched
}
{
g_tls_connection_gnutls_init_priorities
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_strdup
fun:g_tls_connection_gnutls_init_priorities
}
{
g_tls_connection_gnutls_heisenbug_likely_same_as_above
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_strdup
...
fun:g_tls_client_connection_new
}
{
g_unix_signal_add_full
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
...
fun:g_thread_new
...
fun:g_unix_signal_add_full
}
{
glib_worker_1
Memcheck:Leak
...
fun:glib_worker_main
}
-1
View File
@@ -1 +0,0 @@
trusted/pubring.gpg
Binary file not shown.
-105
View File
@@ -1,105 +0,0 @@
#!/usr/bin/python
#
# Copyright (C) 2015 Red Hat
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
import os
import sys
if len(sys.argv) == 1:
loaderpath = '/boot/loader/entries'
grub2path = '/boot/grub2/grub.cfg'
else:
loaderpath = sys.argv[1]
grub2path = sys.argv[2]
def fatal(msg):
sys.stderr.write(msg)
sys.stderr.write('\n')
sys.exit(1)
def compare_entries_descending(a, b):
return int(b['version']) - int(a['version'])
def get_ostree_option(optionstring):
for o in optionstring.split():
if o.startswith('ostree='):
return o[8:]
raise ValueError('ostree= not found')
entries = []
grub2_entries = []
# Parse loader configs
for fname in os.listdir(loaderpath):
path = os.path.join(loaderpath, fname)
with open(path) as f:
entry = {}
for line in f:
line = line.strip()
if (line == '' or line.startswith('#')):
continue
s = line.find(' ')
assert s > 0
k = line[0:s]
v = line[s+1:]
entry[k] = v
entries.append(entry)
entries.sort(compare_entries_descending)
# Parse GRUB2 config
with open(grub2path) as f:
in_ostree_config = False
grub2_entry = None
for line in f:
if line.startswith('### BEGIN /etc/grub.d/15_ostree ###'):
in_ostree_config = True
elif line.startswith('### END /etc/grub.d/15_ostree ###'):
in_ostree_config = False
if grub2_entry is not None:
grub2_entries.append(grub2_entry)
elif in_ostree_config:
if line.startswith('menuentry '):
if grub2_entry is not None:
grub2_entries.append(grub2_entry)
grub2_entry = {}
elif line.startswith('linux'):
parts = line.split()
grub2_entry['linux'] = parts[1]
grub2_entry['options'] = ' '.join(parts[2:])
elif line.startswith('initrd'):
grub2_entry['initrd'] = line.split()[1]
if len(entries) != len(grub2_entries):
fatal("Found {0} loader entries, but {1} GRUB2 entries\n".format(len(entries), len(grub2_entries)))
def assert_matches_key(a, b, key):
aval = a[key]
bval = b[key]
if aval != bval:
fatal("Mismatch on {0}: {1} != {2}".format(key, aval, bval))
for i,(entry,grub2entry) in enumerate(zip(entries, grub2_entries)):
assert_matches_key(entry, grub2entry, 'linux')
assert_matches_key(entry, grub2entry, 'initrd')
entry_ostree = get_ostree_option(entry['options'])
grub2_ostree = get_ostree_option(grub2entry['options'])
if entry_ostree != grub2_ostree:
fatal("Mismatch on ostree option: {0} != {1}".format(entry_ostree, grub2_ostree))
sys.stdout.write('GRUB2 configuration validated\n')
sys.exit(0)
+12 -22
View File
@@ -138,7 +138,6 @@ assert_file_has_content () {
if ! grep -q -e "$2" "$1"; then
sed -e 's/^/# /' < "$1" >&2
echo 1>&2 "File '$1' doesn't match regexp '$2'"
cat $1
exit 1
fi
}
@@ -400,34 +399,25 @@ os_repository_new_commit ()
cd ${test_tmpdir}
}
skip() {
echo "1..0 # SKIP" "$@"
exit 0
}
skip_without_user_xattrs () {
touch test-xattrs
if ! setfattr -n user.testvalue -v somevalue test-xattrs; then
echo "1..0 # SKIP this test requires xattr support"
exit 0
fi
setfattr -n user.testvalue -v somevalue test-xattrs || \
skip "this test requires xattr support"
}
skip_without_fuse () {
if ! fusermount --version >/dev/null 2>&1; then
echo "1..0 # SKIP no fusermount"
exit 0
fi
fusermount --version >/dev/null 2>&1 || skip "no fusermount"
if ! capsh --print | grep -q 'Bounding set.*[^a-z]cap_sys_admin'; then
echo "1..0 # SKIP No cap_sys_admin in bounding set, can't use FUSE"
exit 0
fi
capsh --print | grep -q 'Bounding set.*[^a-z]cap_sys_admin' || \
skip "No cap_sys_admin in bounding set, can't use FUSE"
if ! [ -w /dev/fuse ]; then
echo "1..0 # SKIP no write access to /dev/fuse"
exit 0
fi
if ! [ -e /etc/mtab ]; then
echo "1..0 # SKIP no /etc/mtab"
exit 0
fi
[ -w /dev/fuse ] || skip "no write access to /dev/fuse"
[ -e /etc/mtab ] || skip "no /etc/mtab"
}
libtest_cleanup_gpg () {
-1
View File
@@ -1 +0,0 @@
../src/boot/grub2/ostree-grub-generator
+101
View File
@@ -0,0 +1,101 @@
#!/bin/sh
# To use a custrom script for generating grub.cfg, set the --with-grub2-mkconfig=no
# configure switch when configuring and building OSTree.
#
# This script is called by ostree/src/libostree/ostree-bootloader-grub2.c whenever
# boot loader configuration file needs to be updated. It can be used as a template
# for a custom grub.cfg generator. What to consider when writing a custom grub.cfg
# generator:
#
# - The populate_menu() function converts boot loader entries as defined by
# https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ into GRUB2
# menuentry sections. This is the core logic that is required by OSTree
# based system.
#
# - Embedded systems: Be aware that this script is executed not only on a host machine by OS
# installer, but also on a target device, thus think about shell portability. A target device
# for example might be using busybox with a limited shell.
#
# Feel free to edit this script to fit your requirements.
set -e
script=$(basename ${0})
# Atomically safe location where to generete grub.cfg when executing system upgrade.
new_grub2_cfg=${2}
entries_path=$(dirname $new_grub2_cfg)/entries
read_config()
{
config_file=${entries_path}/${1}
title=""
initrd=""
options=""
linux=""
while read -r line
do
record=$(echo ${line} | cut -f 1 -d ' ')
value=$(echo ${line} | cut -s -f2- -d ' ')
case "${record}" in
"title")
title=${value}
;;
"initrd")
initrd=${value}
;;
"linux")
linux=${value}
;;
"options")
options=${value}
;;
esac
done < ${config_file}
if [ -z "${title}" ]; then
title="(Untitled)"
fi
}
populate_menu()
{
boot_prefix="${OSTREE_BOOT_PARTITION}"
for config in $(ls ${entries_path}); do
read_config ${config}
menu="${menu}menuentry '${title}' {\n"
menu="${menu}\t linux ${boot_prefix}${linux} ${options}\n"
menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
menu="${menu}}\n\n"
done
# The printf command seems to be more reliable across shells for special character (\n, \t) evaluation
printf "$menu" >> ${new_grub2_cfg}
}
populate_warning()
{
cat >> ${new_grub2_cfg} <<EOF
# This file was generated by ${script}. Do not modify the generated file - all changes will
# be lost the next time file is regenerated. For more details refer to the ${script} script.
EOF
}
populate_header()
{
cat >> ${new_grub2_cfg} <<EOF
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
default=boot
timeout=10
EOF
}
generate_grub2_cfg()
{
populate_warning
populate_header
populate_menu
}
generate_grub2_cfg
-1
View File
@@ -1 +0,0 @@
# Use this to suppress "possibly lost" for global statics
+12 -1
View File
@@ -35,7 +35,7 @@ function verify_initial_contents() {
assert_file_has_content baz/cow '^moo$'
}
echo "1..11"
echo "1..12"
# Try both syntaxes
repo_init
@@ -57,6 +57,17 @@ ${CMD_PREFIX} ostree --repo=mirrorrepo fsck
$OSTREE show main >/dev/null
echo "ok pull mirror"
cd ${test_tmpdir}
rm checkout-origin-main -rf
$OSTREE --repo=ostree-srv/gnomerepo checkout main checkout-origin-main
echo moomoo > checkout-origin-main/baz/cow
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b main -s "" --tree=dir=checkout-origin-main
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo static-delta generate main
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo fsck
${CMD_PREFIX} ostree --repo=mirrorrepo pull --mirror origin main
${CMD_PREFIX} ostree --repo=mirrorrepo fsck
echo "ok pull mirror (should not apply deltas)"
cd ${test_tmpdir}
mkdir mirrorrepo-local
${CMD_PREFIX} ostree --repo=mirrorrepo-local init --mode=archive-z2
+6 -1
View File
@@ -44,7 +44,12 @@ echo "ok deploy with --karg, but same config"
${CMD_PREFIX} ostree admin deploy --karg-proc-cmdline --os=testos testos:testos/buildmaster/x86_64-runtime
for arg in $(cat /proc/cmdline); do
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf "options.*$arg"
case "$arg" in
ostree=*) # Skip ostree arg that gets stripped out
;;
*) assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf "options.*$arg"
;;
esac
done
echo "ok deploy --karg-proc-cmdline"
+6 -1
View File
@@ -55,6 +55,11 @@ echo "ok instutil set-kargs --append"
${CMD_PREFIX} ostree admin instutil set-kargs --import-proc-cmdline
for arg in $(cat /proc/cmdline); do
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf "options.*$arg"
case "$arg" in
ostree=*) # Skip ostree arg that gets stripped out
;;
*) assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf "options.*$arg"
;;
esac
done
echo "ok instutil set-kargs --import-proc-cmdline"
-1
View File
@@ -21,7 +21,6 @@
#include "config.h"
#include "libglnx.h"
#include "libgsystem.h"
#include <glib.h>
#include <stdlib.h>
#include <gio/gio.h>
+24 -1
View File
@@ -26,7 +26,7 @@ skip_without_user_xattrs
bindatafiles="bash true ostree"
morebindatafiles="false ls"
echo '1..8'
echo '1..10'
mkdir repo
${CMD_PREFIX} ostree --repo=repo init --mode=archive-z2
@@ -208,3 +208,26 @@ ${CMD_PREFIX} ostree --repo=repo static-delta list | grep ^${origrev}-${newrev}$
${CMD_PREFIX} ostree --repo=repo static-delta list | grep ^${origrev}$ && exit 1
echo 'ok delete'
# Make another commit with no changes to create a delta with no parts
${CMD_PREFIX} ostree --repo=repo commit -b test -s test --tree=dir=files
samerev=$(${CMD_PREFIX} ostree --repo=repo rev-parse test)
${CMD_PREFIX} ostree --repo=repo static-delta generate --from=${newrev} --to=${samerev}
${CMD_PREFIX} ostree --repo=repo static-delta show ${newrev}-${samerev} > show-empty.txt
nparts_empty=$(grep '^Number of parts:' show-empty.txt)
part0_meta_empty=$(grep '^PartMeta0:' show-empty.txt)
totalsize_empty=$(grep '^Total Uncompressed Size:' show-empty.txt)
assert_streq "${nparts_empty}" "Number of parts: 1"
assert_str_match "${part0_meta_empty}" "nobjects=0"
assert_streq "${totalsize_empty}" "Total Uncompressed Size: 0 (0 bytes)"
echo 'ok generate + show empty delta part'
rm -rf repo2
mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=archive-z2
${CMD_PREFIX} ostree --repo=repo2 pull-local repo ${newrev}
${CMD_PREFIX} ostree --repo=repo2 pull-local repo ${samerev}
${CMD_PREFIX} ostree --repo=repo2 fsck
${CMD_PREFIX} ostree --repo=repo2 ls ${samerev} >/dev/null
echo 'ok pull empty delta part'
+1 -1
View File
@@ -20,8 +20,8 @@
#include "config.h"
#include <libgsystem.h>
#include <gpgme.h>
#include "libglnx.h"
#include "ostree-gpg-verify-result-private.h"
+11 -5
View File
@@ -87,25 +87,31 @@ assert_file_has_content tombstonecommitcount "^1$"
${CMD_PREFIX} ostree prune --repo=repo --refs-only --depth=0 -v
find repo/objects -name '*.commit' | wc -l > commitcount
assert_file_has_content commitcount "^1$"
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="2010-10-29 12:43:29 +0000"
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="2005-10-29 12:43:29 +0000"
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="2010-10-29 12:43:29 +0000"
find repo/objects -name '*.commit' | wc -l > commitcount
assert_file_has_content commitcount "^3$"
${CMD_PREFIX} ostree --repo=repo prune --keep-younger-than="2015-10-29 12:43:29 +0000"
find repo/objects -name '*.commit' | wc -l > commitcount
assert_file_has_content commitcount "^1$"
assert_file_has_content commitcount "^2$"
${CMD_PREFIX} ostree prune --repo=repo --refs-only --depth=0 -v
find repo/objects -name '*.commit' | wc -l > commitcount
assert_file_has_content commitcount "^1$"
assert_file_has_content commitcount "^2$"
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="October 25 1985"
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="October 21 2015"
find repo/objects -name '*.commit' | wc -l > commitcount
assert_file_has_content commitcount "^3$"
assert_file_has_content commitcount "^4$"
${CMD_PREFIX} ostree --repo=repo prune --keep-younger-than="1 week ago"
find repo/objects -name '*.commit' | wc -l > commitcount
assert_file_has_content commitcount "^1$"
assert_file_has_content commitcount "^2$"
${CMD_PREFIX} ostree --repo=repo commit --branch=oldcommit tree --timestamp="2005-10-29 12:43:29 +0000"
oldcommit_rev=$($OSTREE --repo=repo rev-parse oldcommit)
$OSTREE ls ${oldcommit_rev}
${CMD_PREFIX} ostree --repo=repo prune --keep-younger-than="1 week ago"
$OSTREE ls ${oldcommit_rev}
${CMD_PREFIX} ostree --repo=repo pull --depth=-1 origin test
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="November 05 1955"
+128
View File
@@ -0,0 +1,128 @@
#!/bin/bash -ex
this_script="${BASH_SOURCE:-$(readlink -f "$0")}"
setup_bootfs() {
mkdir -p "$1/proc" "$1/bin"
echo "quiet ostree=/ostree/boot.0 ro" >"$1/proc/cmdline"
touch "$1/this_is_bootfs"
cp "$(dirname "$this_script")/../src/switchroot/ostree-prepare-root" "$1/bin"
}
setup_rootfs() {
mkdir -p "$1/ostree/deploy/linux/deploy/1334/sysroot" \
"$1/ostree/deploy/linux/deploy/1334/var" \
"$1/ostree/deploy/linux/deploy/1334/usr" \
"$1/ostree/deploy/linux/var" \
"$1/bin"
ln -s "deploy/linux/deploy/1334" "$1/ostree/boot.0"
ln -s . "$1/sysroot"
touch "$1/ostree/deploy/linux/deploy/1334/this_is_ostree_root" \
"$1/ostree/deploy/linux/var/this_is_ostree_var" \
"$1/ostree/deploy/linux/deploy/1334/usr/this_is_ostree_usr" \
"$1/this_is_real_root"
cp /bin/busybox "$1/bin"
busybox --list | xargs -n1 -I '{}' ln -s busybox "$1/bin/{}"
cp -r "$1/bin" "$1/ostree/deploy/linux/deploy/1334/"
}
setup_overlay() {
mkdir -p "$1/ostree/deploy/linux/deploy/1334/.usr-ovl-work" \
"$1/ostree/deploy/linux/deploy/1334/.usr-ovl-upper"
}
enter_fs() {
cd "$1"
mkdir testroot
pivot_root . testroot
export PATH=$PATH:/sysroot/bin
cd /
umount -l testroot
rmdir testroot
}
find_in_env() {
tmpdir="$(mktemp -dt ostree-test-switchroot.XXXXXX)"
unshare -m <<-EOF
set -e
. "$this_script"
"$1" "$tmpdir"
enter_fs "$tmpdir"
ostree-prepare-root /sysroot
find /
touch /usr/usr_writable 2>/null \
&& echo "/usr is writable" \
|| echo "/usr is not writable"
touch /sysroot/usr/sysroot_usr_writable 2>/null \
&& echo "/sysroot/usr is writable" \
|| echo "/sysroot/usr is not writable"
EOF
(cd $tmpdir && find) >permanent_files
rm -rf "$tmpdir"
}
setup_initrd_env() {
mount -t tmpfs tmpfs "$1"
setup_bootfs "$1"
mkdir "$1/sysroot"
mount -t tmpfs tmpfs "$1/sysroot"
setup_rootfs "$1/sysroot"
}
test_that_prepare_root_sets_sysroot_up_correctly_with_initrd() {
find_in_env setup_initrd_env >files
grep -qx "/this_is_bootfs" files
grep -qx "/sysroot/this_is_ostree_root" files
grep -qx "/sysroot/sysroot/this_is_real_root" files
grep -qx "/sysroot/var/this_is_ostree_var" files
grep -qx "/sysroot/usr/this_is_ostree_usr" files
grep -qx "/sysroot/usr is not writable" files
echo "ok ostree-prepare-root sets sysroot up correctly with initrd"
}
setup_no_initrd_env() {
mount --bind "$1" "$1"
setup_rootfs "$1"
setup_bootfs "$1"
}
test_that_prepare_root_sets_root_up_correctly_with_no_initrd() {
find_in_env setup_no_initrd_env >files
grep -qx "/this_is_ostree_root" files
grep -qx "/sysroot/this_is_bootfs" files
grep -qx "/sysroot/this_is_real_root" files
grep -qx "/var/this_is_ostree_var" files
grep -qx "/usr/this_is_ostree_usr" files
grep -qx "/usr is not writable" files
echo "ok ostree-prepare-root sets root up correctly with no initrd"
}
setup_no_initrd_with_overlay() {
setup_no_initrd_env "$1"
setup_overlay "$1"
}
test_that_prepare_root_provides_overlay_over_usr_if__usr_ovl_work_exists() {
find_in_env setup_no_initrd_with_overlay >files
grep -qx "/usr is writable" files
grep -qx "./ostree/deploy/linux/deploy/1334/.usr-ovl-upper/usr_writable" permanent_files
! grep -qx "./ostree/deploy/linux/deploy/1334/usr/usr_writable" permanent_files || exit 1
echo "ok ostree-prepare-root sets root up correctly with writable usr overlay"
}
# This script sources itself so we only want to run tests if we're the parent:
if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
. $(dirname $0)/libtest.sh
unshare -m true || \
skip "this test needs to set up mount namespaces, rerun as root"
echo "1..3"
test_that_prepare_root_sets_sysroot_up_correctly_with_initrd
test_that_prepare_root_sets_root_up_correctly_with_no_initrd
test_that_prepare_root_provides_overlay_over_usr_if__usr_ovl_work_exists
fi
+2 -8
View File
@@ -19,8 +19,6 @@
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const GSystem = imports.gi.GSystem;
const OSTree = imports.gi.OSTree;
function assertEquals(a, b) {
@@ -36,12 +34,8 @@ function assertNotEquals(a, b) {
function libtestExec(shellCode) {
let testdatadir = GLib.getenv("G_TEST_SRCDIR");
let libtestPath = GLib.build_filenamev([testdatadir, 'libtest.sh'])
let proc = GSystem.Subprocess.new_simple_argv(['bash', '-c',
'set -xeuo pipefail; . ' + GLib.shell_quote(libtestPath) + '; ' + shellCode],
GSystem.SubprocessStreamDisposition.INHERIT,
GSystem.SubprocessStreamDisposition.INHERIT,
null);
proc.wait_sync_check(null);
let proc = Gio.Subprocess.new(['bash', '-c', 'set -xeuo pipefail; . ' + GLib.shell_quote(libtestPath) + '; ' + shellCode], 0);
proc.wait_check(null);
}
libtestExec('setup_os_repository archive-z2 syslinux');