Merge pull request #1988 from akiernan/us-switchroot-installed

test-switchroot.sh: Find ostree-prepare-root in installed tests
This commit is contained in:
OpenShift Merge Robot 2020-01-14 20:30:33 +01:00 committed by GitHub
commit c0d760bb0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -2,6 +2,16 @@
this_script="${BASH_SOURCE:-$(readlink -f "$0")}" this_script="${BASH_SOURCE:-$(readlink -f "$0")}"
OSTREE_PREPARE_ROOT=$(dirname "${this_script}")/../ostree-prepare-root
if [ ! -x "${OSTREE_PREPARE_ROOT}" ]; then
# ostree-prepare-root is in $libdir by default, assume we can find it
# based on our test directory, if not we'll have to skip this test.
OSTREE_PREPARE_ROOT=$(dirname "${this_script}")/../../../lib/ostree/ostree-prepare-root
if [ ! -x "${OSTREE_PREPARE_ROOT}" ]; then
OSTREE_PREPARE_ROOT=""
fi
fi
setup_bootfs() { setup_bootfs() {
mkdir -p "$1/proc" "$1/bin" mkdir -p "$1/proc" "$1/bin"
@ -13,7 +23,7 @@ setup_bootfs() {
mount --bind "$1/override_cmdline" "$1/proc/cmdline" mount --bind "$1/override_cmdline" "$1/proc/cmdline"
touch "$1/this_is_bootfs" touch "$1/this_is_bootfs"
cp "$(dirname "$this_script")/../ostree-prepare-root" "$1/bin" cp "${OSTREE_PREPARE_ROOT}" "$1/bin"
} }
setup_rootfs() { setup_rootfs() {
@ -130,6 +140,9 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
[ -f /bin/busybox ] || \ [ -f /bin/busybox ] || \
skip "this test needs busybox" skip "this test needs busybox"
[ -n "${OSTREE_PREPARE_ROOT}" ] || \
skip "this test needs ostree-prepare-root"
echo "1..3" echo "1..3"
test_that_prepare_root_sets_sysroot_up_correctly_with_initrd test_that_prepare_root_sets_sysroot_up_correctly_with_initrd
test_that_prepare_root_sets_root_up_correctly_with_no_initrd test_that_prepare_root_sets_root_up_correctly_with_no_initrd