diff --git a/AGENTS.md b/AGENTS.md index af9abe7..5865912 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,7 +11,7 @@ ASWLog is a thread-safe, dependency-free C++20 logging library for Windows and L - `ASWLog/` contains the framework implementation. - `tests/` contains the unit tests: test modules (`Test_ASWLog_`, the tests of `ASWLog_`) and shared test helpers (`UT_Helper_`, e.g. `UT_Helper_DateTime`) in `tests/tests/`, their CMake project in `tests/cmake/`, their RAD Studio console project in `tests/rad370/`, and their RAD Studio VCL GUI runner project in `tests/vcl/gui/rad370/` (built from the submodule's `vcl/gui/src`). `tests/compile_checks/` holds "must not compile" checks, which `tests/cmake/CMakeLists.txt` runs with `try_compile` when configuring (a failed check stops the configure). `tests/package/` is a project that builds against an installed ASWLog with `find_package` (CI installs the library and runs it). - `CMakeLists.txt` (the root) defines the `ASWLog::ASWLog` library target and its install rules; `cmake/ASWLogConfig.cmake.in` is the template of the installed package file. The project version is read from `ASWLog/ASWLog_Version.h`. -- `third_party/asw-unit-tests/` is the ASWUnitTests framework, a git submodule pinned to a release tag. Never edit files in it; test modules self-register with `ASW_REGISTER_TEST_GROUP`, so adding a test only touches `tests/` and its build files. Each test group derives from `TAutoTestGroup`, so a new test is defined with `ASW_TEST(ClassName, TestName)` in the group's `.cpp` and declared as a public `Test_TestName()` method in its header, with no `RegisterTest()` call. +- `third_party/asw-unit-tests/` is the ASWUnitTests framework, a git submodule pinned to a release tag. Never edit files in it; test modules self-register with `ASW_REGISTER_TEST_GROUP`, so adding a test only touches `tests/` and its build files. Each test group derives from `TAutoTestGroup`, so a new test is defined with `ASW_TEST(ClassName, TestName)` in the group's `.cpp` and declared as a public `Test_TestName()` method in its header, with no `RegisterTest()` call. The test groups of loggers that write entries somewhere (the sinks, e.g. `TASWFileLog`, `TASWConsoleLog`, `TASWNullLog`) register with `ASW_REGISTER_TEST_GROUP_IN_SUITE(ClassName, "Sinks")`, so `--filter "Sinks.*"` runs them all; loggers that pass entries on to others (`TASWMultiLog`, `TASWCategoryLog`) and the other test groups aren't in a suite. - `.github/workflows/ci.yml` builds and runs the unit tests on Windows (MSVC, MinGW) and Linux (GCC, Clang), plus Linux Clang builds with ThreadSanitizer and with AddressSanitizer + UBSan (`ASWLOG_SANITIZE`); the non-sanitizer jobs also check the installed CMake package (`tests/package/`). A Linux GCC coverage job (informational, it never fails the run) shows the library's line coverage on its summary page and uploads an HTML report. - `example/` contains example app that uses the logger. - `example/rad370/` contains the RAD Studio 13.1 project and Windows build scripts. diff --git a/tests/tests/Test_ASWLog_ConsoleLog.cpp b/tests/tests/Test_ASWLog_ConsoleLog.cpp index d9bdfc6..8404c1b 100644 --- a/tests/tests/Test_ASWLog_ConsoleLog.cpp +++ b/tests/tests/Test_ASWLog_ConsoleLog.cpp @@ -830,4 +830,4 @@ ASW_TEST(TTest_ASWLog_ConsoleLog, WarnAndAboveWriteToStdErr) } // namespace ASWUnitTests //--------------------------------------------------------------------------- -ASW_REGISTER_TEST_GROUP(ASWUnitTests::TTest_ASWLog_ConsoleLog) +ASW_REGISTER_TEST_GROUP_IN_SUITE(ASWUnitTests::TTest_ASWLog_ConsoleLog, "Sinks") diff --git a/tests/tests/Test_ASWLog_DebuggerLog.cpp b/tests/tests/Test_ASWLog_DebuggerLog.cpp index 0667081..4d83ce1 100644 --- a/tests/tests/Test_ASWLog_DebuggerLog.cpp +++ b/tests/tests/Test_ASWLog_DebuggerLog.cpp @@ -333,4 +333,4 @@ ASW_TEST(TTest_ASWLog_DebuggerLog, Windows_WritesTheCrashLineDirectly) } // namespace ASWUnitTests //--------------------------------------------------------------------------- -ASW_REGISTER_TEST_GROUP(ASWUnitTests::TTest_ASWLog_DebuggerLog) +ASW_REGISTER_TEST_GROUP_IN_SUITE(ASWUnitTests::TTest_ASWLog_DebuggerLog, "Sinks") diff --git a/tests/tests/Test_ASWLog_FileLog.cpp b/tests/tests/Test_ASWLog_FileLog.cpp index 0568aad..1c483fa 100644 --- a/tests/tests/Test_ASWLog_FileLog.cpp +++ b/tests/tests/Test_ASWLog_FileLog.cpp @@ -3587,4 +3587,4 @@ ASW_TEST(TTest_ASWLog_FileLog, Write_EarlierRecordDoesNotRollLogBack) } // namespace ASWUnitTests //--------------------------------------------------------------------------- -ASW_REGISTER_TEST_GROUP(ASWUnitTests::TTest_ASWLog_FileLog) +ASW_REGISTER_TEST_GROUP_IN_SUITE(ASWUnitTests::TTest_ASWLog_FileLog, "Sinks") diff --git a/tests/tests/Test_ASWLog_MemoryLog.cpp b/tests/tests/Test_ASWLog_MemoryLog.cpp index b0776cb..2c40262 100644 --- a/tests/tests/Test_ASWLog_MemoryLog.cpp +++ b/tests/tests/Test_ASWLog_MemoryLog.cpp @@ -360,4 +360,4 @@ ASW_TEST(TTest_ASWLog_MemoryLog, Threads_ReaderGetsEveryLineOnce) } // namespace ASWUnitTests //--------------------------------------------------------------------------- -ASW_REGISTER_TEST_GROUP(ASWUnitTests::TTest_ASWLog_MemoryLog) +ASW_REGISTER_TEST_GROUP_IN_SUITE(ASWUnitTests::TTest_ASWLog_MemoryLog, "Sinks") diff --git a/tests/tests/Test_ASWLog_NullLog.cpp b/tests/tests/Test_ASWLog_NullLog.cpp index 0dce676..f22dcf9 100644 --- a/tests/tests/Test_ASWLog_NullLog.cpp +++ b/tests/tests/Test_ASWLog_NullLog.cpp @@ -256,4 +256,4 @@ ASW_TEST(TTest_ASWLog_NullLog, Wrapped_WritesNothing) } // namespace ASWUnitTests //--------------------------------------------------------------------------- -ASW_REGISTER_TEST_GROUP(ASWUnitTests::TTest_ASWLog_NullLog) +ASW_REGISTER_TEST_GROUP_IN_SUITE(ASWUnitTests::TTest_ASWLog_NullLog, "Sinks") diff --git a/tests/tests/Test_ASWLog_SyslogLog.cpp b/tests/tests/Test_ASWLog_SyslogLog.cpp index 9f26caf..c641c9a 100644 --- a/tests/tests/Test_ASWLog_SyslogLog.cpp +++ b/tests/tests/Test_ASWLog_SyslogLog.cpp @@ -437,4 +437,4 @@ ASW_TEST(TTest_ASWLog_SyslogLog, ShouldLog_FollowsThePlatform) } // namespace ASWUnitTests //--------------------------------------------------------------------------- -ASW_REGISTER_TEST_GROUP(ASWUnitTests::TTest_ASWLog_SyslogLog) +ASW_REGISTER_TEST_GROUP_IN_SUITE(ASWUnitTests::TTest_ASWLog_SyslogLog, "Sinks") diff --git a/tests/tests/Test_ASWLog_WindowsEventLog.cpp b/tests/tests/Test_ASWLog_WindowsEventLog.cpp index 9b0a339..e733ddc 100644 --- a/tests/tests/Test_ASWLog_WindowsEventLog.cpp +++ b/tests/tests/Test_ASWLog_WindowsEventLog.cpp @@ -626,4 +626,4 @@ ASW_TEST(TTest_ASWLog_WindowsEventLog, Windows_ReportsARefusedEvent) } // namespace ASWUnitTests //--------------------------------------------------------------------------- -ASW_REGISTER_TEST_GROUP(ASWUnitTests::TTest_ASWLog_WindowsEventLog) +ASW_REGISTER_TEST_GROUP_IN_SUITE(ASWUnitTests::TTest_ASWLog_WindowsEventLog, "Sinks") diff --git a/tests/vcl/gui/rad370/ASWLogTests_VCL_GUI.cpp b/tests/vcl/gui/rad370/ASWLogTests_VCL_GUI.cpp index 9d74600..d015149 100644 --- a/tests/vcl/gui/rad370/ASWLogTests_VCL_GUI.cpp +++ b/tests/vcl/gui/rad370/ASWLogTests_VCL_GUI.cpp @@ -64,6 +64,12 @@ int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int) // The form outlives Run(); Application frees it later, during shutdown. exitCode = FormASWUnitTestsGUIMain->ExitCode(); + + // After a timeout, the abandoned test's thread may still be running, using one of the form's test groups, + // and after a crash their state may be corrupted, so the process ends here, as the console runner's does, + // without destroying them. The layout and selection were saved as the window closed. + if (FormASWUnitTestsGUIMain->WasRunAborted()) + ExitProcess(static_cast(exitCode)); } catch (Exception& exception) { diff --git a/third_party/asw-unit-tests b/third_party/asw-unit-tests index c30bcbb..6895de4 160000 --- a/third_party/asw-unit-tests +++ b/third_party/asw-unit-tests @@ -1 +1 @@ -Subproject commit c30bcbb774f62206aeca4276410236015b6bf8fc +Subproject commit 6895de4bcc63996f65449276f04b3402ab705892