aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2007-03-29 12:02:24 +0000
committerMichael Meskes <meskes@postgresql.org>2007-03-29 12:02:24 +0000
commitddcb5bbf76dd991b5a7024bc3d4e212b97d27936 (patch)
tree0b6247677e8a9cf3ea60df6ae5474225f4e11ecb /src/interfaces/ecpg/test
parentfba8113c1b74b9508cf2e6b7a18b0fb3637d9ba0 (diff)
downloadpostgresql-ddcb5bbf76dd991b5a7024bc3d4e212b97d27936.tar.gz
postgresql-ddcb5bbf76dd991b5a7024bc3d4e212b97d27936.zip
- Added patch by Magnus Hagander <magnus@hagander.net> to use native
win32 threads. - Fixed regression tests to run threading tests.
Diffstat (limited to 'src/interfaces/ecpg/test')
-rw-r--r--src/interfaces/ecpg/test/Makefile9
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread-thread.stdout1
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread.c79
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread.stdout2
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread_implicit-thread.stdout1
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread_implicit.c79
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread_implicit.stdout2
-rw-r--r--src/interfaces/ecpg/test/pg_regress.sh22
-rw-r--r--src/interfaces/ecpg/test/thread/thread.pgc25
-rw-r--r--src/interfaces/ecpg/test/thread/thread_implicit.pgc25
10 files changed, 105 insertions, 140 deletions
diff --git a/src/interfaces/ecpg/test/Makefile b/src/interfaces/ecpg/test/Makefile
index e5934c6fb32..f68ae926da8 100644
--- a/src/interfaces/ecpg/test/Makefile
+++ b/src/interfaces/ecpg/test/Makefile
@@ -1,4 +1,4 @@
-# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.66 2007/02/09 15:55:59 petere Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.67 2007/03/29 12:02:24 meskes Exp $
subdir = src/interfaces/ecpg/test
top_builddir = ../../../..
@@ -11,6 +11,9 @@ TEMP_PORT = 5$(DEF_PGPORT)
# default encoding
MULTIBYTE = SQL_ASCII
+# threading
+THREAD := $(shell grep -q "define ENABLE_THREAD_SAFETY" ../include/ecpg_config.h && echo "--enable-threading")
+
# locale
NOLOCALE =
ifdef NO_LOCALE
@@ -75,11 +78,11 @@ endif
check: all
- sh ./pg_regress --dbname=regress1 --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
+ sh ./pg_regress --dbname=regress1 --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) $(THREAD)
# the same options, but with --listen-on-tcp
checktcp: all
- sh ./pg_regress --dbname=regress1 --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) --listen-on-tcp
+ sh ./pg_regress --dbname=regress1 --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) --listen-on-tcp $(THREAD)
installcheck: all
sh ./pg_regress --dbname=regress1 --top-builddir=$(top_builddir) --load-language=plpgsql $(NOLOCALE)
diff --git a/src/interfaces/ecpg/test/expected/thread-thread-thread.stdout b/src/interfaces/ecpg/test/expected/thread-thread-thread.stdout
new file mode 100644
index 00000000000..a9d787cc55c
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-thread-thread.stdout
@@ -0,0 +1 @@
+Success.
diff --git a/src/interfaces/ecpg/test/expected/thread-thread.c b/src/interfaces/ecpg/test/expected/thread-thread.c
index ae720f4d6e9..5011640b327 100644
--- a/src/interfaces/ecpg/test/expected/thread-thread.c
+++ b/src/interfaces/ecpg/test/expected/thread-thread.c
@@ -13,19 +13,18 @@
* by Philip Yarra & Lee Kindness.
*/
#include <stdlib.h>
+#include "ecpg_config.h"
+
#ifndef ENABLE_THREAD_SAFETY
int
main(void)
{
- printf("Success.\n");
+ printf("No threading enabled.\n");
return 0;
}
#else
#include <pthread.h>
-#undef DEBUG
-
-
#line 1 "regression.h"
@@ -34,7 +33,7 @@ main(void)
-#line 19 "thread.pgc"
+#line 18 "thread.pgc"
void *test_thread(void *arg);
@@ -49,36 +48,34 @@ int main(int argc, char *argv[])
/* exec sql begin declare section */
-#line 31 "thread.pgc"
+#line 30 "thread.pgc"
int l_rows ;
/* exec sql end declare section */
-#line 32 "thread.pgc"
-
+#line 31 "thread.pgc"
- /* Switch off debug output for regression tests. The threads get executed in
+ /* Do not switch on debug output for regression tests. The threads get executed in
* more or less random order */
- ECPGdebug(0, stderr);
-
+ /* ECPGdebug(1, stderr); */
/* setup test_thread table */
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
-#line 41 "thread.pgc"
+#line 38 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test_thread ", ECPGt_EOIT, ECPGt_EORT);}
-#line 42 "thread.pgc"
+#line 39 "thread.pgc"
/* DROP might fail */
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 43 "thread.pgc"
+#line 40 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test_thread ( tstamp timestamp not null default cast( timeofday () as timestamp ) , thread TEXT not null , iteration integer not null , primary key( thread , iteration ) ) ", ECPGt_EOIT, ECPGt_EORT);}
-#line 48 "thread.pgc"
+#line 45 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 49 "thread.pgc"
+#line 46 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 50 "thread.pgc"
+#line 47 "thread.pgc"
/* create, and start, threads */
@@ -102,18 +99,18 @@ int main(int argc, char *argv[])
/* and check results */
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
-#line 72 "thread.pgc"
+#line 69 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select count (*) from test_thread ", ECPGt_EOIT,
ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
-#line 73 "thread.pgc"
+#line 70 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 74 "thread.pgc"
+#line 71 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 75 "thread.pgc"
+#line 72 "thread.pgc"
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
@@ -130,25 +127,25 @@ void *test_thread(void *arg)
-#line 88 "thread.pgc"
+#line 85 "thread.pgc"
int l_i ;
-#line 89 "thread.pgc"
+#line 86 "thread.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
-#line 90 "thread.pgc"
+#line 87 "thread.pgc"
/* build up connection name, and connect to database */
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
/* exec sql whenever sqlerror sqlprint ; */
-#line 94 "thread.pgc"
+#line 91 "thread.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , l_connection, 0);
-#line 95 "thread.pgc"
+#line 92 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 95 "thread.pgc"
+#line 92 "thread.pgc"
if( sqlca.sqlcode != 0 )
{
@@ -156,52 +153,42 @@ if (sqlca.sqlcode < 0) sqlprint();}
return( NULL );
}
{ ECPGtrans(__LINE__, l_connection, "begin transaction ");
-#line 101 "thread.pgc"
+#line 98 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 101 "thread.pgc"
+#line 98 "thread.pgc"
/* insert into test_thread table */
for( l_i = 1; l_i <= iterations; l_i++ )
{
-#ifdef DEBUG
- printf("%s: inserting %d\n", l_connection, l_i);
-#endif
{ ECPGdo(__LINE__, 0, 1, l_connection, "insert into test_thread ( thread , iteration ) values ( ? , ? ) ",
ECPGt_char,(l_connection),(long)128,(long)1,(128)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 109 "thread.pgc"
+#line 103 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 109 "thread.pgc"
+#line 103 "thread.pgc"
-#ifdef DEBUG
- if( sqlca.sqlcode == 0 )
- printf("%s: insert done\n", l_connection);
- else
+ if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
-#endif
}
/* all done */
{ ECPGtrans(__LINE__, l_connection, "commit");
-#line 119 "thread.pgc"
+#line 109 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 119 "thread.pgc"
+#line 109 "thread.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
-#line 120 "thread.pgc"
+#line 110 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 120 "thread.pgc"
+#line 110 "thread.pgc"
-#ifdef DEBUG
- printf("%s: done!\n", l_connection);
-#endif
return( NULL );
}
#endif /* ENABLE_THREAD_SAFETY */
diff --git a/src/interfaces/ecpg/test/expected/thread-thread.stdout b/src/interfaces/ecpg/test/expected/thread-thread.stdout
index a9d787cc55c..75fe16bb36b 100644
--- a/src/interfaces/ecpg/test/expected/thread-thread.stdout
+++ b/src/interfaces/ecpg/test/expected/thread-thread.stdout
@@ -1 +1 @@
-Success.
+No threading enabled.
diff --git a/src/interfaces/ecpg/test/expected/thread-thread_implicit-thread.stdout b/src/interfaces/ecpg/test/expected/thread-thread_implicit-thread.stdout
new file mode 100644
index 00000000000..a9d787cc55c
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-thread_implicit-thread.stdout
@@ -0,0 +1 @@
+Success.
diff --git a/src/interfaces/ecpg/test/expected/thread-thread_implicit.c b/src/interfaces/ecpg/test/expected/thread-thread_implicit.c
index c004a7d1167..1fd3faa48d5 100644
--- a/src/interfaces/ecpg/test/expected/thread-thread_implicit.c
+++ b/src/interfaces/ecpg/test/expected/thread-thread_implicit.c
@@ -14,19 +14,18 @@
*/
#include <stdlib.h>
+#include "ecpg_config.h"
+
#ifndef ENABLE_THREAD_SAFETY
int
main(void)
{
- printf("Success.\n");
+ printf("No threading enabled.\n");
return 0;
}
#else
#include <pthread.h>
-#undef DEBUG
-
-
#line 1 "regression.h"
@@ -35,7 +34,7 @@ main(void)
-#line 20 "thread_implicit.pgc"
+#line 19 "thread_implicit.pgc"
void *test_thread(void *arg);
@@ -50,36 +49,34 @@ int main(int argc, char *argv[])
/* exec sql begin declare section */
-#line 32 "thread_implicit.pgc"
+#line 31 "thread_implicit.pgc"
int l_rows ;
/* exec sql end declare section */
-#line 33 "thread_implicit.pgc"
-
+#line 32 "thread_implicit.pgc"
- /* Switch off debug output for regression tests. The threads get executed in
+ /* Do not switch on debug output for regression tests. The threads get executed in
* more or less random order */
- ECPGdebug(0, stderr);
-
+ /* ECPGdebug(1, stderr); */
/* setup test_thread table */
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
-#line 42 "thread_implicit.pgc"
+#line 39 "thread_implicit.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test_thread ", ECPGt_EOIT, ECPGt_EORT);}
-#line 43 "thread_implicit.pgc"
+#line 40 "thread_implicit.pgc"
/* DROP might fail */
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 44 "thread_implicit.pgc"
+#line 41 "thread_implicit.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test_thread ( tstamp timestamp not null default cast( timeofday () as timestamp ) , thread TEXT not null , iteration integer not null , primary key( thread , iteration ) ) ", ECPGt_EOIT, ECPGt_EORT);}
-#line 49 "thread_implicit.pgc"
+#line 46 "thread_implicit.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 50 "thread_implicit.pgc"
+#line 47 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 51 "thread_implicit.pgc"
+#line 48 "thread_implicit.pgc"
/* create, and start, threads */
@@ -103,18 +100,18 @@ int main(int argc, char *argv[])
/* and check results */
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
-#line 73 "thread_implicit.pgc"
+#line 70 "thread_implicit.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select count (*) from test_thread ", ECPGt_EOIT,
ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
-#line 74 "thread_implicit.pgc"
+#line 71 "thread_implicit.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 75 "thread_implicit.pgc"
+#line 72 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 76 "thread_implicit.pgc"
+#line 73 "thread_implicit.pgc"
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
@@ -131,25 +128,25 @@ void *test_thread(void *arg)
-#line 89 "thread_implicit.pgc"
+#line 86 "thread_implicit.pgc"
int l_i ;
-#line 90 "thread_implicit.pgc"
+#line 87 "thread_implicit.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
-#line 91 "thread_implicit.pgc"
+#line 88 "thread_implicit.pgc"
/* build up connection name, and connect to database */
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
/* exec sql whenever sqlerror sqlprint ; */
-#line 95 "thread_implicit.pgc"
+#line 92 "thread_implicit.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , l_connection, 0);
-#line 96 "thread_implicit.pgc"
+#line 93 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 96 "thread_implicit.pgc"
+#line 93 "thread_implicit.pgc"
if( sqlca.sqlcode != 0 )
{
@@ -157,52 +154,42 @@ if (sqlca.sqlcode < 0) sqlprint();}
return( NULL );
}
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
-#line 102 "thread_implicit.pgc"
+#line 99 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 102 "thread_implicit.pgc"
+#line 99 "thread_implicit.pgc"
/* insert into test_thread table */
for( l_i = 1; l_i <= iterations; l_i++ )
{
-#ifdef DEBUG
- printf("%s: inserting %d\n", l_connection, l_i);
-#endif
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test_thread ( thread , iteration ) values ( ? , ? ) ",
ECPGt_char,(l_connection),(long)128,(long)1,(128)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 110 "thread_implicit.pgc"
+#line 104 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 110 "thread_implicit.pgc"
+#line 104 "thread_implicit.pgc"
-#ifdef DEBUG
- if( sqlca.sqlcode == 0 )
- printf("%s: insert done\n", l_connection);
- else
+ if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
-#endif
}
/* all done */
{ ECPGtrans(__LINE__, NULL, "commit");
-#line 120 "thread_implicit.pgc"
+#line 110 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 120 "thread_implicit.pgc"
+#line 110 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
-#line 121 "thread_implicit.pgc"
+#line 111 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 121 "thread_implicit.pgc"
+#line 111 "thread_implicit.pgc"
-#ifdef DEBUG
- printf("%s: done!\n", l_connection);
-#endif
return( NULL );
}
#endif /* ENABLE_THREAD_SAFETY */
diff --git a/src/interfaces/ecpg/test/expected/thread-thread_implicit.stdout b/src/interfaces/ecpg/test/expected/thread-thread_implicit.stdout
index a9d787cc55c..75fe16bb36b 100644
--- a/src/interfaces/ecpg/test/expected/thread-thread_implicit.stdout
+++ b/src/interfaces/ecpg/test/expected/thread-thread_implicit.stdout
@@ -1 +1 @@
-Success.
+No threading enabled.
diff --git a/src/interfaces/ecpg/test/pg_regress.sh b/src/interfaces/ecpg/test/pg_regress.sh
index 8b748bf8013..a164953ed8c 100644
--- a/src/interfaces/ecpg/test/pg_regress.sh
+++ b/src/interfaces/ecpg/test/pg_regress.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.18 2007/01/21 09:23:29 petere Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.19 2007/03/29 12:02:24 meskes Exp $
me=`basename $0`
@@ -34,6 +34,7 @@ Options for \`temp-install' mode:
--top-builddir=DIR (relative) path to top level build directory
--temp-port=PORT port number to start temp postmaster on
--listen-on-tcp listen on the tcp port as well
+ --enable-threading expect threading to be enabled
Options for using an existing installation:
--host=HOST use postmaster running on HOST
@@ -78,6 +79,7 @@ init_vars(){
temp_port=65432
load_langs=""
listen_on_tcp=no
+ enable_threading=no
: ${GMAKE='@GMAKE@'}
}
@@ -108,6 +110,9 @@ do
--listen-on-tcp)
listen_on_tcp=yes
shift;;
+ --enable-threading)
+ enable_threading=yes
+ shift;;
--load-language=*)
lang=`expr "x$1" : "x--load-language=\(.*\)"`
load_langs="$load_langs $lang"
@@ -751,14 +756,21 @@ for i in \
cat "$outfile_source.tmp" | sed -e 's,^\(#line [0-9]*\) ".*/\([^/]*\)",\1 "\2",' > "$outfile_source"
rm "$outfile_source.tmp"
+ if [ "$enable_threading" = yes ] && [ "${i%%/*}" = "thread" ]; then
+ expectedoutprg="expected/$outprg-thread"
+ else
+ expectedoutprg="expected/$outprg"
+ fi
+
+ expected_stdout="$expectedoutprg$PLATFORM_TAG.stdout"
+ if [ ! -f "$expected_stdout" ]; then
+ expected_stdout="$expectedoutprg.stdout"
+ fi
+ # threading has log output disabled
expected_stderr="expected/$outprg$PLATFORM_TAG.stderr"
if [ ! -f "$expected_stderr" ]; then
expected_stderr="expected/$outprg.stderr"
fi
- expected_stdout="expected/$outprg$PLATFORM_TAG.stdout"
- if [ ! -f "$expected_stdout" ]; then
- expected_stdout="expected/$outprg.stdout"
- fi
# the source should be identical on all platforms
expected_source="expected/$outprg.c"
diff --git a/src/interfaces/ecpg/test/thread/thread.pgc b/src/interfaces/ecpg/test/thread/thread.pgc
index 58763564abf..e7f0b4d1dca 100644
--- a/src/interfaces/ecpg/test/thread/thread.pgc
+++ b/src/interfaces/ecpg/test/thread/thread.pgc
@@ -3,19 +3,18 @@
* by Philip Yarra & Lee Kindness.
*/
#include <stdlib.h>
+#include "ecpg_config.h"
+
#ifndef ENABLE_THREAD_SAFETY
int
main(void)
{
- printf("Success.\n");
+ printf("No threading enabled.\n");
return 0;
}
#else
#include <pthread.h>
-#undef DEBUG
-
-
exec sql include ../regression;
void *test_thread(void *arg);
@@ -31,11 +30,9 @@ int main(int argc, char *argv[])
int l_rows;
EXEC SQL END DECLARE SECTION;
-
- /* Switch off debug output for regression tests. The threads get executed in
+ /* Do not switch on debug output for regression tests. The threads get executed in
* more or less random order */
- ECPGdebug(0, stderr);
-
+ /* ECPGdebug(1, stderr); */
/* setup test_thread table */
EXEC SQL CONNECT TO REGRESSDB1;
@@ -103,24 +100,14 @@ void *test_thread(void *arg)
/* insert into test_thread table */
for( l_i = 1; l_i <= iterations; l_i++ )
{
-#ifdef DEBUG
- printf("%s: inserting %d\n", l_connection, l_i);
-#endif
EXEC SQL AT :l_connection INSERT INTO test_thread(thread, iteration) VALUES(:l_connection, :l_i);
-#ifdef DEBUG
- if( sqlca.sqlcode == 0 )
- printf("%s: insert done\n", l_connection);
- else
+ if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
-#endif
}
/* all done */
EXEC SQL AT :l_connection COMMIT;
EXEC SQL DISCONNECT :l_connection;
-#ifdef DEBUG
- printf("%s: done!\n", l_connection);
-#endif
return( NULL );
}
#endif /* ENABLE_THREAD_SAFETY */
diff --git a/src/interfaces/ecpg/test/thread/thread_implicit.pgc b/src/interfaces/ecpg/test/thread/thread_implicit.pgc
index 9353cf14be6..e4033849600 100644
--- a/src/interfaces/ecpg/test/thread/thread_implicit.pgc
+++ b/src/interfaces/ecpg/test/thread/thread_implicit.pgc
@@ -4,19 +4,18 @@
*/
#include <stdlib.h>
+#include "ecpg_config.h"
+
#ifndef ENABLE_THREAD_SAFETY
int
main(void)
{
- printf("Success.\n");
+ printf("No threading enabled.\n");
return 0;
}
#else
#include <pthread.h>
-#undef DEBUG
-
-
exec sql include ../regression;
void *test_thread(void *arg);
@@ -32,11 +31,9 @@ int main(int argc, char *argv[])
int l_rows;
EXEC SQL END DECLARE SECTION;
-
- /* Switch off debug output for regression tests. The threads get executed in
+ /* Do not switch on debug output for regression tests. The threads get executed in
* more or less random order */
- ECPGdebug(0, stderr);
-
+ /* ECPGdebug(1, stderr); */
/* setup test_thread table */
EXEC SQL CONNECT TO REGRESSDB1;
@@ -104,24 +101,14 @@ void *test_thread(void *arg)
/* insert into test_thread table */
for( l_i = 1; l_i <= iterations; l_i++ )
{
-#ifdef DEBUG
- printf("%s: inserting %d\n", l_connection, l_i);
-#endif
EXEC SQL INSERT INTO test_thread(thread, iteration) VALUES(:l_connection, :l_i);
-#ifdef DEBUG
- if( sqlca.sqlcode == 0 )
- printf("%s: insert done\n", l_connection);
- else
+ if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
-#endif
}
/* all done */
EXEC SQL COMMIT;
EXEC SQL DISCONNECT :l_connection;
-#ifdef DEBUG
- printf("%s: done!\n", l_connection);
-#endif
return( NULL );
}
#endif /* ENABLE_THREAD_SAFETY */