1From 96896b88776d0080609ec830cf9538d2babe665a Mon Sep 17 00:00:00 2001 2From: Jackie Huang <jackie.huang@windriver.com> 3Date: Tue, 5 Sep 2017 10:24:10 +0800 4Subject: [PATCH] psqlodbc: fixes for ptest support 5 6* Fix the LIBODBC since we don't use ODBC_CONFIG. 7* Fix the path for driver. 8* Add the default info of postgresql server. 9* Fix the output format for ptest. 10* Fix the results and exe dir. 11 12Upstream-Status: Inappropriate [OE ptest specific] 13 14Signed-off-by: Jackie Huang <jackie.huang@windriver.com> 15 16--- 17 test/Makefile.in | 2 +- 18 test/odbcini-gen.sh | 8 ++++---- 19 test/runsuite.c | 20 ++++++++++---------- 20 3 files changed, 15 insertions(+), 15 deletions(-) 21 22diff --git a/test/Makefile.in b/test/Makefile.in 23index 3f9a9af..09406ae 100644 24--- a/test/Makefile.in 25+++ b/test/Makefile.in 26@@ -19,7 +19,7 @@ CPPFLAGS = @CPPFLAGS@ -I.. # config.h 27 ODBC_CONFIG = @ODBC_CONFIG@ 28 PROVE = @PROVE@ 29 30-LIBODBC = @LIBODBC@ 31+LIBODBC = -lodbc 32 33 all: $(TESTBINS) runsuite reset-db 34 35diff --git a/test/odbcini-gen.sh b/test/odbcini-gen.sh 36index 2eaba35..6555cdb 100755 37--- a/test/odbcini-gen.sh 38+++ b/test/odbcini-gen.sh 39@@ -6,7 +6,7 @@ 40 outini=odbc.ini 41 outinstini=odbcinst.ini 42 43-drvr=../.libs/psqlodbcw 44+drvr=@LIBDIR@/psqlodbca 45 driver=${drvr}.so 46 if test ! -e $driver ; then 47 driver=${drvr}.dll 48@@ -52,10 +52,10 @@ Driver = PostgreSQL Unicode 49 Trace = No 50 TraceFile = 51 Database = contrib_regression 52-Servername = 53-Username = 54+Servername = localhost 55+Username = postgres 56 Password = 57-Port = 58+Port = 5432 59 ReadOnly = No 60 RowVersioning = No 61 ShowSystemTables = No 62diff --git a/test/runsuite.c b/test/runsuite.c 63index 3be5732..cd842dc 100644 64--- a/test/runsuite.c 65+++ b/test/runsuite.c 66@@ -55,7 +55,7 @@ bailout(const char *fmt, ...) 67 68 /* Given a test program's name, get the test name */ 69 void 70-parse_argument(const char *in, char *testname, char *binname) 71+parse_argument(const char *in, char *testname, char *binname, const char *inputdir) 72 { 73 const char *basename; 74 #ifdef WIN32 75@@ -69,7 +69,7 @@ parse_argument(const char *in, char *testname, char *binname) 76 if (strchr(in, DIR_SEP) == NULL) 77 { 78 strcpy(testname, in); 79- sprintf(binname, "exe%c%s-test", DIR_SEP, in); 80+ sprintf(binname, "%s%cexe%c%s-test", inputdir, DIR_SEP, DIR_SEP, in); 81 return; 82 } 83 84@@ -131,7 +131,7 @@ int main(int argc, char **argv) 85 failures = 0; 86 for (i = 1, j = 1; i <= numtests; i++, j++) 87 { 88- parse_argument(argv[j], testname, binname); 89+ parse_argument(argv[j], testname, binname, inputdir); 90 if (runtest(binname, testname, i, inputdir) != 0) 91 failures++; 92 } 93@@ -161,29 +161,29 @@ runtest(const char *binname, const char *testname, int testno, const char *input 94 #ifndef WIN32 95 snprintf(cmdline, sizeof(cmdline), 96 "ODBCSYSINI=. ODBCINSTINI=./odbcinst.ini ODBCINI=./odbc.ini " 97- "%s > results/%s.out", 98- binname, testname); 99+ "%s > %s/results/%s.out", 100+ binname, inputdir, testname); 101 #else 102 snprintf(cmdline, sizeof(cmdline), 103- "%s > results\\%s.out", 104- binname, testname); 105+ "%s > %s/results\\%s.out", 106+ binname, inputdir, testname); 107 #endif 108 rc = system(cmdline); 109 110 diff = rundiff(testname, inputdir); 111 if (rc != 0) 112 { 113- printf("not ok %d - %s test returned %d\n", testno, testname, rc); 114+ printf("FAIL: %d - %s\n\ttest returned %d\n", testno, testname, rc); 115 ret = 1; 116 } 117 else if (diff != 0) 118 { 119- printf("not ok %d - %s test output differs\n", testno, testname); 120+ printf("FAIL: %d - %s\n\ttest output differs\n", testno, testname); 121 ret = 1; 122 } 123 else 124 { 125- printf("ok %d - %s\n", testno, testname); 126+ printf("PASS: %d - %s\n", testno, testname); 127 ret = 0; 128 } 129 fflush(stdout); 130