Skip to content

Commit b4f284d

Browse files
committed
TestThreadExecutor: added showtime tests with jobs
1 parent 4555949 commit b4f284d

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

test/testthreadexecutor.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ class TestThreadExecutor : public TestFixture {
108108
TEST_CASE(showtime_top5);
109109
TEST_CASE(showtime_file);
110110
TEST_CASE(showtime_summary);
111+
TEST_CASE(showtime_top5_j);
112+
TEST_CASE(showtime_file_j);
113+
TEST_CASE(showtime_summary_j);
111114
}
112115

113116
void deadlock_with_many_errors() {
@@ -282,6 +285,36 @@ class TestThreadExecutor : public TestFixture {
282285
ASSERT(output_s.find("1 result(s)") == std::string::npos);
283286
ASSERT(output_s.find("2 result(s)") != std::string::npos);
284287
}
288+
289+
void showtime_top5_j() {
290+
REDIRECT; // should not cause TSAN failures as the showtime logging is synchronized
291+
check(2, 2, 0,
292+
"int main() {}",
293+
true, SHOWTIME_MODES::SHOWTIME_TOP5);
294+
// for each file: top5 results + overall + empty line
295+
const std::string output_s = GET_REDIRECT_OUTPUT;
296+
ASSERT_EQUALS((5 + 1 + 1) * 2, find_all_of(output_s, '\n'));
297+
}
298+
299+
void showtime_file_j() {
300+
REDIRECT; // should not cause TSAN failures as the showtime logging is synchronized
301+
check(2, 2, 0,
302+
"int main() {}",
303+
true, SHOWTIME_MODES::SHOWTIME_FILE);
304+
const std::string output_s = GET_REDIRECT_OUTPUT;
305+
ASSERT_EQUALS(2, find_all_of(output_s, "Overall time:"));
306+
}
307+
308+
void showtime_summary_j() {
309+
REDIRECT; // should not cause TSAN failures as the showtime logging is synchronized
310+
check(2, 2, 0,
311+
"int main() {}",
312+
true, SHOWTIME_MODES::SHOWTIME_SUMMARY);
313+
const std::string output_s = GET_REDIRECT_OUTPUT;
314+
// should only report the actual summary once
315+
ASSERT(output_s.find("1 result(s)") == std::string::npos);
316+
ASSERT(output_s.find("2 result(s)") != std::string::npos);
317+
}
285318
};
286319

287320
REGISTER_TEST(TestThreadExecutor)

0 commit comments

Comments
 (0)