-
Notifications
You must be signed in to change notification settings - Fork 135
tests: introduce doctest infra + migrate llcommon/llmath/llcorehttp subsets (ctest green) [relates to #4445] #4852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 62 commits
d3f86dc
f0cc844
788a7e4
4e3aeda
3548f4c
a7754f8
793644a
20f3f55
ed76751
777e13b
9005d58
2934c2d
d90f52a
4cbaa1c
b1716b5
d8d17c8
dcc97c4
10e04a6
a32b47a
273634c
756afce
4359ec7
1e50ca3
a032467
b202376
1f41539
e56b5ed
236acab
f38a680
00f1bdc
56f03dc
da5d451
8c01f51
6aa26be
d1c6596
38d0747
5d00199
0419099
c982468
fc159f4
60cb3d4
53e5e3d
7604e34
a0cbcd6
8f9524b
7dbae78
708b9ed
4c6b31c
b4dd99e
832e93b
a5140c4
2f39dae
b042b98
a4b7f8b
d2273a7
c875e5e
a8b2242
fa1ec14
d7afdbd
1122042
383db4f
3006e09
6b7f4f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # doctest quickstart | ||
|
|
||
| This repository uses a header-only doctest setup with a thin helpers/compat layer. | ||
|
|
||
| - Enable: `autobuild configure -c RelWithDebInfoOS -- -DLL_TESTS=ON` | ||
| - Build targets: `llcommon_doctest` (subset of llcommon tests), `llmath_doctest`, `llcorehttp_doctest`, `login_doctest` | ||
| - Run: `ctest -C RelWithDebInfo -R "(llcommon_doctest|llmath_doctest|llcorehttp_doctest|login_doctest)" -V` | ||
|
||
|
|
||
| Notes: | ||
| - Hand-authored tests are marked with `// DOCTEST_SKIP_AUTOGEN` to keep the generator idempotent. | ||
| - `LL_CHECK_*` helpers provide clearer output for floats, buffers, wide strings, and ranges. | ||
| - The HTTP fakes layer keeps tests network/IO-free by simulating responses with a monotonic clock and per-handle queues (redirects, retries, cancels). | ||
|
|
||
| ## Windows: local build with Autobuild and LL_TESTS | ||
|
|
||
| Assumes a Windows setup with Visual Studio and Autobuild available on PATH. | ||
|
|
||
| 1. Open a “Developer Command Prompt for VS 2022” (x64). | ||
|
|
||
| 2. Change to the viewer root, e.g.: | ||
|
|
||
| cd D:\Projects\viewer | ||
|
|
||
| 3. Ensure there is a `build-variables` directory next to the source tree. | ||
| If you already have `.build-variables` in this checkout, clone it locally: | ||
| xcopy /E /I .build-variables build-variables | ||
|
|
||
| 4. Configure a RelWithDebInfo build with tests enabled: | ||
| autobuild configure -c RelWithDebInfoOS -- -DLL_TESTS=ON | ||
|
|
||
| 5. Build the viewer and test binaries: | ||
| autobuild build -c RelWithDebInfoOS | ||
|
|
||
| 6. Run the doctest-based targets via CTest (adjust the build directory name if needed): | ||
| ctest -C RelWithDebInfo ^ | ||
| -R "(llcommon_doctest|llmath_doctest|llcorehttp_doctest|login_doctest)" ^ | ||
| -V --test-dir build-vc170-64 | ||
|
|
||
| The Autobuild configuration name (`RelWithDebInfoOS`) maps to the Visual Studio configuration `RelWithDebInfo`, which is the value used with `ctest -C`. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,8 @@ project(${ROOT_PROJECT_NAME}) | |
|
|
||
| set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_BINARY_DIR}") | ||
|
|
||
| enable_testing() | ||
|
||
|
|
||
| include(conanbuildinfo OPTIONAL RESULT_VARIABLE USE_CONAN ) | ||
| if( USE_CONAN ) | ||
| set( USE_CONAN ON ) | ||
|
|
@@ -92,11 +94,6 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llplugin) | |
| add_subdirectory(${LIBS_OPEN_PREFIX}llui) | ||
| add_subdirectory(${LIBS_OPEN_PREFIX}viewer_components) | ||
|
|
||
| if( LL_TESTS ) | ||
| # Legacy C++ tests. Build always, run if LL_TESTS is true. | ||
| add_subdirectory(${VIEWER_PREFIX}test) | ||
| endif() | ||
|
|
||
| if (ENABLE_MEDIA_PLUGINS) | ||
| # viewer media plugins | ||
| add_subdirectory(${LIBS_OPEN_PREFIX}media_plugins) | ||
|
|
@@ -147,4 +144,3 @@ if (LL_TESTS) | |
| # individual apps can add themselves as dependencies | ||
| add_subdirectory(${INTEGRATION_TESTS_PREFIX}integration_tests) | ||
| endif (LL_TESTS) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # -*- cmake -*- | ||
| include_guard(GLOBAL) | ||
|
|
||
| if(NOT DEFINED DOCTEST_INCLUDE_DIR) | ||
| set(DOCTEST_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/extern/doctest") | ||
| endif() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2016-2024 Viktor Kirilov | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file appears to start with a UTF-8 BOM (the invisible character before
#). BOMs can cause noisy diffs and occasional tooling quirks (some linters/Markdown processors treat it as text). Consider removing the BOM so the first character is#.