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