projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
03ac5dd
)
Fix deadlock in test, caused by setting jobs to finished before they have been started.
author
Carl Hetherington
<cth@carlh.net>
Wed, 22 Dec 2021 15:47:27 +0000
(16:47 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Thu, 23 Dec 2021 12:06:03 +0000
(13:06 +0100)
test/job_manager_test.cc
patch
|
blob
|
history
diff --git
a/test/job_manager_test.cc
b/test/job_manager_test.cc
index 1baa5767e25a6b678b57426843443e79d5119641..cdd1e2a29871069b7367328c048febfd8580f146 100644
(file)
--- a/
test/job_manager_test.cc
+++ b/
test/job_manager_test.cc
@@
-123,8
+123,19
@@
BOOST_AUTO_TEST_CASE (job_manager_test2)
BOOST_CHECK (i == 5 ? jobs[i]->running() : !jobs[i]->running());
}
BOOST_CHECK (i == 5 ? jobs[i]->running() : !jobs[i]->running());
}
- for (auto job: jobs) {
- job->set_finished_ok();
+ /* Set any jobs that are started to be finished, until they're all finished */
+ while (true) {
+ if (std::find_if(jobs.begin(), jobs.end(), [](shared_ptr<Job> job) { return !job->finished_ok(); }) == jobs.end()) {
+ break;
+ }
+
+ for (auto job: jobs) {
+ if (job->running()) {
+ job->set_finished_ok();
+ }
+ }
}
}
+
+ BOOST_REQUIRE (!wait_for_jobs());
}
}