pmb: fix test suite not running through twice

The test suite needed a `pmbootstrap shutdown` after running through,
before it could successfully run again.

Explanation:
This was caused by `test/test_pkgrel_bump.py`, which creates a
temporary work folder with every subfolder ("chroot_native",
"cache_apk_x86_64", ...) linked to the original work folder except for
the "packages" folder. At the end of the test case,
`pmbootstrap shutdown` gets executed and is expected to umount
everything as usual. But it does not umount anything because of the
symlinks, so `work/chroot_native/mnt/pmbootstrap-packages` points to
the fake packages folder of that test case, even after it is finished.

As a result, any test case that tries to access the packages folder in
the native chroot, will fail until `pmbootstrap shutdown` gets called.

Detailed Changes:
* Umount all folders inside the work folder, even if these are symlinks
* Remove obsolete reference to "disable timestamp based rebuilds" in a
  comment in `test/test_pkgrel_bump.py`
* Run `pmbootstrap work_migrate` and `pmbootstrap shutdown` at the
  beginning of `test/testcases_fast.sh`, in case the pkgrel_bump test
  case was aborted before it could properly shutdown and to make it
  more robust in general (user may have changed the mountpoints, work
  folder may need to be migrated)
This commit is contained in:
Oliver Smith 2018-07-14 02:38:33 +02:00
parent 0adc6a1f4b
commit cca5c9aa30
3 changed files with 13 additions and 3 deletions

View File

@ -89,8 +89,13 @@ def shutdown(args, only_install_related=False):
pmb.helpers.mount.umount_all(args, chroot_rootfs)
if not only_install_related:
# Umount all folders inside args.work
# The folders are explicitly iterated over, so folders symlinked inside
# args.work get umounted as well (used in test_pkgrel_bump.py, #1595)
for path in glob.glob(args.work + "/*"):
pmb.helpers.mount.umount_all(args, path)
# Clean up the rest
pmb.helpers.mount.umount_all(args, args.work)
for arch in pmb.config.build_device_architectures:
if pmb.parse.arch.cpu_emulation_required(args, arch):
pmb.chroot.binfmt.unregister(args, arch)

View File

@ -107,7 +107,7 @@ def setup_work(args, tmpdir):
pmb.helpers.run.user(args, ["mkdir", "-p", tmpdir + "/packages"])
pmb.helpers.run.user(args, ["chmod", "777", tmpdir + "/packages"])
# Copy over the pmbootstrap config, disable timestamp based rebuilds
# Copy over the pmbootstrap config
pmb.helpers.run.user(args, ["cp", args.config, tmpdir +
"/_pmbootstrap.cfg"])

View File

@ -13,8 +13,13 @@ else
echo "Use '$(basename "$0") --all' to enable all test cases."
fi
# Make sure we have a valid device (#1128)
# Make sure that the work folder format is up to date, and that there are no
# mounts from aborted test cases (#1595)
cd "$(dirname "$0")/.."
./pmbootstrap.py work_migrate
./pmbootstrap.py -q shutdown
# Make sure we have a valid device (#1128)
device="$(./pmbootstrap.py config device)"
deviceinfo="$PWD/aports/device/device-$device/deviceinfo"
if ! [ -e "$deviceinfo" ]; then