diff --git a/src/ut/utMain.cc b/src/ut/utMain.cc
index 8653542a7..36ff1a8a4 100644
--- a/src/ut/utMain.cc
+++ b/src/ut/utMain.cc
@@ -490,6 +490,20 @@ private:
bool m_with_xml;
};
+std::string
+noquotes (const std::string &s)
+{
+ std::string res;
+ for (const char *cp = s.c_str (); *cp; ++cp) {
+ if (*cp == '\"') {
+ res += """;
+ } else {
+ res += *cp;
+ }
+ }
+ return res;
+}
+
tl::LogTee noctrl (new CtrlChannel (false), true);
tl::LogTee ctrl (new CtrlChannel (true), true);
@@ -518,43 +532,54 @@ TestBase::TestBase (const std::string &file, const std::string &name)
bool TestBase::do_test (const std::string & /*mode*/)
{
- // Ensures the test temp directory is present
- QDir dir (testtmp ());
- QDir tmpdir (dir.absoluteFilePath (tl::to_qstring (m_testdir)));
- if (tmpdir.exists () && ! tl::rm_dir_recursive (tmpdir.absolutePath ())) {
- throw tl::Exception ("Unable to clean temporary dir: " + tl::to_string (tmpdir.absolutePath ()));
+ ut::ctrl << "";
+
+ try {
+
+ // Ensures the test temp directory is present
+ QDir dir (testtmp ());
+ QDir tmpdir (dir.absoluteFilePath (tl::to_qstring (m_testdir)));
+ if (tmpdir.exists () && ! tl::rm_dir_recursive (tmpdir.absolutePath ())) {
+ throw tl::Exception ("Unable to clean temporary dir: " + tl::to_string (tmpdir.absolutePath ()));
+ }
+ if (! dir.mkpath (tl::to_qstring (m_testdir))) {
+ throw tl::Exception ("Unable to create path for temporary files: " + tl::to_string (tmpdir.absolutePath ()));
+ }
+ dir.cd (tl::to_qstring (m_testdir));
+
+ m_testtmp = dir.absolutePath ();
+
+ static std::string testname_value;
+ static std::string testtmp_value;
+
+ putenv (const_cast ("TESTNAME="));
+ testname_value = std::string ("TESTNAME=") + m_test;
+ putenv (const_cast (testname_value.c_str ()));
+
+ putenv (const_cast ("TESTTMP_WITH_NAME="));
+ testtmp_value = std::string ("TESTTMP_WITH_NAME=") + m_testtmp.toUtf8().constData();
+ putenv (const_cast (testtmp_value.c_str ()));
+
+ reset_checkpoint ();
+
+ tl::Timer timer;
+ timer.start();
+
+ execute (this);
+
+ timer.stop();
+
+ m_testtmp.clear ();
+
+ ut::ctrl << "";
+
+ ut::noctrl << "Time: " << timer.sec_wall () << "s (wall) " << timer.sec_user () << "s (user) " << timer.sec_sys () << "s (sys)";
+ ut::ctrl << "";
+
+ } catch (...) {
+ ut::ctrl << "";
+ throw;
}
- if (! dir.mkpath (tl::to_qstring (m_testdir))) {
- throw tl::Exception ("Unable to create path for temporary files: " + tl::to_string (tmpdir.absolutePath ()));
- }
- dir.cd (tl::to_qstring (m_testdir));
-
- m_testtmp = dir.absolutePath ();
-
- static std::string testname_value;
- static std::string testtmp_value;
-
- putenv (const_cast ("TESTNAME="));
- testname_value = std::string ("TESTNAME=") + m_test;
- putenv (const_cast (testname_value.c_str ()));
-
- putenv (const_cast ("TESTTMP_WITH_NAME="));
- testtmp_value = std::string ("TESTTMP_WITH_NAME=") + m_testtmp.toUtf8().constData();
- putenv (const_cast (testtmp_value.c_str ()));
-
- reset_checkpoint ();
-
- tl::Timer timer;
- timer.start();
-
- execute (this);
-
- timer.stop();
-
- m_testtmp.clear ();
-
- ut::noctrl << "Time: " << timer.sec_wall () << "s (wall) " << timer.sec_user () << "s (user) " << timer.sec_sys () << "s (sys)";
- ut::ctrl << "";
return (!m_any_failed);
}
@@ -906,7 +931,8 @@ main_cont (int argc, char **argv)
ut::sp_python_interpreter->push_console (&console);
}
- ut::ctrl << "";
+ ut::ctrl << "";
+ ut::ctrl << "";
ut::noctrl << replicate ("=", console.real_columns ());
ut::noctrl << "Entering KLayout test suite";
@@ -947,6 +973,8 @@ main_cont (int argc, char **argv)
selected_tests = &ut::Registrar::instance()->tests ();
}
+ ut::ctrl << "";
+
ut::s_verbose_flag = false;
int failed_ne = 0, failed_e = 0;
std::vector failed_tests_e, failed_tests_ne;
@@ -985,7 +1013,7 @@ main_cont (int argc, char **argv)
for (std::vector ::const_iterator t = selected_tests->begin (); t != selected_tests->end (); ++t) {
- ut::ctrl << "name () << "\" mode=\"" << mode << "\">";
+ ut::ctrl << "name () << "-" << mode << "\">";
ut::noctrl << replicate ("-", TestConsole::instance ()->real_columns ());
ut::noctrl << "Running " << (*t)->name ();
@@ -994,20 +1022,17 @@ main_cont (int argc, char **argv)
if (! (*t)->do_test (mode)) {
- ut::ctrl << "";
+ ut::ctrl << "name ()) << " failed (continued mode - see previous messages)" << "\"/>";
tl::error << "Test " << (*t)->name () << " failed (continued mode - see previous messages)";
- ut::ctrl << "";
failed_tests.push_back (*t);
++failed;
- } else {
- ut::ctrl << "";
}
} catch (tl::CancelException &) {
- ut::ctrl << "";
+ ut::ctrl << "";
tl::error << "Test " << (*t)->name () << " skipped";
skipped_tests.push_back (*t);
@@ -1015,17 +1040,16 @@ main_cont (int argc, char **argv)
} catch (tl::Exception &ex) {
- ut::ctrl << "";
+ ut::ctrl << "";
tl::error << "Test " << (*t)->name () << " failed:";
tl::info << ex.msg ();
- ut::ctrl << "";
failed_tests.push_back (*t);
++failed;
}
- ut::ctrl << "";
+ ut::ctrl << "";
}
@@ -1042,7 +1066,7 @@ main_cont (int argc, char **argv)
timer.stop ();
- ut::ctrl << "";
+ ut::ctrl << "";
ut::noctrl << replicate ("=", console.real_columns ());
ut::noctrl << "Summary";
@@ -1071,10 +1095,10 @@ main_cont (int argc, char **argv)
tl::info << "All tests passed in " << mode << " mode.";
}
- ut::ctrl << "";
+ ut::ctrl << "";
ut::noctrl << "Total time: " << timer.sec_wall () << "s (wall) " << timer.sec_user () << "s (user) " << timer.sec_sys () << "s (sys)";
- ut::ctrl << "";
+ ut::ctrl << "";
}
@@ -1088,7 +1112,7 @@ main_cont (int argc, char **argv)
ut::noctrl << replicate ("=", console.real_columns ());
ut::noctrl << "GSI coverage test";
- ut::ctrl << "";
+ ut::ctrl << "";
bool first = true;
for (gsi::ClassBase::class_iterator c = gsi::ClassBase::begin_classes (); c != gsi::ClassBase::end_classes (); ++c) {
@@ -1122,14 +1146,14 @@ main_cont (int argc, char **argv)
tl::info << "GSI coverage test passed.";
}
- ut::ctrl << "";
+ ut::ctrl << "";
}
ut::noctrl << ut::replicate ("=", console.real_columns ());
ut::noctrl << "Grand Summary";
- ut::ctrl << "";
+ ut::ctrl << "";
if (skipped_e + skipped_ne > 0) {
if (non_editable) {
@@ -1166,10 +1190,10 @@ main_cont (int argc, char **argv)
tl::info << "All tests passed.";
}
- ut::ctrl << "";
+ ut::ctrl << "";
ut::noctrl << "Grand total time: " << grand_timer.sec_wall () << "s (wall) " << grand_timer.sec_user () << "s (user) " << grand_timer.sec_sys () << "s (sys)";
- ut::ctrl << "";
+ ut::ctrl << "";
if (ut::sp_ruby_interpreter) {
ut::sp_ruby_interpreter->remove_console (&console);
@@ -1189,7 +1213,7 @@ main_cont (int argc, char **argv)
result = -1;
}
- ut::ctrl << "";
+ ut::ctrl << "";
return result;
}