etc-update: disable clear_term by default
[portage.git] / runtests.sh
index 1afbfb3f49f5d626d0b3e37c62cfc16f24b59201..11aec60f52eaf6f692f5764fc7cc77ed9b907b64 100755 (executable)
@@ -1,13 +1,35 @@
 #!/bin/bash
+# Copyright 2010-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
 
-PYTHON_VERSIONS="2.6 2.7 3.1 3.2"
+PYTHON_VERSIONS="2.6 2.7 3.1 3.2 3.3"
+
+case "${NOCOLOR:-false}" in
+       yes|true)
+               GOOD=
+               BAD=
+               NORMAL=
+               ;;
+       no|false)
+               GOOD=$'\e[1;32m'
+               BAD=$'\e[1;31m'
+               NORMAL=$'\e[0m'
+               ;;
+esac
+
+interrupted() {
+       echo "interrupted." >&2
+       exit 1
+}
+
+trap interrupted SIGINT
 
 exit_status="0"
 for version in ${PYTHON_VERSIONS}; do
        if [[ -x /usr/bin/python${version} ]]; then
-               echo -e "\e[1;32mTesting with Python ${version}...\e[0m"
-               if ! PYTHONPATH="pym${PYTHONPATH:+:}${PYTHONPATH}" /usr/bin/python${version} pym/portage/tests/runTests; then
-                       echo -e "\e[1;31mTesting with Python ${version} failed\e[0m"
+               echo -e "${GOOD}Testing with Python ${version}...${NORMAL}"
+               if ! /usr/bin/python${version} pym/portage/tests/runTests "$@" ; then
+                       echo -e "${BAD}Testing with Python ${version} failed${NORMAL}"
                        exit_status="1"
                fi
                echo