Diagnose X11 client lifecycle failure
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 4s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 2m19s
Foundation / checks (ecs) (push) Canceled after 2m19s
Foundation / checks (postgres) (push) Canceled after 2m15s
Foundation / checks (tsan) (push) Canceled after 2m14s

This commit is contained in:
dingo
2026-10-11 16:39:58 -04:00
parent e2eba895b5
commit b99bb1b403
2 changed files with 28 additions and 1 deletions
+18 -1
View File
@@ -22,6 +22,12 @@ void check(bool ok, std::source_location at = std::source_location::current()) {
throw std::runtime_error("client lifecycle line " + std::to_string(at.line()));
}
#define CHECK(...) check(static_cast<bool>(__VA_ARGS__))
void check_sdl_shutdown(std::string_view test) {
const auto initialized = SDL_WasInit(0);
if (initialized != 0)
throw std::runtime_error(std::string{test} +
" left SDL initialized: " + std::to_string(initialized));
}
template <typename T, typename E> bool refused(const std::expected<T, E>& result, E error) {
return !result && result.error() == error;
}
@@ -563,7 +569,11 @@ int queued_keyboard_events() {
void capture_balances_toolkit() {
const auto frame = fixture();
auto result = Application::open({320, 240, false, "software"});
CHECK(result);
if (!result)
throw std::runtime_error("capture-balances open failed error=" +
std::to_string(static_cast<unsigned>(result.error())) +
" SDL_WasInit=" + std::to_string(SDL_WasInit(0)) +
" SDL=" + SDL_GetError());
auto app = std::move(result.value());
CHECK(app->poll_events());
const auto id = SDL_GetWindowID(window());
@@ -760,12 +770,19 @@ void capture_balances_toolkit() {
} // namespace
int main() try {
client_controls_tests();
check_sdl_shutdown("client controls");
frame_contract();
check_sdl_shutdown("frame contract");
lifecycle();
check_sdl_shutdown("lifecycle");
native_input();
check_sdl_shutdown("native input");
toolkit_capture();
check_sdl_shutdown("toolkit capture");
rebinding();
check_sdl_shutdown("rebinding");
capture_balances_toolkit();
check_sdl_shutdown("capture balances toolkit");
return 0;
} catch (const std::exception& e) {
std::fprintf(stderr, "%s: %s\n", e.what(), SDL_GetError());