1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
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
|