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 <jackie.huang@windriver.com>
|
---
|
test/Makefile.in | 2 +-
|
test/odbcini-gen.sh | 8 ++++----
|
test/runsuite.c | 26 +++++++++++++-------------
|
3 files changed, 18 insertions(+), 18 deletions(-)
|
|
diff --git a/test/Makefile.in b/test/Makefile.in
|
index 8710616..fcb470e 100644
|
--- a/test/Makefile.in
|
+++ b/test/Makefile.in
|
@@ -18,7 +18,7 @@ CFLAGS = @CFLAGS@
|
ODBC_CONFIG = @ODBC_CONFIG@
|
PROVE = @PROVE@
|
|
-LIBODBC := $(shell $(ODBC_CONFIG) --libs)
|
+LIBODBC = -lodbc
|
|
all: $(TESTBINS) runsuite reset-db
|
|
diff --git a/test/odbcini-gen.sh b/test/odbcini-gen.sh
|
index d2c2c87..6068d9d 100755
|
--- 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
|
@@ -33,10 +33,10 @@ Driver = psqlodbc test driver
|
Trace = No
|
TraceFile =
|
Database = contrib_regression
|
-Servername =
|
-Username =
|
+Servername = localhost
|
+Username = postgres
|
Password =
|
-Port =
|
+Port = 5432
|
ReadOnly = No
|
RowVersioning = No
|
ShowSystemTables = No
|
diff --git a/test/runsuite.c b/test/runsuite.c
|
index 583cf35..fd2a90e 100644
|
--- a/test/runsuite.c
|
+++ b/test/runsuite.c
|
@@ -51,7 +51,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
|
@@ -65,7 +65,7 @@ parse_argument(const char *in, char *testname, char *binname)
|
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;
|
}
|
|
@@ -127,7 +127,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++;
|
}
|
@@ -157,29 +157,29 @@ runtest(const char *binname, const char *testname, int testno, const char *input
|
#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);
|
@@ -196,7 +196,7 @@ rundiff(const char *testname, const char *inputdir)
|
char *result;
|
size_t result_len;
|
|
- snprintf(filename, sizeof(filename), "results/%s.out", testname);
|
+ snprintf(filename, sizeof(filename), "%s/results/%s.out", inputdir, testname);
|
result = slurpfile(filename, &result_len);
|
|
outputno = 0;
|
@@ -244,8 +244,8 @@ rundiff(const char *testname, const char *inputdir)
|
* files and print the smallest diff?
|
*/
|
snprintf(cmdline, sizeof(cmdline),
|
- "diff -c %s/expected/%s.out results/%s.out >> regression.diffs",
|
- inputdir, testname, testname);
|
+ "diff -c %s/expected/%s.out %s/results/%s.out >> regression.diffs",
|
+ inputdir, testname, inputdir, testname);
|
if (system(cmdline) == -1)
|
printf("# diff failed\n");
|
|
--
|
2.8.2
|