support execute integration tests with monitor threads

Do not count monitor threads towards the "active" number of threads.
The test is complete when there are no non-monitor threads running.
This commit is contained in:
Michael "Z" Goddard 2018-09-07 17:16:28 -04:00
parent c76ad21093
commit 18c565794e
No known key found for this signature in database
GPG key ID: 762CD40DD5349872

View file

@ -31,7 +31,14 @@ const whenThreadsComplete = (t, vm, timeLimit = 2000) => (
// When the number of threads reaches 0 the test is expected to be complete.
new Promise((resolve, reject) => {
const intervalId = setInterval(() => {
if (vm.runtime.threads.length === 0) {
let active = 0;
const threads = vm.runtime.threads;
for (let i = 0; i < threads.length; i++) {
if (!threads[i].updateMonitor) {
active += 1;
}
}
if (active === 0) {
resolve();
}
}, 50);