Skip to content

Make the console test build and pass again - #26

Merged
tomluchowski merged 1 commit into
tomluchowski:shaders-improvementfrom
Upabjojr:split/console-test
Aug 5, 2026
Merged

Make the console test build and pass again#26
tomluchowski merged 1 commit into
tomluchowski:shaders-improvementfrom
Upabjojr:split/console-test

Conversation

@Upabjojr

@Upabjojr Upabjojr commented Aug 1, 2026

Copy link
Copy Markdown

Building with OD_BUILD_TESTING=ON has been broken on the base branch for a while: the console interface test no longer compiled, then did not link, then crashed. This fixes all three layers so the test builds and passes again. One commit.


Split out of #16 so each topic can be reviewed on its own. Merging all of the split PRs reproduces the tree of #16 exactly.

🤖 Generated with Claude Code

Building with OD_BUILD_TESTING=ON has been broken for a while: the console
interface test no longer compiled, and once it compiled it did not link, and
once it linked it crashed. One layer at a time:

addCommand() lost its description parameter at some point, with the form that
takes one renamed to addCommandAux(), and the test still called the old one.

ConsoleInterface.cpp includes pybind11/embed.h without using anything from it.
The include drags Python symbols into the object file, which the game only
carries because it links pybind11::embed; the test target does not, and has no
reason to. The include goes away, which unbreaks the link and drops a spurious
dependency.

Executing a command no longer records it in the history: the history belongs to
whoever owns the prompt, and the game console, which now runs its commands
through Python, records what was typed itself. The test still assumed recording
was implicit, so its history was empty and it dereferenced the boost::none that
scrolling an empty history correctly returns. It now records each command the
way the game does, and the scrolling expectations hold as written: nine
commands in, the prompt round trip, nine commands back out.

The whole suite passes, each test against its own server the way
run_unit_tests.sh starts them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 10ccb9f)
@tomluchowski
tomluchowski merged commit 5a9a186 into tomluchowski:shaders-improvement Aug 5, 2026
@tomluchowski

tomluchowski commented Aug 5, 2026

Copy link
Copy Markdown
Owner

That's fine , any ideas on fixing the other tests ?

For that example , the tests, which requires client connecting to server :

/============================================================================/
./boosttest-source_tests-aa-LaunchGame
Running 1 test case...
(16:06:22) (test_LaunchGame) [NORMAL] Adding player nick=PlayerStub1, id=-1, seatId=1
(16:06:22) (test_LaunchGame) [NORMAL] Adding ai player id=0, seatId=2
(16:06:22) (test_LaunchGame) [NORMAL] Adding ai player id=0, seatId=3
(16:06:22) (ODClientTest) [NORMAL] Local player is nick=PlayerStub1, id=-1, seatId=1
(16:06:22) (ODSocketClient) [CRITICAL] (ODSocketClient.cpp:36) Could not connect to distant server status=3
(16:06:22) (ODClientTest) [NORMAL] Couldn't connect to server right away. Sleeping a bit before retry
(16:06:27) (ODSocketClient) [CRITICAL] (ODSocketClient.cpp:36) Could not connect to distant server status=3
/home/tom/Opendungeons_github/OpenDungeonstomluchowski/OpenDungeonsPlus/source/tests/test_LaunchGame.cpp(88): error: in "test_LaunchGame": check client.connect("localhost", 32222, 10, "test_LaunchGameReplay") has failed
/home/tom/Opendungeons_github/OpenDungeonstomluchowski/OpenDungeonsPlus/source/tests/test_LaunchGame.cpp(90): error: in "test_LaunchGame": check client.isConnected() has failed
(16:06:32) (test_LaunchGame) [NORMAL] turnNum=0
/home/tom/Opendungeons_github/OpenDungeonstomluchowski/OpenDungeonsPlus/source/tests/test_LaunchGame.cpp(98): error: in "test_LaunchGame": check client.mTurnNum > 10 has failed
/home/tom/Opendungeons_github/OpenDungeonstomluchowski/OpenDungeonsPlus/source/tests/mocks/ODClientTest.cpp(461): error: in "test_LaunchGame": check false has failed
/home/tom/Opendungeons_github/OpenDungeonstomluchowski/OpenDungeonsPlus/source/tests/test_LaunchGame.cpp(102): error: in "test_LaunchGame": check false has failed

*** 5 failures are detected in the test module "TestLaunchGame"
/===========================================================================/

@Upabjojr

Upabjojr commented Aug 6, 2026

Copy link
Copy Markdown
Author

The aa-*/ab-* tests aren't standalone unit tests — they're integration tests where the test binary is only the client side of a game. They expect a headless game server already listening on localhost:32222, which is why you get Could not connect to distant server status=3 when running them directly.

The repo already has the harness for this: scripts/unix/run_unit_tests.sh. Run it from the build directory containing opendungeons-plus and the boosttest-source_tests-* binaries. The two-letter prefix of each test name tells the script which map to serve: 00 = no server needed, otherwise it starts ./opendungeons-plus --server <prefix>.level --port 32222 --log srvLog.txt in the background before running the test (the maps aa.level and ab.level are in levels/multiplayer/). On Windows, scripts/win32/OpenDungeonsTests.bat does the same thing.

I've also opened #31 which wires that server start/stop into CTest itself, so a plain ctest from the build directory now handles it automatically (including a resource lock so ctest -j doesn't run two servers on the same port).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants