Skip to content

Play your Steam library's Windows games on a jailbroken PS5.

C++

Stop a web file test crashing now and then

Leonardo Lobatoda4a89fc8d42
diff --git a/tests/web_file_store_test.cpp b/tests/web_file_store_test.cpp
index db069f6..99b7531 100644
--- a/tests/web_file_store_test.cpp
+++ b/tests/web_file_store_test.cpp
@@ -10,6 +10,7 @@
#include <fcntl.h>
#include <filesystem>
#include <fstream>
+#include <mutex>
#include <set>
#include <string>
#include <sys/stat.h>
@@ -91,7 +92,10 @@ int main() {
std::vector<std::string> steps;
FileStore::Options options;
std::string fail_at;
+ // Uploads race later on, and each calls this with no lock of the store's held.
+ std::mutex steps_mutex;
options.fault = [&](const std::string& step) {
+ std::lock_guard<std::mutex> lock(steps_mutex);
steps.push_back(step);
return step != fail_at;
};