diff --git a/tools/check-provision b/tools/check-provision new file mode 100755 index 0000000000..3e57e991b9 --- /dev/null +++ b/tools/check-provision @@ -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() diff --git a/tools/test-all b/tools/test-all index 72a23477e1..038312fdef 100755 --- a/tools/test-all +++ b/tools/test-all @@ -3,6 +3,22 @@ set -e 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 { echo '----' echo "Running $@" @@ -14,20 +30,21 @@ function run { fi } +run ./tools/check-provision $FORCEARG run ./tools/clean-repo run ./tools/test-tools -run ./tools/lint-all --pep8 +run ./tools/lint-all --pep8 $FORCEARG run ./tools/test-migrations run ./tools/test-js-with-node run ./tools/run-mypy -run ./tools/test-backend -run ./tools/test-js-with-casper +run ./tools/test-backend $FORCEARG +run ./tools/test-js-with-casper $FORCEARG # Not running management test since it takes 40s and thus is too slow to be worth it. # run ./tools/test-management # Not running queue worker reload tests since it's low-churn code # run ./tools/test-queue-worker-reload # Not running documentation tests since it takes 20s and only tests 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'