2016-12-24 04:15:24 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Run the tests in all the databases
|
|
|
|
# The script is designed for a Trusty environment.
|
2017-02-06 04:14:06 +03:00
|
|
|
#
|
|
|
|
# The variables TEST_PAST, TEST_FUTURE, DONT_TEST_PRESENT can be used to test
|
|
|
|
# against unsupported Postgres versions and skip tests with supported ones.
|
|
|
|
#
|
|
|
|
# The variables TEST_VERBOSE enables verbose test log.
|
|
|
|
#
|
|
|
|
# The variables can be set in the travis configuration
|
|
|
|
# (https://travis-ci.org/psycopg/psycopg2/settings)
|
2016-12-24 04:15:24 +03:00
|
|
|
|
2017-02-06 04:14:06 +03:00
|
|
|
set -e -x
|
2016-12-24 04:15:24 +03:00
|
|
|
|
|
|
|
run_test () {
|
2017-02-06 04:14:06 +03:00
|
|
|
VERSION=$1
|
|
|
|
DBNAME=psycopg2_test
|
2019-10-19 15:49:27 +03:00
|
|
|
if (( "$TEST_VERBOSE" )); then
|
2017-02-06 04:14:06 +03:00
|
|
|
VERBOSE=--verbose
|
|
|
|
else
|
|
|
|
VERBOSE=
|
|
|
|
fi
|
2016-12-24 04:15:24 +03:00
|
|
|
|
2017-02-06 04:14:06 +03:00
|
|
|
# Port number: 9.6 -> 50906
|
2017-06-08 20:45:07 +03:00
|
|
|
port=$(echo $VERSION \
|
|
|
|
| sed 's/\([0-9]\+\)\(\.\([0-9]\+\)\)\?/50000 + 100 * \1 + 0\3/' | bc)
|
2017-02-06 04:14:06 +03:00
|
|
|
|
|
|
|
printf "\n\nRunning tests against PostgreSQL $VERSION (port $port)\n\n"
|
|
|
|
export PSYCOPG2_TESTDB=$DBNAME
|
|
|
|
export PSYCOPG2_TESTDB_HOST=localhost
|
2016-12-24 04:15:24 +03:00
|
|
|
export PSYCOPG2_TESTDB_PORT=$port
|
|
|
|
export PSYCOPG2_TESTDB_USER=travis
|
2016-12-25 19:49:58 +03:00
|
|
|
export PSYCOPG2_TEST_REPL_DSN=
|
2016-12-26 06:31:18 +03:00
|
|
|
unset PSYCOPG2_TEST_GREEN
|
2017-02-06 04:14:06 +03:00
|
|
|
python -c \
|
2017-12-04 05:47:19 +03:00
|
|
|
"import tests; tests.unittest.main(defaultTest='tests.test_suite')" \
|
2017-02-06 04:14:06 +03:00
|
|
|
$VERBOSE
|
2016-12-24 04:15:24 +03:00
|
|
|
|
2017-02-06 04:14:06 +03:00
|
|
|
printf "\n\nRunning tests against PostgreSQL $VERSION (green mode)\n\n"
|
2016-12-24 04:15:24 +03:00
|
|
|
export PSYCOPG2_TEST_GREEN=1
|
2017-02-06 04:14:06 +03:00
|
|
|
python -c \
|
2017-12-04 05:47:19 +03:00
|
|
|
"import tests; tests.unittest.main(defaultTest='tests.test_suite')" \
|
2017-02-06 04:14:06 +03:00
|
|
|
$VERBOSE
|
2016-12-24 04:15:24 +03:00
|
|
|
}
|
|
|
|
|
2017-02-06 04:14:06 +03:00
|
|
|
# Postgres versions supported by Travis CI
|
2019-10-19 15:49:27 +03:00
|
|
|
if (( ! "$DONT_TEST_PRESENT" )); then
|
2019-10-19 15:08:29 +03:00
|
|
|
run_test 12
|
|
|
|
run_test 11
|
2017-10-19 01:02:08 +03:00
|
|
|
run_test 10
|
2017-02-06 04:14:06 +03:00
|
|
|
run_test 9.6
|
|
|
|
run_test 9.5
|
|
|
|
run_test 9.4
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Unsupported postgres versions that we still support
|
|
|
|
# Images built by https://github.com/psycopg/psycopg2-wheels/tree/build-dinosaurs
|
2019-10-19 15:49:27 +03:00
|
|
|
if (( "$TEST_PAST" )); then
|
2018-07-13 21:09:33 +03:00
|
|
|
run_test 9.3
|
2017-10-19 01:02:08 +03:00
|
|
|
run_test 9.2
|
2018-05-14 04:41:32 +03:00
|
|
|
run_test 9.1
|
|
|
|
run_test 9.0
|
|
|
|
run_test 8.4
|
|
|
|
run_test 8.3
|
|
|
|
run_test 8.2
|
|
|
|
run_test 8.1
|
|
|
|
run_test 8.0
|
|
|
|
run_test 7.4
|
2017-02-06 04:14:06 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Postgres built from master
|
2019-10-19 15:49:27 +03:00
|
|
|
if (( "$TEST_FUTURE" )); then
|
2019-10-19 15:08:29 +03:00
|
|
|
run_test 13
|
2017-02-06 04:14:06 +03:00
|
|
|
fi
|