tests: Add --force option to `tools/test-all`

Fixes #2996.
This commit is contained in:
Rafid Aslam 2017-01-01 19:37:38 +07:00 committed by showell
parent fdaed99222
commit f897cc5a8b
2 changed files with 54 additions and 4 deletions

33
tools/check-provision Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import os
import optparse
import sys
tools_dir = os.path.dirname(os.path.abspath(__file__))
root_dir = os.path.dirname(tools_dir)
sys.path.insert(0, root_dir)
from tools.lib.test_script import (
get_provisioning_status,
)
def run():
# type: () -> None
parser = optparse.OptionParser()
parser.add_option('--force', default=False,
action="store_true",
help='Run tests despite possible problems.')
(options, args) = parser.parse_args()
if not options.force:
ok, msg = get_provisioning_status()
if not ok:
print(msg)
print('If you really know what you are doing, use --force to run anyway.')
sys.exit(1)
if __name__ == '__main__':
run()

View File

@ -3,6 +3,22 @@ set -e
cd "$(dirname "$0")"/.. cd "$(dirname "$0")"/..
# read the options
TEMP=`getopt -o f --long force -- "$@"`
eval set -- "$TEMP"
# extract options.
while true ; do
case "$1" in
-f|--force)
FORCEARG="--force";
shift;;
--)
shift;
break;;
esac
done
function run { function run {
echo '----' echo '----'
echo "Running $@" echo "Running $@"
@ -14,20 +30,21 @@ function run {
fi fi
} }
run ./tools/check-provision $FORCEARG
run ./tools/clean-repo run ./tools/clean-repo
run ./tools/test-tools run ./tools/test-tools
run ./tools/lint-all --pep8 run ./tools/lint-all --pep8 $FORCEARG
run ./tools/test-migrations run ./tools/test-migrations
run ./tools/test-js-with-node run ./tools/test-js-with-node
run ./tools/run-mypy run ./tools/run-mypy
run ./tools/test-backend run ./tools/test-backend $FORCEARG
run ./tools/test-js-with-casper run ./tools/test-js-with-casper $FORCEARG
# Not running management test since it takes 40s and thus is too slow to be worth it. # Not running management test since it takes 40s and thus is too slow to be worth it.
# run ./tools/test-management # run ./tools/test-management
# Not running queue worker reload tests since it's low-churn code # Not running queue worker reload tests since it's low-churn code
# run ./tools/test-queue-worker-reload # run ./tools/test-queue-worker-reload
# Not running documentation tests since it takes 20s and only tests documentation # Not running documentation tests since it takes 20s and only tests documentation
# run ./tools/test-documentation # run ./tools/test-documentation
run ./tools/test-help-documentation.py run ./tools/test-help-documentation.py $FORCEARG
printf '\n\e[32mAll OK!\e[0m\n' printf '\n\e[32mAll OK!\e[0m\n'