Skip to content

tests: bring the multiaxis tests from #4730 under 10 seconds each - #4807

Merged
BsAtHome merged 1 commit into
LinuxCNC:masterfrom
grandixximo:twp-tests-fast
Nov 9, 2026
Merged

BsAtHome merged 1 commit into
LinuxCNC:masterfrom
grandixximo:twp-tests-fast

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

Fixes #4805.

The tests from #4730 waited on nothing but motion and polling. The sims moved at 90 deg/s on the rotaries and 120 mm/s on the slides, often under TCP, where the slides swing around a pivot to keep the tip still, and every step waited out a 10 ms task cycle, the 10 ms poll of wait_complete() and two 50 ms status polls. twp-table did not stall: it finishes after about 5.6 minutes here.

test before after
twp-native 70 s 7.1 s
twp-native-ptp (split from twp-native) 7.2 s
twp-table 338 s 9.0 s
twp-table-one-sided (split from twp-table) 4.1 s
ptp-machine-frame 26 s 5.5 s
ptp-robot 22 s 4.2 s
kins-switch 16 s 8.4 s

About 3.6 s of each is LinuxCNC starting and stopping. All of them pass with six copies of each running beside four busy loops, and pinned to one CPU.

  • The sims move fast. Most checks look only at where a move ends. twp-native's G30.5 check, which reads the path from a sampler once a servo cycle, now derives how far short of the corner a sample can fall from the joint's own acceleration, instead of a number written for 700 mm/s^2.
  • The tests wait on what wait_complete() waits for, polled every 2 ms, and task runs a 1 ms cycle, except in kins-switch (below).
  • The faster polls showed three races in the tests that the slow polls had hidden, now fixed:
    • in position with an empty queue is also true before task has sent a move on, so the tests also wait for task's interpreter to be idle;
    • two polls can read the same status copy, so a move counts as ended only on a copy written two task cycles after the command, and still joints only across two copies with motion's heartbeat apart;
    • twp-native's sampler log is block buffered, so it now waits for the log to catch up before a move as well as after, and reads only the new lines.
  • twp-table and twp-native are split in two, so each half starts LinuxCNC once and the halves run in parallel. twp-native-ptp shares twp-native's INI and HAL files through symlinks and its helpers through twp-native/native.py.
  • twp-table starts each case with one joint-space G69 G53.5 G0 move, checks "no P is the nearer pose" against the P1 and P2 poses it already has from the same start, and keeps three of its five planes: one in general position, one with J negative, and one whose C sits near the +-180 wrap.
  • twp-native's timed point-to-point feeds take half a second each instead of one and two.

kins-switch keeps its 10 ms task cycle: at 1 ms its program's G12.1 after a G0 W0 sometimes switches while W is still about 25 um from the end of its move, and W stays there. That looks like a real race in the switch's wait for motion, which I will look into separately.

…each

Issue LinuxCNC#4805 (BsAtHome): twp-table took over five minutes and twp-native over one, and with ptp-machine-frame, ptp-robot and kins-switch at 16 to 26 seconds they added about eight minutes to CI. None of them waits on anything but motion and polling: the sims moved at 90 deg/s on the rotaries and 120 mm/s on the slides, often under TCP, where the slides swing around a pivot to keep the tip still; and every step waited out a 10 ms task cycle, the 10 ms poll of wait_complete() and two 50 ms status polls.

The sims now move fast. Most checks look only at where a move ends. twp-native reads paths from a sampler once a servo cycle: its G30.5 check now allows the a * dt^2 / 2 the turn can fall short between two samples from the joint's own acceleration, where it had the figure for 700 mm/s^2 written in. kins-switch samples status while its program strokes W, and W rests on a dwell at the end of the stroke.

The tests wait on what wait_complete() waits for, polled every 2 ms, and twp-native, twp-table and the ptp tests run task on a 1 ms cycle. Faster polls showed three races the slow ones had hidden. A move counted as ended when motion was in position with an empty queue, which is also true before task has sent the move on: the tests now also wait for task's interpreter to be idle. Status is a copy task writes once a cycle, so two polls can read the same copy and see still joints that are moving: a move now counts as ended only on a copy task wrote two cycles after the command, and still joints only over copies with motion's heartbeat apart. And twp-native counted the sampler log's lines before a move while the log, block buffered, could still lack the end of the previous one: it now waits for the log to reach the machine at rest before a move as well as after, and reads only the lines added since.

kins-switch keeps its 10 ms task cycle. At 1 ms its program's G12.1 after a G0 W0 sometimes switches while W is still about 25 um from the end of its move, and W stays there; that is for its own issue, not for this test.

Two tests are split, so that each half starts LinuxCNC once and runs beside the other: twp-table-one-sided takes the one-sided A of twp-table's second run, and twp-native-ptp the point-to-point moves of twp-native, sharing its INI and HAL files and, through twp-native/native.py, its helpers. twp-table starts each case with one joint-space G69 G53.5 move rather than a G0 of the tip, since G53.1 chooses its pose from the rotaries alone; it checks the pose with no P against the P1 and P2 poses it already has from the same start rather than driving there again; and it keeps three planes of five, one in general position, one with J negative and one whose C sits near the +-180 wrap. twp-native's timed point-to-point feeds take half a second each rather than one and two.

Here, each alone:

  twp-native            70 s  =>  7.1 s
  twp-native-ptp                  7.2 s
  twp-table            338 s  =>  9.0 s
  twp-table-one-sided             4.1 s
  ptp-machine-frame     26 s  =>  5.5 s
  ptp-robot             22 s  =>  4.2 s
  kins-switch           16 s  =>  8.4 s

All of them pass with six copies of each running beside four busy loops, and pinned to one CPU. About 3.6 s of each is LinuxCNC starting and stopping.

Fixes LinuxCNC#4805
@BsAtHome
BsAtHome merged commit 53b93f4 into LinuxCNC:master Nov 9, 2026
19 checks passed
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.

Tests twp-table stalls and twp-native has terrible performance

2 participants