Update doc string of portage.dep.extract_affecting_use().
[portage.git] / runtests.sh
1 #!/bin/bash
2 # Copyright 2010-2012 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 PYTHON_VERSIONS="2.6 2.7 2.7-pypy-1.8 2.7-pypy-1.9 3.1 3.2 3.3 3.4"
6
7 # has to be run from portage root dir
8 cd "${0%/*}" || exit 1
9
10 case "${NOCOLOR:-false}" in
11         yes|true)
12                 GOOD=
13                 BAD=
14                 NORMAL=
15                 ;;
16         no|false)
17                 GOOD=$'\e[1;32m'
18                 BAD=$'\e[1;31m'
19                 NORMAL=$'\e[0m'
20                 ;;
21 esac
22
23 interrupted() {
24         echo "interrupted." >&2
25         exit 1
26 }
27
28 trap interrupted SIGINT
29
30 unused_args=()
31
32 while [ $# -gt 0 ] ; do
33         case "$1" in
34                 --python-versions=*)
35                         PYTHON_VERSIONS=${1#--python-versions=}
36                         ;;
37                 --python-versions)
38                         shift
39                         PYTHON_VERSIONS=$1
40                         ;;
41                 *)
42                         unused_args[${#unused_args[@]}]=$1
43                         ;;
44         esac
45         shift
46 done
47
48 set -- "${unused_args[@]}"
49
50 eprefix=${PORTAGE_OVERRIDE_EPREFIX}
51 exit_status="0"
52 for version in ${PYTHON_VERSIONS}; do
53         if [[ $version =~ ^([[:digit:]]+\.[[:digit:]]+)-pypy-([[:digit:]]+\.[[:digit:]]+)$ ]] ; then
54                 executable=${eprefix}/usr/bin/pypy-c${BASH_REMATCH[2]}
55         else
56                 executable=${eprefix}/usr/bin/python${version}
57         fi
58         if [[ -x "${executable}" ]]; then
59                 echo -e "${GOOD}Testing with Python ${version}...${NORMAL}"
60                 if ! "${executable}" -Wd pym/portage/tests/runTests "$@" ; then
61                         echo -e "${BAD}Testing with Python ${version} failed${NORMAL}"
62                         exit_status="1"
63                 fi
64                 echo
65         fi
66 done
67
68 exit ${exit_status}