Skip to content

Commit e297d67

Browse files
author
Rafael Stahl
committed
ci: actually wait for tests to finish
1 parent 2e1bc32 commit e297d67

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/test/main.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <cstdio>
33
#include <iostream>
44
#include <thread>
5+
#include <filesystem>
56

67
#ifdef WIN32
78
#include <Windows.h>
@@ -31,6 +32,8 @@ int main(int argc, char* argv[])
3132
return 0;
3233
}
3334

35+
std::remove("hl_test_success");
36+
3437
#ifdef WIN32
3538
auto result = (void*)LoadLibrary("hl_test_hostd.dll");
3639
#else
@@ -43,5 +46,17 @@ int main(int argc, char* argv[])
4346
return 1;
4447
}
4548

46-
std::cin.ignore();
49+
int elapsedTime = 0;
50+
while (elapsedTime++ < 200)
51+
{
52+
std::this_thread::sleep_for(std::chrono::milliseconds(10));
53+
if (std::filesystem::exists("hl_test_success"))
54+
{
55+
std::remove("hl_test_success");
56+
return 0;
57+
}
58+
}
59+
60+
printf("Timed out while waiting for tests to finish.\n");
61+
return 1;
4762
}

src/test/test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <stdexcept>
1818
#include <thread>
1919
#include <algorithm>
20+
#include <fstream>
2021

2122

2223
#define HL_ASSERT(cond, format, ...) \
@@ -599,6 +600,7 @@ class TestMain : public hl::Main
599600
HL_TEST(TestVEH);
600601

601602
HL_LOG_RAW("==========\nTests finished successfully.\n");
603+
std::ofstream successFile("hl_test_success");
602604
return false;
603605
}
604606
};

0 commit comments

Comments
 (0)