summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2014-12-08 12:00:59 +0100
committerAlexander Larsson <alexl@redhat.com>2014-12-08 12:03:27 +0100
commitdbf717ac4b1ad5f4f8e221555a3a4872f2e454a1 (patch)
treea58f0847af964546bded6af4cacc88139e75b526
parentfcd3caf6dd25d5bbac2a708fdbfd11ef354c9eb4 (diff)
downloadostree-dbf717ac4b1ad5f4f8e221555a3a4872f2e454a1.tar.gz
Add local-pull archive-z2 <=> bare-user roundtrip test
This creates a archive-z2 repo, pull-locals it to bare-user and then again back to archive-z2 making sure things fsck along the way. Then it checks out all repos and makes sure each one reproduces the same result. Unfortunately we can't install this as a real test because it doesn't work in the test-runner because tmpfs doesn't support user xattrs. https://bugzilla.gnome.org/show_bug.cgi?id=741125
-rw-r--r--Makefile-tests.am1
-rwxr-xr-xtests/test-local-pull.sh57
2 files changed, 58 insertions, 0 deletions
diff --git a/Makefile-tests.am b/Makefile-tests.am
index cf4bc969..c7f7846d 100644
--- a/Makefile-tests.am
+++ b/Makefile-tests.am
@@ -67,6 +67,7 @@ insttest_DATA = tests/archive-test.sh \
tests/admin-test.sh \
tests/basic-test.sh \
tests/test-basic-user.sh \
+ tests/test-local-pull.sh \
tests/corrupt-repo-ref.js \
$(NULL)
diff --git a/tests/test-local-pull.sh b/tests/test-local-pull.sh
new file mode 100755
index 00000000..9c97aa12
--- /dev/null
+++ b/tests/test-local-pull.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+# Copyright (C) 2014 Alexander Larsson <alexl@redhat.com>
+#
+# 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 -e
+
+echo "1..1"
+
+. $(dirname $0)/libtest.sh
+
+setup_test_repository "archive-z2"
+echo "ok setup"
+
+cd ${test_tmpdir}
+mkdir repo2
+${CMD_PREFIX} ostree --repo=repo2 init --mode="bare-user"
+
+${CMD_PREFIX} ostree --repo=repo2 pull-local repo
+${CMD_PREFIX} ostree --repo=repo2 fsck
+echo "ok pull-local z2 to bare-user"
+
+mkdir repo3
+${CMD_PREFIX} ostree --repo=repo3 init --mode="archive-z2"
+${CMD_PREFIX} ostree --repo=repo3 pull-local repo2
+${CMD_PREFIX} ostree --repo=repo3 fsck
+echo "ok pull-local bare-user to z2"
+
+
+# Verify the name + size + mode + type + symlink target + owner/group are the same
+# for all checkouts
+${CMD_PREFIX} ostree checkout --repo repo test2 checkout1
+find checkout1 -printf '%P %s %#m %u/%g %y %l\n' > checkout1.files
+
+${CMD_PREFIX} ostree checkout --repo repo2 test2 checkout2
+find checkout2 -printf '%P %s %#m %u/%g %y %l\n' > checkout2.files
+
+${CMD_PREFIX} ostree checkout --repo repo3 test2 checkout3
+find checkout3 -printf '%P %s %#m %u/%g %y %l\n' > checkout3.files
+
+cmp checkout1.files checkout2.files
+cmp checkout1.files checkout3.files
+echo "ok checkouts same"