aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-dbs/psqlodbc/files/psqlodbc-fix-for-ptest-support.patch
blob: 081c6d0fd0da46a5f65ba9030f60b1c140cad843 (plain)
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
From 96896b88776d0080609ec830cf9538d2babe665a Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
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 <jackie.huang@windriver.com>

---
 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);