Skip to content
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

GCode fixture testing tool #1332

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Conversation

dymk
Copy link
Collaborator

@dymk dymk commented Sep 25, 2024

This adds a fixture testing tool for exercising gcode against real hardware. I'm using it to validate that I don't break basic functionality or simple corner cases with an automated test.

From the README.md...

GCode Fixture Tests

Basic tests sent to ESP32 hardware, to validate firmware behavior.

The run_fixture command is used to exercise a fixture on real hardware. Fixtures contain a list of
commands to send to the ESP32, and a list of expected responses. The test runner will send the
commands to the ESP32, and compare the responses to the expected responses.

Install the tool's dependencies with pip:

pip install -r requirements.txt

Supported operations:

  • # ...: Comment
  • ->: Send a command to the ESP32
  • <-: Expect a response from the ESP32
  • <~: Expect an optional message from the ESP32, but on mismatch, continue the test
  • <|: Expect one of the following responses from the ESP32

The tool can be ran with either a directory, or a single file. If a directory is provided, the tool
will run all the files ending in .nc in the directory.

Example, checking alarm state:

./run_fixture /dev/cu.usbserial-31320 fixtures/alarms.nc
-> $X
<~ [MSG:INFO: Caution: Unlocked]
<- ok
-> $Alarm/Send=10
<- ok
<- [MSG:INFO: ALARM: Spindle Control]
Fixture fixtures/alarms.nc passed

Example, checking idle status reporting:

./run_fixture /dev/cu.usbserial-31320 fixtures/idle_status.nc
-> $X
<~ [MSG:INFO: Caution: Unlocked]
<- ok
-> ??
<| <Idle|MPos:0.000,0.000,0.000|FS:0,0>
Fixture fixtures/idle_status.nc passed

@dymk dymk force-pushed the dymk/gcode-fixture-testing branch 2 times, most recently from 8587d7e to 99f20f2 Compare September 25, 2024 18:20
@MitchBradley MitchBradley merged commit 3a11c26 into bdring:main Sep 25, 2024
12 checks passed
@dymk dymk deleted the dymk/gcode-fixture-testing branch September 25, 2024 21:37
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