Skip to content

Tests refactoring: main test executable + CTest framework (issue 38) - #39

Merged
EndrII merged 3 commits into
mainfrom
task_38
Nov 12, 2026
Merged

EndrII merged 3 commits into
mainfrom
task_38

Conversation

@QuasarAppCI

Copy link
Copy Markdown
Member

Issue

Closes #38

What changed

Tests refactoring: added a main test executable where every test is implemented in its own function, and switched the test integration to the CTest framework (see "Testing With CMake and CTest", CMake documentation).

tests/test_OpenSimplex2F.c

  • main() is now the main test executable: it runs all tests, or a single test selected by name (OpenSimplex2tests test_noise3).
  • Every test is implemented in a different function:
    • test_noise2() - OpenSimplex2F_noise2 image (test2d.png) + noise2_XBeforeY range check
    • test_noise3() - OpenSimplex2F_noise3_Classic image (test3d.png) + noise3_XYBeforeZ/noise3_XZBeforeY range checks
    • test_noise4() - 3-octave OpenSimplex2F_noise4_Classic image (test4d.png) + noise4_XYBeforeZW/noise4_XZBeforeYW/noise4_XYZBeforeW range checks
  • Each test creates/frees its own context and returns 0 on success / 1 on failure (CTest-friendly exit codes).

CMake

  • Top-level CMakeLists.txt: enable_testing() replaces initAll() (the QuasarApp custom test target name is reserved when CTest is enabled; the unused doc/deploy/release targets it created are gone).
  • tests/CMakeLists.txt: initTests()/addTests() replaced with add_test() per test function, each registered with WORKING_DIRECTORY set to the build dir (PNG artifacts no longer touch the source tree).

CI

  • The test build target now invokes CTest (3 tests), so the CQtDeployer install/deploy step was removed from ci.yml; the cmake --build build --target test step stays unchanged.

Verification (local, Linux, CMake 3.28 / Ninja / GCC)

$ cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -S .
$ cmake --build build
$ ctest
1/3 Test #1: test_noise2 ....... Passed
2/3 Test #2: test_noise3 ....... Passed
3/3 Test #3: test_noise4 ....... Passed
100% tests passed, 0 tests failed out of 3

$ ctest -R test_noise4          # single test
1/1 Test #3: test_noise4 ....... Passed

$ cmake --build build --target test   # the CI step
100% tests passed, 0 tests failed out of 3

Also verified: ctest -R filtering, running the executable directly (all/one/unknown test), the legacy Makefile build+run, and OPENSIMPLEX2_TESTS=OFF configure.

Checklist

  • Main test executable with every test in a different function
  • CTest framework (enable_testing() + add_test()) used for the tests
  • ctest and the test build target pass locally
  • README tests section updated
  • CI workflow updated and consistent with the new test target

- main test executable: every test is now implemented in its own
  function (test_noise2, test_noise3, test_noise4); main() only selects
  and runs the tests (all of them or one by name).
- Use the CTest framework: enable_testing() + add_test() per test,
  replacing the custom deployTest/test targets of the QuasarApp CMake
  module (the 'test' build target now invokes ctest).
- The tests also range-check all 2D/3D/4D lattice orientation variants.
- Update CI: the test target runs ctest, so the CQtDeployer deploy
  step is no longer needed.
- Update the README tests section accordingly.
@QuasarAppCI QuasarAppCI mentioned this pull request Nov 12, 2026
EndrII
EndrII previously approved these changes Nov 12, 2026
@EndrII
EndrII enabled auto-merge November 12, 2026 18:29
@EndrII

EndrII commented Nov 12, 2026

Copy link
Copy Markdown
Member

resolve conflicts please

@QuasarAppCI

Copy link
Copy Markdown
Member Author

