Merge lp:~davidagraf/zorba/bug-1025566 into lp:zorba

Proposed by David Graf
Status: Merged
Approved by: David Graf
Approved revision: 10942
Merged at revision: 10968
Proposed branch: lp:~davidagraf/zorba/bug-1025566
Merge into: lp:zorba
Diff against target: 260 lines (+97/-2)
1 file modified
test/rbkt/testdriver_mt.cpp (+97/-2)
To merge this branch: bzr merge lp:~davidagraf/zorba/bug-1025566
Reviewer Review Type Date Requested Status
David Graf (community) Approve
Chris Hillery Approve
Review via email: mp+117914@code.launchpad.net

Commit message

Make testdriver_mt work with boost version >1.49.

Description of the change

tmp fix for testdriver_mt to make it work with boost 1.50. I lost the patience :-).

To post a comment you must log in.
Revision history for this message
Chris Hillery (ceejatec) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1025566-2012-08-03T00-17-01.009Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Approve.

Revision history for this message
David Graf (davidagraf) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1025566-2012-08-03T05-46-02.016Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test/rbkt/testdriver_mt.cpp'
2--- test/rbkt/testdriver_mt.cpp 2012-07-24 08:48:48 +0000
3+++ test/rbkt/testdriver_mt.cpp 2012-08-02 14:46:26 +0000
4@@ -44,8 +44,6 @@
5 #include "testdriver_comparator.h"
6 #include "testdriver_common.h"
7
8-#define BOOST_FILESYSTEM_VERSION 2
9-
10 // These are included last because they define the <stdint.h>'s INTMAX_C and UINTMAX_C
11 #include <boost/filesystem/operations.hpp>
12 #include <boost/filesystem/path.hpp>
13@@ -233,25 +231,45 @@
14 ********************************************************************************/
15 void createPath(const fs::path& filePath, std::ofstream& fileStream)
16 {
17+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
18 fileStream.open(filePath.file_string().c_str());
19+#else
20+ fileStream.open(filePath.generic_string().c_str());
21+#endif
22 if (!fileStream.good())
23 {
24 fs::path dirPath = filePath;
25 dirPath = dirPath.remove_leaf();
26
27+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
28 if (!fs::exists(dirPath.file_string()))
29+#else
30+ if (!fs::exists(dirPath.generic_string()))
31+#endif
32 {
33+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
34 fs::create_directories(dirPath.file_string());
35+#else
36+ fs::create_directories(dirPath.generic_string());
37+#endif
38
39 // clear the bad flag on windows, which for some unknown reason doesn't reset when opening a file again
40 fileStream.clear();
41+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
42 fileStream.open(filePath.file_string().c_str());
43+#else
44+ fileStream.open(filePath.generic_string().c_str());
45+#endif
46 }
47
48 if (!fileStream.good())
49 {
50 std::cerr << "Could not open file: "
51+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
52 << filePath.file_string() << std::endl;
53+#else
54+ << filePath.generic_string() << std::endl;
55+#endif
56 abort();
57 }
58 }
59@@ -380,7 +398,11 @@
60 relativeQueryFile = queries->theQueryFilenames[queryNo];
61 queryPath = fs::path(queries->theQueriesDir) / (relativeQueryFile);
62
63+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
64 std::string testName = fs::change_extension(queryPath, "").file_string();
65+#else
66+ std::string testName = fs::change_extension(queryPath, "").generic_string();
67+#endif
68 ulong pos = testName.find("Queries");
69 testName = testName.substr(pos + 8);
70
71@@ -393,7 +415,11 @@
72 // exprected errors, or the pathnames of reference-result files.
73 specPath = fs::change_extension(queryPath, ".spec");
74 if (fs::exists(specPath))
75+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
76 querySpec.parseFile(specPath.file_string(), rbkt_src_dir, rbkt_bin_dir);
77+#else
78+ querySpec.parseFile(specPath.generic_string(), rbkt_src_dir, rbkt_bin_dir);
79+#endif
80
81 // Get the pathnames of the ref-result files found in the .spec file (if any).
82 // If no ref-results file was specified in the .spec file, create a default
83@@ -494,14 +520,22 @@
84 setModulePaths(module_path, sctx);
85
86 // Set the error file to be used by the error handler for the current query
87+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
88 errHandler.setErrorFile(errorFilePath.file_string());
89+#else
90+ errHandler.setErrorFile(errorFilePath.generic_string());
91+#endif
92
93 //
94 // Compile the query, if it has not been compiled already.
95 //
96 if (queries->theQueryObjects[queryNo] == 0)
97 {
98+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
99 slurp_file(queryPath.file_string().c_str(),
100+#else
101+ slurp_file(queryPath.generic_string().c_str(),
102+#endif
103 queryString,
104 rbkt_src_dir,
105 rbkt_bin_dir);
106@@ -509,7 +543,11 @@
107 try
108 {
109 query = zorba->createQuery(&errHandler);
110+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
111 query->setFileName(queryPath.file_string());
112+#else
113+ query->setFileName(queryPath.generic_string());
114+#endif
115 query->compile(queryString.c_str(), sctx, getCompilerHints());
116 }
117 catch(...)
118@@ -632,8 +670,13 @@
119 ulong i;
120 for (i = 0; i < refFilePaths.size(); i++)
121 {
122+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
123 std::string refFilePath = refFilePaths[i].file_string();
124 std::string resFilePath = resultFilePath.file_string();
125+#else
126+ std::string refFilePath = refFilePaths[i].generic_string();
127+ std::string resFilePath = resultFilePath.generic_string();
128+#endif
129
130 int lLine, lCol;
131 std::string lRefLine, lResultLine;
132@@ -879,23 +922,43 @@
133 // Make sure the directories exist. For the results dir, if it doesn't exist,
134 // it is created.
135 //
136+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
137 path = fs::system_complete(fs::path(queriesDir, fs::native));
138+#else
139+ path = fs::system_complete(fs::path(queriesDir));
140+#endif
141 if (!fs::is_directory(path))
142 {
143 std::cerr << "The directory " << queriesDir << " could not be found" << std::endl;
144 exit(2);
145 }
146+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
147 queries.theQueriesDir = path.native_directory_string();
148+#else
149+ queries.theQueriesDir = path.parent_path().generic_string();
150+#endif
151
152+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
153 path = fs::system_complete(fs::path(refsDir, fs::native));
154+#else
155+ path = fs::system_complete(fs::path(refsDir));
156+#endif
157 if (!fs::is_directory(path))
158 {
159 std::cerr << "The directory " << refsDir << " could not be found" << std::endl;
160 exit(2);
161 }
162+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
163 queries.theRefsDir = path.native_directory_string();
164+#else
165+ queries.theRefsDir = path.parent_path().generic_string();
166+#endif
167
168+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
169 path = fs::system_complete(fs::path(resultsDir, fs::native));
170+#else
171+ path = fs::system_complete(fs::path(resultsDir));
172+#endif
173 if (!fs::exists(path))
174 {
175 fs::create_directories(path);
176@@ -905,7 +968,11 @@
177 std::cerr << "The pathname " << resultsDir << " is not a directory" << std::endl;
178 exit(2);
179 }
180+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
181 queries.theResultsDir = path.native_directory_string();
182+#else
183+ queries.theResultsDir = path.parent_path().generic_string();
184+#endif
185
186 //
187 // Search and collect all the query files in the bucket, unless some
188@@ -934,7 +1001,11 @@
189 continue;
190 }
191
192+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
193 std::string queryFile = queryPath.file_string();
194+#else
195+ std::string queryFile = queryPath.generic_string();
196+#endif
197 std::string relativeQueryFile = queryFile.substr(queries.theQueriesDir.size());
198
199 queries.theQueryFilenames.push_back(relativeQueryFile);
200@@ -1054,23 +1125,39 @@
201 bool queryWasKnownToFail = false;
202 if (haveKnownFailures)
203 {
204+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
205 queryWasKnownToFail = (knownFailures.count(queryName.file_string()) != 0);
206+#else
207+ queryWasKnownToFail = (knownFailures.count(queryName.generic_string()) != 0);
208+#endif
209 }
210
211 if (queries.theQueryStates[i] == false)
212 {
213 numFailures++;
214+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
215 failedTests << queryName.file_string() << std::endl;
216+#else
217+ failedTests << queryName.generic_string() << std::endl;
218+#endif
219
220 if (haveKnownFailures && !queryWasKnownToFail)
221 {
222 numRegressions++;
223 report << "REGRESSION:" << i << ":"
224+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
225 << queryName.file_string() << std::endl;
226+#else
227+ << queryName.generic_string() << std::endl;
228+#endif
229 }
230 else if (!haveKnownFailures)
231 {
232+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
233 report << i << ":" << queryName.file_string() << std::endl;
234+#else
235+ report << i << ":" << queryName.generic_string() << std::endl;
236+#endif
237 }
238 }
239 else
240@@ -1079,13 +1166,21 @@
241 {
242 numProgressions++;
243 report << "Progression:" << i << ":"
244+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
245 << queryName.file_string() << std::endl;
246+#else
247+ << queryName.generic_string() << std::endl;
248+#endif
249 }
250 }
251 if(generateW3CData)
252 {
253 std::string status = (queries.theQueryStates[i] == true)?"pass":"fail";
254+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
255 XMLreport << "<Test Status='" << status << "'><Name>" << queryName.file_string() << "</Name></Test>" << std::endl;
256+#else
257+ XMLreport << "<Test Status='" << status << "'><Name>" << queryName.generic_string() << "</Name></Test>" << std::endl;
258+#endif
259 }
260 }
261

Subscribers

People subscribed via source and target branches