Skip to content

tests: salvage unit tests from meson-only unit_tests - #4281

Merged
BsAtHome merged 5 commits into
LinuxCNC:masterfrom
grandixximo:salvage-unit-tests
Jul 29, 2026
Merged

tests: salvage unit tests from meson-only unit_tests#4281
BsAtHome merged 5 commits into
LinuxCNC:masterfrom
grandixximo:salvage-unit-tests

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

First step toward #4276 (retiring the meson.build files).

The only live content depending on the meson build is unit_tests/ (806 lines). This PR salvages what is worth keeping as regular runtests:

  • tests/blendmath: the tp blendmath unit test, ported from the greatest framework to plain C with identical assertions. It compiles blendmath.c at test time; the unreferenced rest of the trajectory planner is garbage-collected at link time.
  • tests/interp/unit-conversion: a new runtest covering G20/G21 unit switching, the one genuine coverage gap I found. It verifies that the current position converts and that the offset parameters (#5211, #5221) stay constant, since they are stored in user (INI) units.

The remainder of unit_tests/interp is not carried over: the G10/G92/G52 cases duplicate existing runtests under tests/interp/ (they were originally derived from them), two sections enshrine known-wrong rotation behavior flagged with FIXME by the original author, and the block-parse and toString tests only exercise parser internals.

Verified: scripts/runtests passes for both new tests and the neighboring interp suites (9/9).

The tp blendmath unit test lived in unit_tests/tp, reachable only
through the meson build, which no longer works. Port it to a plain C
runtest (dropping the vendored greatest.h framework) that compiles
test_blendmath.c together with blendmath.c at test time. Unreferenced
blendmath functions are garbage-collected at link time so the whole
trajectory planner does not need to be linked.

Same assertions as the original test.
Salvages the G20/G21 coverage from the meson-only unit_tests/interp
suite as a runtest. Verifies that switching length units converts the
current position, and that the numbered parameters backing the work
offsets (#5221 ff) and G92 axis offsets (#5211 ff) stay constant
because they are stored in user (INI) units.

The rest of the old suite duplicates existing runtests
(tests/interp/g10, tests/interp/g52) and is not carried over.
The worktree has core.fileMode=false, so the chmod never reached the
commit and CI failed with 'checkresult: Permission denied'.
The test compiles blendmath.c and internal TP headers from the source
tree, which does not exist when testing installed packages
(SYSTEM_BUILD=1). Mark it run-in-place only.
Comment thread tests/blendmath/test_blendmath.c Outdated
Comment thread tests/blendmath/test.sh
posemath.h comes from the include dir, use angle brackets. Use
explicit directory prefixes in the include statements instead of
adding src/emc/tp and src/emc/motion to the include path.
@BsAtHome

Copy link
Copy Markdown
Contributor

Interesting,... Now the halui/mdi test fails again.

@grandixximo

Copy link
Copy Markdown
Contributor Author

Yes, seems like its failing quite often today, almost every other build, since I merged your 4 PR's this morning

@BsAtHome

Copy link
Copy Markdown
Contributor

Yes, seems like its failing quite often today, almost every other build, since I merged your 4 PR's this morning

That doesn't make sense. The PRs don't touch halui (that is still in my tree).

The problem seems to be syncing halui instructions to emc via nml.

@BsAtHome

Copy link
Copy Markdown
Contributor

BTW, the amount of CI failures has been rather high lately (disregarding sid problems) and things have been stuck many times. Not sure how much of that is our fault... But, we probably have some race issue at hand.

@BsAtHome
BsAtHome merged commit 7411f61 into LinuxCNC:master Jul 29, 2026
31 of 32 checks passed
@BsAtHome

Copy link
Copy Markdown
Contributor

Now all meson.build files and the unit_tests dir can be removed.

@grandixximo

Copy link
Copy Markdown
Contributor Author

Now all meson.build files and the unit_tests dir can be removed.

Do you have that ready in the pipe? Or leaving the pleasure to me?

@BsAtHome

Copy link
Copy Markdown
Contributor

Nothing in my pipeline. You are welcome to take the pleasure, if you want it.

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