Task 39: Resolve merge conflicts with main (PR #33 / task_31) — work plan

  • git pull: main advanced with PR Cross-platform noise benchmark comparison (issue 31) #33 (cross-platform benchmark, task_31) — source of the conflict
  • Merge origin/main into task_38 and resolve conflicts in CMakeLists.txt + tests/CMakeLists.txt
  • Verify: CMake + Ninja build, ctest (all tests), cmake --build build --target test
  • Verify benchmark target (issue 31) still builds/passes on main
  • Push task_38, PR mergeable=CLEAN
  • Set label waiting-for-review, post summary comment

@QuasarAppCI

Copy link
Copy Markdown
Member Author

Conflicts resolved (merge with main / PR #33, task_31) — checklist

  • git pull: main advanced with PR Cross-platform noise benchmark comparison (issue 31) #33 (cross-platform benchmark, task_31) — source of the conflict
  • Merge origin/main into task_38 and resolve conflicts in CMakeLists.txt + tests/CMakeLists.txt
  • Verify: CMake + Ninja build, ctest (3/3 Passed), ctest -R single test, cmake --build build --target test
  • Verify benchmark target (issue 31) still builds/passes on main (OpenSimplex2_cross_platform_benchmark: PASS, 37107 values)
  • Push task_38, PR mergeable=CLEAN
  • Set label waiting-for-review, post summary comment

Resolution details

CMakeLists.txt (auto-merged, verified): keeps both the -ffp-contract=off compile option of the noise library (added by PR #33 for bit-identical cross-platform benchmark results) and the enable_testing() that replaces initAll() from this PR.

tests/CMakeLists.txt (manual resolution): keeps the CTest registration (add_test() per test function: test_noise2/test_noise3/test_noise4, replacing initTests()/addTests()) plus the cross-platform benchmark executable + OpenSimplex2_cross_platform_benchmark custom target from PR #33 (its comment about the test target was updated to match the CTest-based structure).

Verification (local, Linux, CMake 3.28 / Ninja / GCC, Qt 6.12.0)

cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -S .
cmake --build build
cTest: 3/3 Passed (test_noise2, test_noise3, test_noise4)
ctest -R test_noise4: 1/1 Passed
cmake --build build --target test: 3/3 Passed
OpenSimplex2_cross_platform_benchmark: PASS (37107 values, seed 77374)
OPENSIMPLEX2_TESTS=OFF configure: OK

PNG artifacts land in build/tests/, source tree stays clean.

@EndrII
EndrII self-requested a review November 12, 2026 18:42

@EndrII EndrII left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aqt install is not required anymore in actions - for all actions

@EndrII

EndrII commented Nov 12, 2026

Copy link
Copy Markdown
Member

i left simple feedback

@QuasarAppCI

QuasarAppCI commented Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

@/tmp/checklist2.md

@QuasarAppCI

QuasarAppCI commented Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

Task 39: Remove the aqt Qt installation from all GitHub Actions workflows (review feedback)

Feedback from @EndrII: "Aqt install is not required anymore in actions - for all actions" — the project is a plain C application (no Qt), the CTest refactor removed the CQtDeployer step, and QuasarApp.cmake only looks up qmake (non-fatal if absent — verified: configure prints qmake exec QMAKE_EXECUTABLE-NOTFOUND and continues).

  • git pull: task_38 is up to date (HEAD 4b61f0d)
  • ci.yml: drop the Install Qt (Windows/Linux) steps; Windows MinGW gcc from MSYS2 (mingw-w64-x86_64-gcc); drop QT_ROOT_DIR from the configure
  • cross-platform-compare.yml: drop the Install Qt (Windows/Linux/macOS) steps; Windows MinGW gcc from MSYS2; drop QT_ROOT_DIR from the configure
  • Verify: fresh CMake configure without qmake/Qt on PATH, full build, ctest 3/3, test target 3/3, benchmark PASS (37107 values, seed 77374, checksum bb84b67c9c4e1e11)
  • git diff check (only the two workflow files changed, YAML validated)
  • Push task_38 (18ecb67)
  • CI runs green: Build and Test ✓ (ubuntu + windows, MSYS2 GCC 16.2.0), Cross-Platform Noise Benchmark ✓ (linux + windows + macos, compare byte-for-byte identical)
  • Post summary comment, set label waiting-for-review

@EndrII
EndrII self-requested a review November 12, 2026 19:53
@QuasarAppCI

Copy link
Copy Markdown
Member Author

aqt Qt install removed from all actions — summary

Per @EndrII review ("Aqt install is not required anymore in actions - for all actions"): the project is a plain C application (no Qt code), the CTest refactor already removed the CQtDeployer step, and submodule/CMake/QuasarApp.cmake only looks qmake up at configure time (non-fatal when absent), so every jurplel/install-qt-action (aqt) step was removed from both workflows.

Changes (commit 18ecb67, 2 files, -72/+30):

  • .github/workflows/ci.yml: dropped the Install Qt (Windows) and (Linux) steps. The Windows gcc now comes from MSYS2 (mingw-w64-x86_64-gcc added to the existing msys2 step), Linux uses the pre-installed gcc. Dropped the now-unused -DCMAKE_PREFIX_PATH=${{ env.QT_ROOT_DIR }}.
  • .github/workflows/cross-platform-compare.yml: dropped the Install Qt (Windows), (Linux) and (macOS) steps. Same MSYS2 gcc change on Windows, dropped the QT_ROOT_DIR prefix path.
  • msys2 steps: added the msystem-mingw64 deprecation-warning suppression (the MINGW64 warning from the previous runs).

Verification:

  • Local (Linux, CMake + Ninja + GCC, no qmake on PATH): fresh configure OK (prints "qmake exec QMAKE_EXECUTABLE-NOTFOUND" and continues), build, ctest 3/3 Passed, cmake --build build --target test 3/3 Passed, benchmark PASS (37107 values, seed 77374, checksum bb84b67c9c4e1e11).
  • CI on 18ecb67:
    • Build and Test: ✓ ubuntu-latest + ✓ windows-latest (Windows compiled with the MSYS2 GCC 16.2.0 at D:/a/_temp/msys64/mingw64/bin/gcc.exe)
    • Cross-Platform Noise Benchmark: ✓ Linux + ✓ Windows + ✓ macOS (AppleClang 21, configure without qmake) + ✓ Compare results — all three platform reports are byte-for-byte identical (checksum=bb84b67c9c4e1e11)

PR ready for re-review.

@EndrII
EndrII merged commit e5b7895 into main Nov 12, 2026
9 checks passed
@EndrII
EndrII deleted the task_38 branch November 12, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests refactoring

2 participants