From 96896b88776d0080609ec830cf9538d2babe665a Mon Sep 17 00:00:00 2001 From: Jackie Huang Date: Tue, 5 Sep 2017 10:24:10 +0800 Subject: [PATCH] psqlodbc: fixes for ptest support * Fix the LIBODBC since we don't use ODBC_CONFIG. * Fix the path for driver. * Add the default info of postgresql server. * Fix the output format for ptest. * Fix the results and exe dir. Upstream-Status: Inappropriate [OE ptest specific] Signed-off-by: Jackie Huang --- test/Makefile.in | 2 +- test/odbcini-gen.sh | 8 ++++---- test/runsuite.c | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) --- a/test/Makefile.in +++ b/test/Makefile.in @@ -19,7 +19,7 @@ CPPFLAGS = @CPPFLAGS@ -I.. # config.h ODBC_CONFIG = @ODBC_CONFIG@ PROVE = @PROVE@ -LIBODBC = @LIBODBC@ +LIBODBC = -lodbc all: $(TESTBINS) runsuite reset-db --- a/test/odbcini-gen.sh +++ b/test/odbcini-gen.sh @@ -6,7 +6,7 @@ outini=odbc.ini outinstini=odbcinst.ini -drvr=../.libs/psqlodbcw +drvr=@LIBDIR@/psqlodbca driver=${drvr}.so if test ! -e $driver ; then driver=${drvr}.dll @@ -16,7 +16,7 @@ if test ! -e $driver ; then fi fi -drvra=../.libs/psqlodbca +drvra=@LIBDIR@/psqlodbca drivera=${drvra}.so if test ! -e $drivera ; then drivera=${drvra}.dll @@ -52,10 +52,10 @@ Driver = PostgreSQL Unicode Trace = No TraceFile = Database = contrib_regression -Servername = -Username = +Servername = localhost +Username = postgres Password = -Port = +Port = 5432 ReadOnly = No RowVersioning = No ShowSystemTables = No --- a/test/runsuite.c +++ b/test/runsuite.c @@ -55,7 +55,7 @@ bailout(const char *fmt, ...) /* Given a test program's name, get the test name */ void -parse_argument(const char *in, char *testname, char *binname) +parse_argument(const char *in, char *testname, char *binname, const char *inputdir) { const char *basename; #ifdef WIN32 @@ -69,7 +69,7 @@ parse_argument(const char *in, char *tes if (strchr(in, DIR_SEP) == NULL) { strcpy(testname, in); - sprintf(binname, "exe%c%s-test", DIR_SEP, in); + sprintf(binname, "%s%cexe%c%s-test", inputdir, DIR_SEP, DIR_SEP, in); return; } @@ -131,7 +131,7 @@ int main(int argc, char **argv) failures = 0; for (i = 1, j = 1; i <= numtests; i++, j++) { - parse_argument(argv[j], testname, binname); + parse_argument(argv[j], testname, binname, inputdir); if (runtest(binname, testname, i, inputdir) != 0) failures++; } @@ -161,29 +161,29 @@ runtest(const char *binname, const char #ifndef WIN32 snprintf(cmdline, sizeof(cmdline), "ODBCSYSINI=. ODBCINSTINI=./odbcinst.ini ODBCINI=./odbc.ini " - "%s > results/%s.out", - binname, testname); + "%s > %s/results/%s.out", + binname, inputdir, testname); #else snprintf(cmdline, sizeof(cmdline), - "%s > results\\%s.out", - binname, testname); + "%s > %s/results\\%s.out", + binname, inputdir, testname); #endif rc = system(cmdline); diff = rundiff(testname, inputdir); if (rc != 0) { - printf("not ok %d - %s test returned %d\n", testno, testname, rc); + printf("FAIL: %d - %s\n\ttest returned %d\n", testno, testname, rc); ret = 1; } else if (diff != 0) { - printf("not ok %d - %s test output differs\n", testno, testname); + printf("FAIL: %d - %s\n\ttest output differs\n", testno, testname); ret = 1; } else { - printf("ok %d - %s\n", testno, testname); + printf("PASS: %d - %s\n", testno, testname); ret = 0; } fflush(stdout);