New upstream version 2017.6
This commit is contained in:
commit
e3060b1b87
168 files changed
+5181
-3686
No files matched your search
+26
-3
@@ -19,7 +19,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..65"
|
||||
echo "1..66"
|
||||
|
||||
$CMD_PREFIX ostree --version > version.yaml
|
||||
python -c 'import yaml; yaml.safe_load(open("version.yaml"))'
|
||||
@@ -28,7 +28,7 @@ echo "ok yaml version"
|
||||
CHECKOUT_U_ARG=""
|
||||
COMMIT_ARGS=""
|
||||
DIFF_ARGS=""
|
||||
if grep bare-user-only repo/config; then
|
||||
if grep -q bare-user-only repo/config; then
|
||||
# In bare-user-only repos we can only represent files with uid/gid 0, no
|
||||
# xattrs and canonical permissions, so we need to commit them as such, or
|
||||
# we end up with repos that don't pass fsck
|
||||
@@ -50,11 +50,14 @@ validate_checkout_basic() {
|
||||
|
||||
$OSTREE checkout test2 checkout-test2
|
||||
validate_checkout_basic checkout-test2
|
||||
if grep -q 'mode=bare$' repo/config; then
|
||||
assert_not_streq $(stat -c '%h' checkout-test2/firstfile) 1
|
||||
fi
|
||||
echo "ok checkout"
|
||||
|
||||
# Note this tests bare-user *and* bare-user-only
|
||||
rm checkout-test2 -rf
|
||||
if grep bare-user repo/config; then
|
||||
if grep -q bare-user repo/config; then
|
||||
$OSTREE checkout -U -H test2 checkout-test2
|
||||
else
|
||||
$OSTREE checkout -H test2 checkout-test2
|
||||
@@ -78,6 +81,14 @@ fi
|
||||
fi
|
||||
echo "ok checkout -H"
|
||||
|
||||
rm checkout-test2 -rf
|
||||
$OSTREE checkout -C test2 checkout-test2
|
||||
for file in firstfile baz/cow baz/alink; do
|
||||
assert_streq $(stat -c '%h' checkout-test2/$file) 1
|
||||
done
|
||||
|
||||
echo "ok checkout -C"
|
||||
|
||||
$OSTREE rev-parse test2
|
||||
$OSTREE rev-parse 'test2^'
|
||||
$OSTREE rev-parse 'test2^^' 2>/dev/null && fatal "rev-parse test2^^ unexpectedly succeeded!"
|
||||
@@ -330,6 +341,18 @@ cd ${test_tmpdir}
|
||||
$OSTREE checkout --subpath /yet/another test2 checkout-test2-subpath
|
||||
cd checkout-test2-subpath
|
||||
assert_file_has_content tree/green "leaf"
|
||||
cd ${test_tmpdir}
|
||||
rm checkout-test2-subpath -rf
|
||||
$OSTREE ls -R test2
|
||||
# Test checking out a file
|
||||
$OSTREE checkout --subpath /baz/saucer test2 checkout-test2-subpath
|
||||
assert_file_has_content checkout-test2-subpath/saucer alien
|
||||
# Test checking out a file without making a subdir
|
||||
mkdir t
|
||||
cd t
|
||||
$OSTREE checkout --subpath /baz/saucer test2 .
|
||||
assert_file_has_content saucer alien
|
||||
rm t -rf
|
||||
echo "ok checkout subpath"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
|
||||
@@ -99,7 +99,7 @@ ot_test_setup_sysroot (GCancellable *cancellable,
|
||||
|
||||
{ g_autoptr(GString) buf = g_string_new ("mutable-deployments");
|
||||
if (statfs ("/", &stbuf) < 0)
|
||||
return glnx_throw_errno (error), NULL;
|
||||
return glnx_null_throw_errno (error);
|
||||
/* Keep this in sync with the overlayfs bits in libtest.sh */
|
||||
#ifndef OVERLAYFS_SUPER_MAGIC
|
||||
#define OVERLAYFS_SUPER_MAGIC 0x794c7630
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
# Core source library for shell script tests
|
||||
#
|
||||
# Copyright (C) 2017 Colin Walters <walters@verbum.org>
|
||||
#
|
||||
# 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.
|
||||
|
||||
fatal() {
|
||||
echo $@ 1>&2; exit 1
|
||||
}
|
||||
# fatal() is shorter to type, but retain this alias
|
||||
assert_not_reached () {
|
||||
fatal "$@"
|
||||
}
|
||||
|
||||
# Some tests look for specific English strings. Use a UTF-8 version
|
||||
# of the C (POSIX) locale if we have one, or fall back to POSIX
|
||||
# (https://sourceware.org/glibc/wiki/Proposals/C.UTF-8)
|
||||
if locale -a | grep C.UTF-8 >/dev/null; then
|
||||
export LC_ALL=C.UTF-8
|
||||
else
|
||||
export LC_ALL=C
|
||||
fi
|
||||
|
||||
# This should really be the default IMO
|
||||
export G_DEBUG=fatal-warnings
|
||||
assert_streq () {
|
||||
test "$1" = "$2" || fatal "$1 != $2"
|
||||
}
|
||||
|
||||
assert_str_match () {
|
||||
if ! echo "$1" | grep -E -q "$2"; then
|
||||
fatal "$1 does not match regexp $2"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_not_streq () {
|
||||
(! test "$1" = "$2") || fatal "$1 == $2"
|
||||
}
|
||||
|
||||
assert_has_file () {
|
||||
test -f "$1" || fatal "Couldn't find '$1'"
|
||||
}
|
||||
|
||||
assert_has_dir () {
|
||||
test -d "$1" || fatal "Couldn't find '$1'"
|
||||
}
|
||||
|
||||
assert_not_has_file () {
|
||||
if test -f "$1"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
fatal "File '$1' exists"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_not_file_has_content () {
|
||||
if grep -q -e "$2" "$1"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
fatal "File '$1' incorrectly matches regexp '$2'"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_not_has_dir () {
|
||||
if test -d "$1"; then
|
||||
fatal "Directory '$1' exists"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_file_has_content () {
|
||||
if ! grep -q -e "$2" "$1"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
fatal "File '$1' doesn't match regexp '$2'"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_file_has_content_literal () {
|
||||
if ! grep -q -F -e "$2" "$1"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
fatal "File '$1' doesn't match fixed string list '$2'"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_symlink_has_content () {
|
||||
if ! test -L "$1"; then
|
||||
echo 1>&2 "File '$1' is not a symbolic link"
|
||||
exit 1
|
||||
fi
|
||||
if ! readlink "$1" | grep -q -e "$2"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
echo 1>&2 "Symbolic link '$1' doesn't match regexp '$2'"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
assert_file_empty() {
|
||||
if test -s "$1"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
fatal "File '$1' is not empty"
|
||||
fi
|
||||
}
|
||||
|
||||
# Use to skip all of these tests
|
||||
skip() {
|
||||
echo "1..0 # SKIP" "$@"
|
||||
exit 0
|
||||
}
|
||||
+15
-93
@@ -17,6 +17,8 @@
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
dn=$(dirname $0)
|
||||
|
||||
if [ -n "${G_TEST_SRCDIR:-}" ]; then
|
||||
test_srcdir="${G_TEST_SRCDIR}/tests"
|
||||
else
|
||||
@@ -28,26 +30,10 @@ if [ -n "${G_TEST_BUILDDIR:-}" ]; then
|
||||
else
|
||||
test_builddir=$(dirname $0)
|
||||
fi
|
||||
|
||||
fatal() {
|
||||
echo $@ 1>&2; exit 1
|
||||
}
|
||||
# fatal() is shorter to type, but retain this alias
|
||||
assert_not_reached () {
|
||||
fatal "$@"
|
||||
}
|
||||
. ${test_srcdir}/libtest-core.sh
|
||||
|
||||
test_tmpdir=$(pwd)
|
||||
|
||||
# Some tests look for specific English strings. Use a UTF-8 version
|
||||
# of the C (POSIX) locale if we have one, or fall back to POSIX
|
||||
# (https://sourceware.org/glibc/wiki/Proposals/C.UTF-8)
|
||||
if locale -a | grep C.UTF-8 >/dev/null; then
|
||||
export LC_ALL=C.UTF-8
|
||||
else
|
||||
export LC_ALL=C
|
||||
fi
|
||||
|
||||
# Sanity check that we're in a tmpdir that has
|
||||
# just .testtmp (created by tap-driver for `make check`,
|
||||
# or nothing at all (as ginstest-runner does)
|
||||
@@ -62,8 +48,6 @@ if ! test -f .testtmp; then
|
||||
touch .testtmp
|
||||
fi
|
||||
|
||||
export G_DEBUG=fatal-warnings
|
||||
|
||||
# Also, unbreak `tar` inside `make check`...Automake will inject
|
||||
# TAR_OPTIONS: --owner=0 --group=0 --numeric-owner presumably so that
|
||||
# tarballs are predictable, except we don't want this in our tests.
|
||||
@@ -121,77 +105,17 @@ fi
|
||||
if test -n "${OSTREE_UNINSTALLED:-}"; then
|
||||
OSTREE_HTTPD=${OSTREE_UNINSTALLED}/ostree-trivial-httpd
|
||||
else
|
||||
OSTREE_HTTPD="${CMD_PREFIX} ostree trivial-httpd"
|
||||
# trivial-httpd is now in $libexecdir by default, which we don't
|
||||
# know at this point. Fortunately, libtest.sh is also in
|
||||
# $libexecdir, so make an educated guess. If it's not found, assume
|
||||
# it's still runnable as "ostree trivial-httpd".
|
||||
if [ -x "${test_srcdir}/../../libostree/ostree-trivial-httpd" ]; then
|
||||
OSTREE_HTTPD="${CMD_PREFIX} ${test_srcdir}/../../libostree/ostree-trivial-httpd"
|
||||
else
|
||||
OSTREE_HTTPD="${CMD_PREFIX} ostree trivial-httpd"
|
||||
fi
|
||||
fi
|
||||
|
||||
assert_streq () {
|
||||
test "$1" = "$2" || fatal "$1 != $2"
|
||||
}
|
||||
|
||||
assert_str_match () {
|
||||
if ! echo "$1" | grep -E -q "$2"; then
|
||||
fatal "$1 does not match regexp $2"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_not_streq () {
|
||||
(! test "$1" = "$2") || fatal "$1 == $2"
|
||||
}
|
||||
|
||||
assert_has_file () {
|
||||
test -f "$1" || fatal "Couldn't find '$1'"
|
||||
}
|
||||
|
||||
assert_has_dir () {
|
||||
test -d "$1" || fatal "Couldn't find '$1'"
|
||||
}
|
||||
|
||||
assert_not_has_file () {
|
||||
if test -f "$1"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
fatal "File '$1' exists"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_not_file_has_content () {
|
||||
if grep -q -e "$2" "$1"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
fatal "File '$1' incorrectly matches regexp '$2'"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_not_has_dir () {
|
||||
if test -d "$1"; then
|
||||
fatal "Directory '$1' exists"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_file_has_content () {
|
||||
if ! grep -q -e "$2" "$1"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
fatal "File '$1' doesn't match regexp '$2'"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_symlink_has_content () {
|
||||
if ! test -L "$1"; then
|
||||
echo 1>&2 "File '$1' is not a symbolic link"
|
||||
exit 1
|
||||
fi
|
||||
if ! readlink "$1" | grep -q -e "$2"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
echo 1>&2 "Symbolic link '$1' doesn't match regexp '$2'"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
assert_file_empty() {
|
||||
if test -s "$1"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
fatal "File '$1' is not empty"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_files_hardlinked() {
|
||||
f1=$(stat -c %i $1)
|
||||
f2=$(stat -c %i $2)
|
||||
@@ -491,6 +415,9 @@ EOF
|
||||
mkdir sysroot
|
||||
export OSTREE_SYSROOT=sysroot
|
||||
${CMD_PREFIX} ostree admin init-fs sysroot
|
||||
if test -n "${OSTREE_NO_XATTRS:-}"; then
|
||||
echo -e 'disable-xattrs=true\n' >> sysroot/ostree/repo/config
|
||||
fi
|
||||
${CMD_PREFIX} ostree admin os-init testos
|
||||
|
||||
case $bootmode in
|
||||
@@ -541,11 +468,6 @@ os_repository_new_commit ()
|
||||
cd ${test_tmpdir}
|
||||
}
|
||||
|
||||
skip() {
|
||||
echo "1..0 # SKIP" "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
skip_without_user_xattrs () {
|
||||
touch test-xattrs
|
||||
setfattr -n user.testvalue -v somevalue test-xattrs || \
|
||||
|
||||
+30
-5
@@ -35,7 +35,7 @@ function verify_initial_contents() {
|
||||
assert_file_has_content baz/cow '^moo$'
|
||||
}
|
||||
|
||||
echo "1..15"
|
||||
echo "1..16"
|
||||
|
||||
# Try both syntaxes
|
||||
repo_init
|
||||
@@ -150,23 +150,33 @@ prev_rev=$(ostree --repo=ostree-srv/gnomerepo rev-parse main^)
|
||||
new_rev=$(ostree --repo=ostree-srv/gnomerepo rev-parse main)
|
||||
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u
|
||||
|
||||
# Explicitly test delta fetches via ref name as well as commit hash
|
||||
for delta_target in main ${new_rev}; do
|
||||
cd ${test_tmpdir}
|
||||
repo_init
|
||||
${CMD_PREFIX} ostree --repo=repo pull origin main@${prev_rev}
|
||||
${CMD_PREFIX} ostree --repo=repo pull --dry-run --require-static-deltas origin main >dry-run-pull.txt
|
||||
${CMD_PREFIX} ostree --repo=repo pull --dry-run --require-static-deltas origin ${delta_target} >dry-run-pull.txt
|
||||
# Compression can vary, so we support 400-699
|
||||
assert_file_has_content dry-run-pull.txt 'Delta update: 0/1 parts, 0 bytes/[456][0-9][0-9] bytes, 455 bytes total uncompressed'
|
||||
rev=$(${CMD_PREFIX} ostree --repo=repo rev-parse origin:main)
|
||||
assert_streq "${prev_rev}" "${rev}"
|
||||
${CMD_PREFIX} ostree --repo=repo fsck
|
||||
done
|
||||
|
||||
# Explicitly test delta fetches via ref name as well as commit hash
|
||||
for delta_target in main ${new_rev}; do
|
||||
cd ${test_tmpdir}
|
||||
repo_init
|
||||
${CMD_PREFIX} ostree --repo=repo pull origin main@${prev_rev}
|
||||
${CMD_PREFIX} ostree --repo=repo pull --require-static-deltas origin main
|
||||
rev=$(${CMD_PREFIX} ostree --repo=repo rev-parse origin:main)
|
||||
assert_streq "${new_rev}" "${rev}"
|
||||
${CMD_PREFIX} ostree --repo=repo pull --require-static-deltas origin ${delta_target}
|
||||
if test ${delta_target} = main; then
|
||||
rev=$(${CMD_PREFIX} ostree --repo=repo rev-parse origin:main)
|
||||
assert_streq "${new_rev}" "${rev}"
|
||||
else
|
||||
${CMD_PREFIX} ostree --repo=repo rev-parse ${delta_target}
|
||||
fi
|
||||
${CMD_PREFIX} ostree --repo=repo fsck
|
||||
done
|
||||
|
||||
cd ${test_tmpdir}
|
||||
repo_init
|
||||
@@ -208,8 +218,23 @@ fi
|
||||
assert_file_has_content err.txt "deltas required, but none found"
|
||||
${CMD_PREFIX} ostree --repo=repo fsck
|
||||
|
||||
# Now test with a partial commit
|
||||
repo_init
|
||||
${CMD_PREFIX} ostree --repo=repo pull --commit-metadata-only origin main@${prev_rev}
|
||||
if ${CMD_PREFIX} ostree --repo=repo pull --require-static-deltas origin main 2>err.txt; then
|
||||
assert_not_reached "--require-static-deltas unexpectedly succeeded"
|
||||
fi
|
||||
assert_file_has_content err.txt "deltas required, but none found"
|
||||
echo "ok delta required but don't exist"
|
||||
|
||||
repo_init
|
||||
${CMD_PREFIX} ostree --repo=repo pull origin main@${prev_rev}
|
||||
if ${CMD_PREFIX} ostree --repo=repo pull --require-static-deltas origin ${new_rev} 2>err.txt; then
|
||||
assert_not_reached "--require-static-deltas unexpectedly succeeded"
|
||||
fi
|
||||
assert_file_has_content err.txt "deltas required, but none found"
|
||||
echo "ok delta required for revision"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm main-files -rf
|
||||
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo checkout main main-files
|
||||
|
||||
+30
-30
@@ -83,7 +83,7 @@ readdir (DIR *dirp)
|
||||
struct dirent *(*real_readdir)(DIR *dirp) = dlsym (RTLD_NEXT, READDIR);
|
||||
struct dirent *ret;
|
||||
gboolean cache_another = TRUE;
|
||||
|
||||
|
||||
ensure_initialized ();
|
||||
|
||||
/* The core idea here is that each time through the loop, we read a
|
||||
@@ -101,40 +101,40 @@ readdir (DIR *dirp)
|
||||
errno = 0;
|
||||
ret = real_readdir (dirp);
|
||||
if (ret == NULL && errno != 0)
|
||||
goto out;
|
||||
goto out;
|
||||
|
||||
g_mutex_lock (&direntcache_lock);
|
||||
de = g_hash_table_lookup (direntcache, dirp);
|
||||
if (ret)
|
||||
{
|
||||
if (g_random_boolean ())
|
||||
{
|
||||
struct dirent *copy;
|
||||
if (!de)
|
||||
{
|
||||
de = dir_entries_new ();
|
||||
g_hash_table_insert (direntcache, dirp, de);
|
||||
}
|
||||
copy = g_memdup (ret, sizeof (struct dirent));
|
||||
g_ptr_array_add (de->entries, copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
cache_another = FALSE;
|
||||
}
|
||||
}
|
||||
{
|
||||
if (g_random_boolean ())
|
||||
{
|
||||
struct dirent *copy;
|
||||
if (!de)
|
||||
{
|
||||
de = dir_entries_new ();
|
||||
g_hash_table_insert (direntcache, dirp, de);
|
||||
}
|
||||
copy = g_memdup (ret, sizeof (struct dirent));
|
||||
g_ptr_array_add (de->entries, copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
cache_another = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (de && de->offset < de->entries->len)
|
||||
{
|
||||
ret = de->entries->pdata[de->offset];
|
||||
de->offset++;
|
||||
}
|
||||
cache_another = FALSE;
|
||||
}
|
||||
{
|
||||
if (de && de->offset < de->entries->len)
|
||||
{
|
||||
ret = de->entries->pdata[de->offset];
|
||||
de->offset++;
|
||||
}
|
||||
cache_another = FALSE;
|
||||
}
|
||||
g_mutex_unlock (&direntcache_lock);
|
||||
}
|
||||
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ closedir (DIR *dirp)
|
||||
int (*real_closedir)(DIR *dirp) = dlsym (RTLD_NEXT, "closedir");
|
||||
|
||||
ensure_initialized ();
|
||||
|
||||
|
||||
g_mutex_lock (&direntcache_lock);
|
||||
g_hash_table_remove (direntcache, dirp);
|
||||
g_mutex_unlock (&direntcache_lock);
|
||||
@@ -170,7 +170,7 @@ seekdir (DIR *dirp, long loc)
|
||||
|
||||
ensure_initialized ();
|
||||
|
||||
/* For now, crash if seekdir is called when we have cached entries.
|
||||
/* For now, crash if seekdir is called when we have cached entries.
|
||||
* If some app wants to use this and seekdir() we can implement it.
|
||||
*/
|
||||
assert_no_cached_entries (dirp);
|
||||
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2011 Colin Walters <walters@verbum.org>
|
||||
#
|
||||
# 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.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
id=$(id -u)
|
||||
|
||||
if test ${id} != 0; then
|
||||
skip "continued basic tests must be run as root (possibly in a container)"
|
||||
fi
|
||||
|
||||
setup_test_repository "bare"
|
||||
|
||||
echo "1..1"
|
||||
|
||||
nextid=$(($id + 1))
|
||||
|
||||
rm checkout-test2 -rf
|
||||
$OSTREE checkout test2 checkout-test2
|
||||
$OSTREE commit ${COMMIT_ARGS} -b test2 --tree=ref=test2 --owner-uid=$nextid
|
||||
$OSTREE ls test2 baz/cow > ls.txt
|
||||
assert_file_has_content ls.txt '-00644 '${nextid}' '${id}
|
||||
# As bare and running as root (e.g. Docker container), do some ownership tests
|
||||
# https://github.com/ostreedev/ostree/pull/801
|
||||
# Both hardlinks and copies should respect ownership, but we don't have -C yet;
|
||||
# add it when we do.
|
||||
for opt in -H; do
|
||||
rm test2-co -rf
|
||||
$OSTREE checkout ${opt} test2 test2-co
|
||||
assert_streq "$(stat -c '%u' test2-co/baz/cow)" ${nextid}
|
||||
assert_streq "$(stat -c '%u' test2-co/baz/alink)" ${nextid}
|
||||
done
|
||||
rm test2-co -rf
|
||||
# But user mode doesn't
|
||||
$OSTREE checkout -U test2 test2-co
|
||||
assert_streq "$(stat -c '%u' test2-co/baz/cow)" ${id}
|
||||
assert_streq "$(stat -c '%u' test2-co/baz/alink)" ${id}
|
||||
echo "ok ownership"
|
||||
@@ -52,4 +52,18 @@ let child = root.get_child('some-file');
|
||||
let info = child.query_info("standard::name,standard::type,standard::size", 0, null);
|
||||
assertEquals(info.get_size(), 12);
|
||||
|
||||
// Write a ref and read it back
|
||||
repo.prepare_transaction(null);
|
||||
repo.transaction_set_refspec('someref', commit);
|
||||
repo.commit_transaction(null, null);
|
||||
let [,readCommit] = repo.resolve_rev('someref', false);
|
||||
assertEquals(readCommit, commit);
|
||||
|
||||
// Delete a ref
|
||||
repo.prepare_transaction(null);
|
||||
repo.transaction_set_refspec('someref', null);
|
||||
repo.commit_transaction(null, null);
|
||||
[,readCommit] = repo.resolve_rev('someref', true);
|
||||
assertEquals(readCommit, null);
|
||||
|
||||
print("test-core complete");
|
||||
@@ -19,10 +19,12 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..2"
|
||||
echo "1..3"
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm repo files -rf
|
||||
setup_test_repository "bare"
|
||||
$OSTREE checkout test2 checkout-test2
|
||||
cd checkout-test2
|
||||
@@ -34,6 +36,8 @@ $OSTREE fsck -q
|
||||
echo "ok chmod"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm repo files -rf
|
||||
setup_test_repository "bare"
|
||||
rm checkout-test2 -rf
|
||||
$OSTREE checkout test2 checkout-test2
|
||||
cd checkout-test2
|
||||
@@ -41,3 +45,14 @@ chmod o+x firstfile
|
||||
$OSTREE fsck -q --delete && (echo 1>&2 "fsck unexpectedly succeeded"; exit 1)
|
||||
|
||||
echo "ok chmod"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm repo files -rf
|
||||
setup_test_repository "bare"
|
||||
find repo/ -name '*.commit' -delete
|
||||
if $OSTREE fsck -q 2>err.txt; then
|
||||
assert_not_reached "fsck unexpectedly succeeded"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt "Loading commit for ref test2: No such metadata object"
|
||||
|
||||
echo "ok missing commit"
|
||||
+2
-2
@@ -169,9 +169,9 @@ echo 'ok heuristic endian detection'
|
||||
${CMD_PREFIX} ostree --repo=repo summary -u
|
||||
|
||||
mkdir repo2 && ostree_repo_init repo2 --mode=bare-user
|
||||
${CMD_PREFIX} ostree --repo=repo2 pull-local --require-static-deltas repo ${newrev}
|
||||
${CMD_PREFIX} ostree --repo=repo2 pull-local --require-static-deltas repo ${origrev}
|
||||
${CMD_PREFIX} ostree --repo=repo2 fsck
|
||||
${CMD_PREFIX} ostree --repo=repo2 ls ${newrev} >/dev/null
|
||||
${CMD_PREFIX} ostree --repo=repo2 ls ${origrev} >/dev/null
|
||||
|
||||
echo 'ok pull delta'
|
||||
|
||||
|
||||
@@ -28,11 +28,10 @@
|
||||
#define assert_no_gpg_error(err, filename) \
|
||||
G_STMT_START { \
|
||||
if (err != GPG_ERR_NO_ERROR) { \
|
||||
GString *string = g_string_new ("assertion failed "); \
|
||||
g_autoptr(GString) string = g_string_new ("assertion failed "); \
|
||||
g_string_append_printf (string, "%s: %s ", gpgme_strsource (err), gpgme_strerror (err)); \
|
||||
g_string_append (string, filename ? filename : ""); \
|
||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, string->str); \
|
||||
g_string_free (string, TRUE); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2017 Colin Walters <walters@verbum.org>
|
||||
#
|
||||
# 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.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
setup_exampleos_repo
|
||||
|
||||
echo '1..3'
|
||||
|
||||
cd ${test_tmpdir}
|
||||
set -x
|
||||
|
||||
echo "$(date): Pulling content..."
|
||||
rev=$(${CMD_PREFIX} ostree --repo=ostree-srv/exampleos/repo rev-parse ${REF})
|
||||
${CMD_PREFIX} ostree --repo=repo pull --disable-static-deltas origin ${REF}
|
||||
${CMD_PREFIX} ostree --repo=repo fsck
|
||||
assert_streq ${rev} $(${CMD_PREFIX} ostree --repo=repo rev-parse ${REF})
|
||||
|
||||
echo "ok without deltas"
|
||||
|
||||
previous=$(${CMD_PREFIX} ostree --repo=repo rev-parse ${rev}^)
|
||||
rm repo/refs/{heads,remotes}/* -rf
|
||||
${CMD_PREFIX} ostree --repo=repo prune --refs-only
|
||||
${CMD_PREFIX} ostree --repo=repo pull origin ${REF}@${previous}
|
||||
${CMD_PREFIX} ostree --repo=repo pull --dry-run --require-static-deltas origin ${REF} > output.txt
|
||||
assert_file_has_content output.txt 'Delta update: 0/1 parts, 0 bytes/1.[012] MB, 1.[345] MB total uncompressed'
|
||||
|
||||
echo "ok delta dry-run"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=repo pull --require-static-deltas origin ${REF}
|
||||
assert_streq $(${CMD_PREFIX} ostree --repo=repo rev-parse ${REF}) ${rev}
|
||||
${CMD_PREFIX} ostree --repo=repo fsck
|
||||
|
||||
echo "ok"
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2011,2013 Colin Walters <walters@verbum.org>
|
||||
# Copyright (C) 2014 Red Hat, Inc.
|
||||
#
|
||||
# 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.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
setup_test_repository "bare"
|
||||
|
||||
echo '1..1'
|
||||
|
||||
repopath=${test_tmpdir}/ostree-srv/gnomerepo
|
||||
|
||||
${CMD_PREFIX} ostree --repo=repo checkout -U --subpath=/ test2 checkedout
|
||||
|
||||
${CMD_PREFIX} ostree --repo=repo checkout -U --subpath=/firstfile test2 checkedout2
|
||||
|
||||
echo "ok"
|
||||
@@ -152,7 +152,7 @@ test_bupsplit_sum(void)
|
||||
sum1a = bupsplit_sum(buf, 0, BUP_SELFTEST_SIZE);
|
||||
sum1b = bupsplit_sum(buf, 1, BUP_SELFTEST_SIZE);
|
||||
sum2a = bupsplit_sum(buf, BUP_SELFTEST_SIZE - BUP_WINDOWSIZE*5/2,
|
||||
BUP_SELFTEST_SIZE - BUP_WINDOWSIZE);
|
||||
BUP_SELFTEST_SIZE - BUP_WINDOWSIZE);
|
||||
sum2b = bupsplit_sum(buf, 0, BUP_SELFTEST_SIZE - BUP_WINDOWSIZE);
|
||||
sum3a = bupsplit_sum(buf, 0, BUP_WINDOWSIZE+3);
|
||||
sum3b = bupsplit_sum(buf, 3, BUP_WINDOWSIZE+3);
|
||||
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright © 2017 Endless Mobile, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Authors:
|
||||
# - Philip Withnall <withnall@endlessm.com>
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
echo "1..2"
|
||||
|
||||
COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
|
||||
setup_fake_remote_repo1 "archive-z2" "${COMMIT_SIGN}"
|
||||
|
||||
# Set up a second branch.
|
||||
mkdir ${test_tmpdir}/ostree-srv/other-files
|
||||
cd ${test_tmpdir}/ostree-srv/other-files
|
||||
echo 'hello world some object' > hello-world
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit ${COMMIT_SIGN} -b other -s "A commit" -m "Example commit body"
|
||||
|
||||
# Generate the summary file.
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo summary -u
|
||||
|
||||
# Check out the repository.
|
||||
prev_dir=`pwd`
|
||||
cd ${test_tmpdir}
|
||||
ostree_repo_init repo --mode=archive-z2
|
||||
${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo
|
||||
${CMD_PREFIX} ostree --repo=repo pull --mirror origin
|
||||
|
||||
# Check the summary file exists in the checkout, and can be viewed.
|
||||
assert_has_file repo/summary
|
||||
${OSTREE} summary --view > summary.txt
|
||||
assert_file_has_content_literal summary.txt "* main"
|
||||
assert_file_has_content_literal summary.txt "* other"
|
||||
assert_file_has_content_literal summary.txt "ostree.summary.last-modified"
|
||||
assert_file_has_content_literal summary.txt "Static Deltas (ostree.static-deltas): {}"
|
||||
echo "ok view summary"
|
||||
|
||||
# Check the summary can be viewed raw too.
|
||||
${OSTREE} summary --view --raw > raw-summary.txt
|
||||
assert_file_has_content_literal raw-summary.txt "('main', ("
|
||||
assert_file_has_content_literal raw-summary.txt "('other', ("
|
||||
assert_file_has_content_literal raw-summary.txt "{'ostree.summary.last-modified': <uint64"
|
||||
echo "ok view summary raw"
|
||||
|
||||
libtest_cleanup_gpg
|
||||
+11
-3
@@ -21,9 +21,17 @@ set -euo pipefail
|
||||
|
||||
echo '1..2'
|
||||
|
||||
if echo "$OSTREE_FEATURES" | grep --quiet --no-messages "experimental"; then
|
||||
experimental_sym="${G_TEST_SRCDIR}/src/libostree/libostree-experimental.sym"
|
||||
experimental_sections="${G_TEST_SRCDIR}/apidoc/ostree-experimental-sections.txt"
|
||||
else
|
||||
experimental_sym=""
|
||||
experimental_sections=""
|
||||
fi
|
||||
|
||||
echo "Verifying all expected symbols are actually exported..."
|
||||
grep ' ostree_[A-Za-z0-9_]*;' ${G_TEST_SRCDIR}/src/libostree/libostree.sym | sed -e 's,^ *\([A-Za-z0-9_]*\);,\1,' | sort -u > expected-symbols.txt
|
||||
eu-readelf -a ${G_TEST_BUILDDIR}/.libs/libostree-1.so | grep 'FUNC.*GLOBAL.*DEFAULT.*@@LIBOSTREE_' | sed -e 's,^.* \(ostree_[A-Za-z0-9_]*\)@@LIBOSTREE_[0-9_.]*,\1,' |sort -u > found-symbols.txt
|
||||
grep --no-filename ' ostree_[A-Za-z0-9_]*;' ${G_TEST_SRCDIR}/src/libostree/libostree.sym $experimental_sym | sed -e 's,^ *\([A-Za-z0-9_]*\);,\1,' | sort -u > expected-symbols.txt
|
||||
eu-readelf -a ${G_TEST_BUILDDIR}/.libs/libostree-1.so | grep 'FUNC.*GLOBAL.*DEFAULT.*@@LIBOSTREE_' | sed -e 's,^.* \(ostree_[A-Za-z0-9_]*\)@@LIBOSTREE_[0-9A-Z_.]*,\1,' |sort -u > found-symbols.txt
|
||||
diff -u expected-symbols.txt found-symbols.txt
|
||||
echo "ok exports"
|
||||
|
||||
@@ -31,7 +39,7 @@ echo "ok exports"
|
||||
grep -E -v '(ostree_cmd__private__)|(ostree_fetcher_config_flags_get_type)' found-symbols.txt > expected-documented.txt
|
||||
|
||||
echo "Verifying all public symbols are documented:"
|
||||
grep '^ostree_' ${G_TEST_SRCDIR}/apidoc/ostree-sections.txt |sort -u > found-documented.txt
|
||||
grep '^ostree_' ${G_TEST_SRCDIR}/apidoc/ostree-sections.txt $experimental_sections |sort -u > found-documented.txt
|
||||
diff -u expected-documented.txt found-documented.txt
|
||||
|
||||
echo 'ok documented symbols'
|
||||
Reference in new issue
Block a user