Skip to content

Commit

Permalink
Add test for composing trees in different ways
Browse files Browse the repository at this point in the history
In preparation for adding `ostree commit` optimisations.

Closes: #1645
Approved by: jlebon
  • Loading branch information
wmanley authored and rh-atomic-bot committed Jun 25, 2018
1 parent 5190f1d commit 5d031ae
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/basic-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,54 @@ $OSTREE checkout test3-combined checkout-test3-combined
assert_has_file checkout-test3-combined/file-a
assert_has_file checkout-test3-combined/file-b

mkdir -p tree-C/usr/share tree-C/usr/bin tree-C/etc tree-D/etc

echo exe >tree-C/usr/bin/exe
echo sudoers1 >tree-C/etc/sudoers
echo mtab >tree-C/etc/mtab

echo sudoers2 >tree-D/etc/sudoers

$OSTREE commit ${COMMIT_ARGS} -b test3-C1 --tree=dir=tree-C
$OSTREE commit ${COMMIT_ARGS} -b test3-D --tree=dir=tree-D

echo sudoers2 >tree-C/etc/sudoers
$OSTREE commit ${COMMIT_ARGS} -b test3-C2 --tree=dir=tree-C
echo sudoers1 >tree-C/etc/sudoers

$OSTREE commit ${COMMIT_ARGS} -b test3-ref-ref --tree=ref=test3-C1 --tree=ref=test3-D
$OSTREE commit ${COMMIT_ARGS} -b test3-dir-ref --tree=dir=tree-C --tree=ref=test3-D
$OSTREE commit ${COMMIT_ARGS} -b test3-ref-dir --tree=ref=test3-C1 --tree=dir=tree-D
$OSTREE commit ${COMMIT_ARGS} -b test3-dir-dir --tree=dir=tree-C --tree=dir=tree-D

assert_trees_identical() {
$OSTREE diff "$1" "$2" > "diff-$1-$2"
cat "diff-$1-$2" 1>&2
assert_file_empty "diff-$1-$2"
rm "diff-$1-$2"
}

for x in ref dir
do
for y in ref dir
do
assert_trees_identical test3-C2 "test3-$x-$y"
done
done

# Regression test

mkdir -p tree-E/etc
mkdir -p tree-F/etc/apt/sources.list.d/
echo contents >tree-F/etc/apt/sources.list.d/universe.list

$OSTREE commit ${COMMIT_ARGS} -b test3-E --tree=dir=tree-E
$OSTREE commit ${COMMIT_ARGS} -b test3-F --tree=dir=tree-F

$OSTREE commit ${COMMIT_ARGS} -b test3-F2 --tree=ref=test3-E --tree=ref=test3-F

assert_trees_identical test3-F test3-F2

echo "ok commit combined ref trees"

# NB: The + is optional, but we need to make sure we support it
Expand Down

0 comments on commit 5d031ae

Please sign in to comment.