1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
#!/bin/bash
set -e
# Neither run with sudo
if [ -n "${SUDO_USER}" ]; then
echo "./ci-run should NOT be run using ``sudo``"
# root is ok but only if root did the git clone
exit 3
fi
# Parse command line
while getopts ":bcdopst" opt; do
case $opt in
b)
# run black
BLACK=true
;;
c)
# clean only
CLEAN=true
;;
d)
# lava_dispatcher
DISPATCH=true
;;
o)
# lava_common
COMMON=true
;;
s)
# lava_server
SERVER=true
;;
t)
# template tests only
TEMPLATE=true
;;
*)
echo "Usage:"
echo "-c - clean targets only"
echo "-b - run black"
echo "-d - test dispatcher"
echo "-o - test common"
echo "-s - test server"
echo "-t - test templates"
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
shift $((OPTIND -1))
if [ -z "${BLACK}" ] && [ -z "${CLEAN}" ] && [ -z "${DISPATCH}" ] && [ -z "${COMMON}" ] && [ -z "${SERVER}" ] && [ -z "${TEMPLATE}" ]
then
BLACK=true
COMMON=true
DISPATCH=true
SERVER=true
fi
echo "Removing old .pyc files and cache"
echo
find . -name '*.pyc' -delete
rm -rf ./.cache/
rm -rf ./__init__.py
rm -rf lava.egg-info/
rm -rf .pytest_cache/
find . -name __pycache__ -exec rmdir "{}" \; 2>/dev/null || true
[ -n "${CLEAN}" ] && exit 0
if [ "${BLACK}" ]
then
echo "Calling black"
echo
.gitlab-ci/analyze/black.sh
fi
if [ -n "${TEMPLATE}" ]
then
echo "Testing templates"
echo
PYTHONPATH=. pytest-3 --cache-clear -v tests/lava_scheduler_app/test_base_templates.py tests/lava_scheduler_app/test_templates.py tests/lava_scheduler_app/test_barebox_templates.py tests/lava_scheduler_app/test_uboot_templates.py tests/lava_dispatcher/test_uboot_dfu.py tests/lava_scheduler_app/test_fastboot_templates.py tests/lava_scheduler_app/test_grub_templates.py tests/lava_scheduler_app/test_qemu_templates.py
fi
if [ -n "${COMMON}" ]
then
echo "Testing common"
echo
python3 -m pytest --cache-clear -v tests/lava_common
fi
if [ -n "${DISPATCH}" ]
then
echo "Testing dispatcher"
echo
python3 -m pytest --cache-clear -v tests/lava_dispatcher tests/lava_dispatcher_host tests/lava_coordinator
fi
if [ -n "${SERVER}" ]
then
echo "Testing server"
echo
python3 -m pytest --cache-clear -v --reuse-db tests/lava_scheduler_app tests/lava_results_app tests/linaro_django_xmlrpc tests/lava_rest_app tests/lava_server
fi
|