@@ -63,8 +63,9 @@ class TestTool
63
63
TestCase::TestCaseCreator _testCaseCreator,
64
64
string const & _name,
65
65
fs::path const & _path,
66
+ string const & _ipcPath,
66
67
bool _formatted
67
- ): m_testCaseCreator(_testCaseCreator), m_formatted(_formatted), m_name(_name), m_path(_path)
68
+ ): m_testCaseCreator(_testCaseCreator), m_name(_name), m_path(_path), m_ipcPath(_ipcPath), m_formatted(_formatted )
68
69
{}
69
70
70
71
enum class Result
@@ -80,6 +81,7 @@ class TestTool
80
81
TestCase::TestCaseCreator _testCaseCreator,
81
82
fs::path const & _basepath,
82
83
fs::path const & _path,
84
+ string const & _ipcPath,
83
85
bool const _formatted
84
86
);
85
87
@@ -95,9 +97,10 @@ class TestTool
95
97
Request handleResponse (bool const _exception);
96
98
97
99
TestCase::TestCaseCreator m_testCaseCreator;
98
- bool const m_formatted = false ;
99
100
string const m_name;
100
101
fs::path const m_path;
102
+ string m_ipcPath;
103
+ bool const m_formatted = false ;
101
104
unique_ptr<TestCase> m_test;
102
105
static bool m_exitRequested;
103
106
};
@@ -114,7 +117,7 @@ TestTool::Result TestTool::process()
114
117
115
118
try
116
119
{
117
- m_test = m_testCaseCreator (m_path.string ());
120
+ m_test = m_testCaseCreator (TestCase::Config{ m_path.string (), m_ipcPath} );
118
121
success = m_test->run (outputMessages, " " , m_formatted);
119
122
}
120
123
catch (boost::exception const & _e)
@@ -198,6 +201,7 @@ TestStats TestTool::processPath(
198
201
TestCase::TestCaseCreator _testCaseCreator,
199
202
fs::path const & _basepath,
200
203
fs::path const & _path,
204
+ string const & _ipcPath,
201
205
bool const _formatted
202
206
)
203
207
{
@@ -229,7 +233,7 @@ TestStats TestTool::processPath(
229
233
else
230
234
{
231
235
++testCount;
232
- TestTool testTool (_testCaseCreator, currentPath.string (), fullpath, _formatted);
236
+ TestTool testTool (_testCaseCreator, currentPath.string (), fullpath, _ipcPath, _formatted);
233
237
auto result = testTool.process ();
234
238
235
239
switch (result)
@@ -290,6 +294,7 @@ boost::optional<TestStats> runTestSuite(
290
294
string const & _name,
291
295
fs::path const & _basePath,
292
296
fs::path const & _subdirectory,
297
+ string const & _ipcPath,
293
298
TestCase::TestCaseCreator _testCaseCreator,
294
299
bool _formatted
295
300
)
@@ -302,7 +307,7 @@ boost::optional<TestStats> runTestSuite(
302
307
return {};
303
308
}
304
309
305
- TestStats stats = TestTool::processPath (_testCaseCreator, _basePath, _subdirectory, _formatted);
310
+ TestStats stats = TestTool::processPath (_testCaseCreator, _basePath, _subdirectory, _ipcPath, _formatted);
306
311
307
312
cout << endl << _name << " Test Summary: " ;
308
313
FormattedScope (cout, _formatted, {BOLD, stats ? GREEN : RED}) <<
@@ -326,11 +331,13 @@ int main(int argc, char *argv[])
326
331
TestTool::editor = " /usr/bin/editor" ;
327
332
328
333
fs::path testPath;
334
+ string ipcPath;
335
+ bool disableIPC = false ;
329
336
bool disableSMT = false ;
330
337
bool formatted = true ;
331
338
po::options_description options (
332
339
R"( isoltest, tool for interactively managing test contracts.
333
- Usage: isoltest [Options] --testpath path
340
+ Usage: isoltest [Options] --testpath path --ipcpath ipcpath
334
341
Interactively validates test contracts.
335
342
336
343
Allowed options)" ,
@@ -339,6 +346,8 @@ Allowed options)",
339
346
options.add_options ()
340
347
(" help" , " Show this help screen." )
341
348
(" testpath" , po::value<fs::path>(&testPath), " path to test files" )
349
+ (" ipcpath" , po::value<string>(&ipcPath), " path to ipc socket" )
350
+ (" no-ipc" , " disable semantic tests" )
342
351
(" no-smt" , " disable SMT checker" )
343
352
(" no-color" , " don't use colors" )
344
353
(" editor" , po::value<string>(&TestTool::editor), " editor for opening contracts" );
@@ -361,8 +370,23 @@ Allowed options)",
361
370
362
371
po::notify (arguments);
363
372
373
+ if (arguments.count (" no-ipc" ))
374
+ disableIPC = true ;
375
+ else
376
+ {
377
+ solAssert (
378
+ !ipcPath.empty (),
379
+ " No ipc path specified. The --ipcpath argument is required, unless --no-ipc is used."
380
+ );
381
+ solAssert (
382
+ fs::exists (ipcPath),
383
+ " Invalid ipc path specified."
384
+ );
385
+ }
386
+
364
387
if (arguments.count (" no-smt" ))
365
388
disableSMT = true ;
389
+
366
390
}
367
391
catch (std::exception const & _exception)
368
392
{
@@ -379,10 +403,13 @@ Allowed options)",
379
403
// Interactive tests are added in InteractiveTests.h
380
404
for (auto const & ts: g_interactiveTestsuites)
381
405
{
406
+ if (ts.ipc && disableIPC)
407
+ continue ;
408
+
382
409
if (ts.smt && disableSMT)
383
410
continue ;
384
411
385
- if (auto stats = runTestSuite (ts.title , testPath / ts.path , ts.subpath , ts.testCaseCreator , formatted))
412
+ if (auto stats = runTestSuite (ts.title , testPath / ts.path , ts.subpath , ipcPath, ts.testCaseCreator , formatted))
386
413
global_stats += *stats;
387
414
else
388
415
return 1 ;
0 commit comments