2011-10-15 00:45:07 -04:00
#!/bin/bash
#
# Copyright (C) 2011 Colin Walters <walters@verbum.org>
#
2011-11-10 13:17:04 -05:00
# 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.
2011-10-15 00:45:07 -04:00
#
2011-11-10 13:17:04 -05:00
# This library is distributed in the hope that it will be useful,
2011-10-15 00:45:07 -04:00
# but WITHOUT ANY WARRANTY; without even the implied warranty of
2011-11-10 13:17:04 -05:00
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
2011-10-15 00:45:07 -04:00
#
2011-11-10 13:17:04 -05:00
# 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.
2011-10-15 00:45:07 -04:00
set -e
. libtest.sh
2012-05-04 14:22:09 -04:00
echo '1..22'
2011-10-15 00:45:07 -04:00
2011-10-31 22:42:14 -04:00
setup_test_repository "archive"
echo "ok setup"
2011-10-15 00:45:07 -04:00
2011-11-03 23:08:28 -04:00
$OSTREE checkout test2 checkout-test2
2011-10-31 22:42:14 -04:00
echo "ok checkout"
2011-10-15 00:45:07 -04:00
2011-10-31 22:42:14 -04:00
cd checkout-test2
assert_has_file firstfile
assert_has_file baz/cow
assert_file_has_content baz/cow moo
assert_has_file baz/deeper/ohyeah
echo "ok content"
2011-11-18 18:50:53 -05:00
cd ${ test_tmpdir }
mkdir repo2
2012-05-04 10:04:32 -04:00
${ CMD_PREFIX } ostree --repo= repo2 init
${ CMD_PREFIX } ostree --repo= repo2 pull-local repo
2011-11-18 18:50:53 -05:00
echo "ok local clone"
cd ${ test_tmpdir }
2012-05-04 10:04:32 -04:00
${ CMD_PREFIX } ostree --repo= repo2 checkout test2 test2-checkout-from-local-clone
2011-11-18 18:50:53 -05:00
cd test2-checkout-from-local-clone
assert_file_has_content baz/cow moo
echo "ok local clone checkout"
2011-12-15 16:12:31 -05:00
$OSTREE checkout -U test2 checkout-user-test2
echo "ok user checkout"
2011-12-18 17:36:46 -05:00
cd ${ test_tmpdir } /checkout-test2
$OSTREE commit -b test2-uid0 -s 'UID 0 test' --owner-uid= 0 --owner-gid= 0
echo "ok uid0 commit"
cd ${ test_tmpdir }
$OSTREE ls test2-uid0 /firstfile > uid0-ls-output.txt
2012-01-22 13:10:01 -05:00
assert_file_has_content uid0-ls-output.txt "-00664 0 0 6 /firstfile"
2011-12-18 17:36:46 -05:00
echo "ok uid0 ls"
$OSTREE checkout -U test2-uid0 checkout-user-test2-uid0
echo "ok user checkout from uid 0"
2012-03-05 11:32:48 -05:00
cd ${ test_tmpdir }
$OSTREE cat test2 /baz/cow > cow-contents
assert_file_has_content cow-contents "moo"
echo "ok cat-file"
2012-03-31 10:37:51 -04:00
cd ${ test_tmpdir }
2012-04-11 19:48:22 -04:00
$OSTREE pack
2012-03-31 10:37:51 -04:00
echo "ok pack"
cd ${ test_tmpdir }
$OSTREE fsck
echo "ok fsck"
$OSTREE checkout test2 checkout-test2-from-packed
echo "ok checkout union 1"
cd ${ test_tmpdir }
$OSTREE fsck
echo "ok fsck"
$OSTREE pack --analyze-only
echo "ok pack analyze"
$OSTREE unpack
echo "ok unpack"
cd ${ test_tmpdir }
$OSTREE fsck
echo "ok fsck"
cd ${ test_tmpdir }
$OSTREE checkout test2 checkout-test2-from-unpacked
echo "ok checkout union 2"
2012-04-13 08:32:02 -04:00
2012-04-28 07:54:40 -04:00
$OSTREE pack --metadata-only
echo "ok pack metadata"
$OSTREE fsck
echo "ok fsck"
cd ${ test_tmpdir }
rm -rf checkout-test2
$OSTREE checkout test2 checkout-test2
echo "ok checkout metadata-packed"
$OSTREE unpack
echo "ok unpack"