summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ctest.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-10-27 22:58:55 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-10-28 00:33:20 +0100
commit3660ee2c86d460bba3822dc9e117796b0ba59aa0 (patch)
treed359ac487aee61eb5e0cb3469913418190be9dae /crawl-ref/source/ctest.cc
parent5ae78977690c8023545d5ae33d59543158e56fb5 (diff)
downloadcrawl-ref-3660ee2c86d460bba3822dc9e117796b0ba59aa0.tar.gz
crawl-ref-3660ee2c86d460bba3822dc9e117796b0ba59aa0.zip
Make -test NORETURN and easier to valgrind.
Diffstat (limited to 'crawl-ref/source/ctest.cc')
-rw-r--r--crawl-ref/source/ctest.cc54
1 files changed, 26 insertions, 28 deletions
diff --git a/crawl-ref/source/ctest.cc b/crawl-ref/source/ctest.cc
index f24a6152c4..3e9e9dbd3b 100644
--- a/crawl-ref/source/ctest.cc
+++ b/crawl-ref/source/ctest.cc
@@ -154,7 +154,7 @@ static void _run_test(const string &name, void (*func)(void))
}
// Assumes curses has already been initialized.
-bool run_tests(bool exit_on_complete)
+void run_tests()
{
if (crawl_state.script)
activity = "script";
@@ -174,35 +174,33 @@ bool run_tests(bool exit_on_complete)
// Get a list of Lua files in test. Order of execution of
// tests should be irrelevant.
- const vector<string> tests(
- get_dir_files_recursive(crawl_state.script? script_dir : test_dir,
- ".lua"));
- for_each(tests.begin(), tests.end(), run_test);
-
- if (failures.empty() && !ntests && crawl_state.script)
- failures.push_back(
- file_error(
- "Script setup",
- "No scripts found matching " +
- comma_separated_line(crawl_state.tests_selected.begin(),
- crawl_state.tests_selected.end(),
- ", ",
- ", ")));
-
- if (exit_on_complete)
{
- cio_cleanup();
- for (int i = 0, size = failures.size(); i < size; ++i)
- {
- const file_error &fe(failures[i]);
- fprintf(stderr, "%s error: %s\n",
- activity, fe.second.c_str());
- }
- const int code = failures.empty() ? 0 : 1;
- end(code, false, "%d %ss, %d succeeded, %d failed",
- ntests, activity, nsuccess, (int)failures.size());
+ const vector<string> tests(
+ get_dir_files_recursive(crawl_state.script? script_dir : test_dir,
+ ".lua"));
+ for_each(tests.begin(), tests.end(), run_test);
+
+ if (failures.empty() && !ntests && crawl_state.script)
+ failures.push_back(
+ file_error(
+ "Script setup",
+ "No scripts found matching " +
+ comma_separated_line(crawl_state.tests_selected.begin(),
+ crawl_state.tests_selected.end(),
+ ", ",
+ ", ")));
}
- return failures.empty();
+
+ cio_cleanup();
+ for (int i = 0, size = failures.size(); i < size; ++i)
+ {
+ const file_error &fe(failures[i]);
+ fprintf(stderr, "%s error: %s\n",
+ activity, fe.second.c_str());
+ }
+ const int code = failures.empty() ? 0 : 1;
+ end(code, false, "%d %ss, %d succeeded, %d failed",
+ ntests, activity, nsuccess, (int)failures.size());
}
#endif // DEBUG_DIAGNOSTICS