2023-06-16 22:35:50 +03:00
#!/bin/bash
#
# SPDX-License-Identifier: LGPL-2.0+
#
# 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, see <https://www.gnu.org/licenses/>.
set -euo pipefail
2023-06-27 13:59:51 +03:00
. $( dirname $0 ) /libtest.sh
if ! ${ CMD_PREFIX } ostree --version | grep -q -e '- composefs' ; then
2023-06-16 22:35:50 +03:00
echo "1..0 #SKIP no composefs support compiled in"
exit 0
fi
2024-01-24 16:55:12 +03:00
skip_without_user_xattrs
2023-06-16 22:35:50 +03:00
setup_test_repository "bare-user"
cd ${ test_tmpdir }
$OSTREE checkout test2 test2-co
2023-07-06 20:31:18 +03:00
rm test2-co/whiteouts -rf # This may or may not exist
COMMIT_ARGS = "--owner-uid=0 --owner-gid=0 --no-xattrs --canonical-permissions"
2023-06-16 22:35:50 +03:00
$OSTREE commit ${ COMMIT_ARGS } -b test-composefs --generate-composefs-metadata test2-co
2023-07-06 20:31:18 +03:00
# If the test fails we'll dump this out
$OSTREE ls -RCX test-composefs /
orig_composefs_digest = $( $OSTREE show --print-hex --print-metadata-key ostree.composefs.digest.v0 test-composefs)
2023-06-16 22:35:50 +03:00
$OSTREE commit ${ COMMIT_ARGS } -b test-composefs2 --generate-composefs-metadata test2-co
2023-07-06 20:31:18 +03:00
new_composefs_digest = $( $OSTREE show --print-hex --print-metadata-key ostree.composefs.digest.v0 test-composefs2)
2023-06-16 22:35:50 +03:00
assert_streq " ${ orig_composefs_digest } " " ${ new_composefs_digest } "
2023-09-29 19:09:04 +03:00
assert_streq " ${ new_composefs_digest } " "be956966c70970ea23b1a8043bca58cfb0d011d490a35a7817b36d04c0210954"
2023-06-16 22:35:50 +03:00
tap_ok "composefs metadata"
tap_end