From 6f339810f23bdd32311726fb2736e26e2cdb7edb Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 6 Mar 2026 13:36:18 +0000 Subject: Include a stacktrace in Boost test context reported for OpenGL errors --- test/Jamfile.jam | 3 ++- test/testMainWindow.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/test/Jamfile.jam b/test/Jamfile.jam index bdaaa45..a96ca2a 100644 --- a/test/Jamfile.jam +++ b/test/Jamfile.jam @@ -4,6 +4,7 @@ import path : glob-tree ; lib boost_unit_test_framework ; lib benchmark ; +lib stdc++exp ; path-constant res : ../res ; path-constant fixtures : fixtures ; @@ -42,7 +43,7 @@ project : requirements tidy:hicpp-vararg tidy:boost ; -lib test : [ glob *.cpp : test-*.cpp perf-*.cpp ] ; +lib test : [ glob *.cpp : test-*.cpp perf-*.cpp ] : stdc++exp ; rule perfrun ( main + : extra-requirements * : runtime-dependency * : command-args * ) { local name = $(main[0]:S=) ; local benchmark = $(main[0]:S=.benchmark) ; diff --git a/test/testMainWindow.cpp b/test/testMainWindow.cpp index d048682..40f5567 100644 --- a/test/testMainWindow.cpp +++ b/test/testMainWindow.cpp @@ -1,15 +1,19 @@ #include "testMainWindow.h" +#include #include #include +#include TestMainWindow::TestMainWindow() : MainWindow {{1, 1}, __FILE__, SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN} { glEnable(GL_DEBUG_OUTPUT); + glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); glDebugMessageCallback( [](GLenum /*source*/, GLenum type, GLuint /*id*/, GLenum severity, GLsizei /*length*/, const GLchar * message, const void *) { const auto msg = std::format("GL CALLBACK: {} type = 0x{:x}, severity = 0x{:x}, message = {}", (type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : ""), type, severity, message); + BOOST_TEST_INFO(std::stacktrace::current()); switch (type) { case GL_DEBUG_TYPE_ERROR: case GL_DEBUG_TYPE_PORTABILITY: -- cgit v1.3