From f280726037195912fe5f7ad7c1af37f6a2271767 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Thu, 26 Nov 2015 16:50:44 +0000 Subject: [PATCH 1/4] Run sytest against postgresql if appropriate databases exist for it to run against --- jenkins.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/jenkins.sh b/jenkins.sh index 8d2ac63c5..d4f8e06bc 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -42,4 +42,37 @@ export PERL5LIB PERL_MB_OPT PERL_MM_OPT ./install-deps.pl +for port in 800{1,2}; do + if test -e localhost-$port/database.yaml; then + cat > localhost-$port/database.yaml << EOF +name: sqlite3 +args: + database: ':memory:' +EOF + fi +done + +echo >&2 "Running sytest with SQLite3"; ./run-tests.pl -O tap --synapse-directory .. --all > results.tap + +RUN_POSTGRES="" + +for port in 800{1,2}; do + if psql synapse_jenkins_$port <<< ""; then + RUN_POSTGRES=$RUN_POSTGRES:$port + cat > localhost-$port/database.yaml << EOF +name: psycopg2 +args: + database: synapse_jenkins_$port +EOF + fi +done + +# Run if both postgresql databases exist +if test $RUN_POSTGRES = ":8001:8002"; then + echo >&2 "Running sytest with PostgreSQL"; + pip install psycopg2 + ./run-tests.pl -O tap --synapse-directory .. --all > results.tap +else + echo >&2 "Skipping running sytest with PostgreSQL, $RUN_POSTGRES" +fi From a33c0748e3ba82e789557858519cf8561ed86f9c Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 1 Dec 2015 11:48:20 +0000 Subject: [PATCH 2/4] Use a PORT_BASE environment variable to configure the ports that sytest uses --- jenkins.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/jenkins.sh b/jenkins.sh index d4f8e06bc..63d80ab35 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -42,22 +42,14 @@ export PERL5LIB PERL_MB_OPT PERL_MM_OPT ./install-deps.pl -for port in 800{1,2}; do - if test -e localhost-$port/database.yaml; then - cat > localhost-$port/database.yaml << EOF -name: sqlite3 -args: - database: ':memory:' -EOF - fi -done +: ${PORT_BASE:=8000} echo >&2 "Running sytest with SQLite3"; -./run-tests.pl -O tap --synapse-directory .. --all > results.tap +./run-tests.pl -O tap --synapse-directory .. --all --port-base $PORT_BASE > results.tap RUN_POSTGRES="" -for port in 800{1,2}; do +for port in $(($PORT_BASE + 1)) $(($PORT_BASE + 2)); do if psql synapse_jenkins_$port <<< ""; then RUN_POSTGRES=$RUN_POSTGRES:$port cat > localhost-$port/database.yaml << EOF @@ -69,7 +61,7 @@ EOF done # Run if both postgresql databases exist -if test $RUN_POSTGRES = ":8001:8002"; then +if test $RUN_POSTGRES = ":$(($PORT_BASE + 1)):$(($PORT_BASE + 2))"; then echo >&2 "Running sytest with PostgreSQL"; pip install psycopg2 ./run-tests.pl -O tap --synapse-directory .. --all > results.tap From 8c902431baf5cc7b5a9208e235350d6e348ce959 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 1 Dec 2015 12:01:29 +0000 Subject: [PATCH 3/4] Set the port when running sytest under postgresql --- jenkins.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins.sh b/jenkins.sh index 63d80ab35..26e0088cd 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -64,7 +64,7 @@ done if test $RUN_POSTGRES = ":$(($PORT_BASE + 1)):$(($PORT_BASE + 2))"; then echo >&2 "Running sytest with PostgreSQL"; pip install psycopg2 - ./run-tests.pl -O tap --synapse-directory .. --all > results.tap + ./run-tests.pl -O tap --synapse-directory .. --all --port-base $PORT_BASE > results.tap else echo >&2 "Skipping running sytest with PostgreSQL, $RUN_POSTGRES" fi From 5f9a2cb337206a1f9b197afe25859a6894e1ccbf Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 1 Dec 2015 13:24:43 +0000 Subject: [PATCH 4/4] Write the tap results for each database to different files when running sytest --- jenkins.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins.sh b/jenkins.sh index 26e0088cd..0018ca610 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -45,7 +45,7 @@ export PERL5LIB PERL_MB_OPT PERL_MM_OPT : ${PORT_BASE:=8000} echo >&2 "Running sytest with SQLite3"; -./run-tests.pl -O tap --synapse-directory .. --all --port-base $PORT_BASE > results.tap +./run-tests.pl -O tap --synapse-directory .. --all --port-base $PORT_BASE > results-sqlite3.tap RUN_POSTGRES="" @@ -64,7 +64,7 @@ done if test $RUN_POSTGRES = ":$(($PORT_BASE + 1)):$(($PORT_BASE + 2))"; then echo >&2 "Running sytest with PostgreSQL"; pip install psycopg2 - ./run-tests.pl -O tap --synapse-directory .. --all --port-base $PORT_BASE > results.tap + ./run-tests.pl -O tap --synapse-directory .. --all --port-base $PORT_BASE > results-postgresql.tap else echo >&2 "Skipping running sytest with PostgreSQL, $RUN_POSTGRES" fi