chore(tools_test): retry umount on macOS

We've seen some spurious failures to unmount a FUSE volume due to
the volume still being busy. Not sure if this fixes it, but worth
a try.
This commit is contained in:
Marcus Holland-Moritz 2024-02-01 15:27:58 +01:00
parent 314d7074ab
commit 17a74390c8

View File

@ -578,7 +578,22 @@ class driver_runner {
if (!umount) {
throw std::runtime_error("no umount binary found");
}
subprocess::check_run(umount.value(), mountpoint_);
auto t0 = std::chrono::steady_clock::now();
for (;;) {
auto [out, err, ec] = subprocess::run(umount.value(), mountpoint_);
if (ec == 0) {
break;
}
std::cerr << "driver failed to unmount:\nout:\n"
<< out << "err:\n"
<< err << "exit code: " << ec << "\n";
if (std::chrono::steady_clock::now() - t0 > std::chrono::seconds(5)) {
throw std::runtime_error(
"driver still failed to unmount after 5 seconds");
}
std::cerr << "retrying...\n";
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
bool rv{true};
if (process_) {
process_->wait();