From 4c95928c962d12bdf6038a0b745384304e272045 Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 29 Aug 2014 22:22:39 +0400 Subject: [PATCH] Split shell tests into files I am mostly interested in running all python and vim tests separately from other tests. --- tests/run_lint_tests.sh | 7 +++++++ tests/run_python_tests.sh | 9 +++++++++ tests/run_shell_tests.sh | 9 +++++++++ tests/run_vim_tests.sh | 11 +++++++++++ tests/test.sh | 26 ++++---------------------- 5 files changed, 40 insertions(+), 22 deletions(-) create mode 100755 tests/run_lint_tests.sh create mode 100755 tests/run_python_tests.sh create mode 100755 tests/run_shell_tests.sh create mode 100755 tests/run_vim_tests.sh diff --git a/tests/run_lint_tests.sh b/tests/run_lint_tests.sh new file mode 100755 index 00000000..09157910 --- /dev/null +++ b/tests/run_lint_tests.sh @@ -0,0 +1,7 @@ +#!/bin/sh +FAILED=0 +if ! ${PYTHON} scripts/powerline-lint -p powerline/config_files ; then + echo "Failed powerline-lint" + FAILED=1 +fi +exit $FAILED diff --git a/tests/run_python_tests.sh b/tests/run_python_tests.sh new file mode 100755 index 00000000..62eac30a --- /dev/null +++ b/tests/run_python_tests.sh @@ -0,0 +1,9 @@ +#!/bin/sh +FAILED=0 +for file in tests/test_*.py ; do + if ! ${PYTHON} $file --verbose --catch ; then + echo "Failed test(s) from $file" + FAILED=1 + fi +done +exit $FAILED diff --git a/tests/run_shell_tests.sh b/tests/run_shell_tests.sh new file mode 100755 index 00000000..08655312 --- /dev/null +++ b/tests/run_shell_tests.sh @@ -0,0 +1,9 @@ +#!/bin/sh +FAILED=0 +if ! sh tests/test_shells/test.sh --fast ; then + echo "Failed shells" + if ${PYTHON} -c 'import platform, sys; sys.exit(1 * (platform.python_implementation() == "PyPy"))' ; then + FAILED=1 + fi +fi +exit $FAILED diff --git a/tests/run_vim_tests.sh b/tests/run_vim_tests.sh new file mode 100755 index 00000000..ef82ab35 --- /dev/null +++ b/tests/run_vim_tests.sh @@ -0,0 +1,11 @@ +#!/bin/sh +FAILED=0 +for script in tests/*.vim ; do + if ! vim -u NONE -S $script || test -f message.fail ; then + echo "Failed script $script" >&2 + cat message.fail >&2 + rm message.fail + FAILED=1 + fi +done +exit $FAILED diff --git a/tests/test.sh b/tests/test.sh index 129e0b5e..c1195f3f 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -1,29 +1,11 @@ #!/bin/sh -: ${PYTHON:=python} FAILED=0 +export PYTHON="${PYTHON:=python}" export PYTHONPATH="${PYTHONPATH}:`realpath .`" -for file in tests/test_*.py ; do - if ! ${PYTHON} $file --verbose --catch ; then - echo "Failed test(s) from $file" +for script in tests/run_*_tests.sh ; do + if ! sh $script ; then + echo "Failed $script" FAILED=1 fi done -if ! ${PYTHON} scripts/powerline-lint -p powerline/config_files ; then - echo "Failed powerline-lint" - FAILED=1 -fi -for script in tests/*.vim ; do - if ! vim -u NONE -S $script || test -f message.fail ; then - echo "Failed script $script" >&2 - cat message.fail >&2 - rm message.fail - FAILED=1 - fi -done -if ! bash tests/test_shells/test.sh --fast ; then - echo "Failed shells" - if ${PYTHON} -c 'import platform, sys; sys.exit(1 * (platform.python_implementation() == "PyPy"))' ; then - FAILED=1 - fi -fi exit $FAILED