pmbootstrap-meow/test/testcases_fast.sh
Oliver Smith e2c38a2e31
Run aportgen test in CI again (!1727)
Clear the test blacklist for all tests, except for the QEMU test (which
runs on its own on a special runner). All other tests that were in the
blacklist, except for the aportgen test, had already been moved to
pmaports.git. Keeping them out of the blacklist makes it less confusing.

Now all tests are running in CI again.
2018-12-14 07:35:55 +01:00

46 lines
1.5 KiB
Bash
Executable file

#!/bin/sh -e
# usage: testcases_fast.sh [--all]
# Disable QEMU test, it runs on a special CI runner in parallel (see #1610).
disabled="qemu_running_processes"
# Optionally enable all test cases
if [ "$1" = "--all" ]; then
disabled=""
else
echo "Disabled test case(s): $disabled"
echo "Use '$(basename "$0") --all' to enable all test cases."
fi
# 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)"
work="$(./pmbootstrap.py config work)"
deviceinfo="$work/cache_git/pmaports/device/device-$device/deviceinfo"
if ! [ -e "$deviceinfo" ]; then
echo "ERROR: Could not find deviceinfo file for selected device '$device'."
echo "Expected path: $deviceinfo"
echo "Maybe you have switched to a branch where your device does not exist?"
echo "Use 'pmbootstrap config device qemu-amd64' to switch to a valid device."
exit 1
fi
# Filter out disabled testcases
enabled=""
for file in test/test_*.py; do
for test in $disabled; do
[ "test/test_${test}.py" = "$file" ] && continue 2
done
enabled="$enabled $file"
done
# Run enabled testcases with coverage enabled
# Note: Pytest is called through python so that this is compatible with
# running from a venv (e.g. in gitlab CI)
# shellcheck disable=SC2086
python3 -m pytest -vv -x --cov=pmb $enabled --tb=native