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

Make changes to support HitL testing. #69

Merged
merged 15 commits into from
Aug 15, 2023
Merged

Conversation

haydenroche5
Copy link
Contributor

@haydenroche5 haydenroche5 commented Aug 1, 2023

  • Rename all examples so that they have underscores instead of hyphens. .py files with hyphens in their names can't be imported.
  • Add a test/hitl/ directory with one test (so far): cpy_test.py. This test makes sure that cpy_example.py runs successfully on a CircuitPython host connected to a Notecard. I tested using a Notecarrier F and a Swan.
  • cpy_test.py relies on pyboard.py from MicroPython. I have added that file from MicroPython's master branch here.

Mat's Notes:

  • I piggy-backed this PR rather than add a separate one.
  • Added HIL workflows for MicroPython and CircuitPython (pretty heavy lift.)
  • Added pre-commit hook to catch all the petty things.
  • We can add a pre-commit hook to check if pyboard.py has changed from the latest version on github. (I have not done this, left as an exercise for the reader ;-P)

@haydenroche5 haydenroche5 self-assigned this Aug 1, 2023
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure how we want to support this dependency. Single file submodule? It really is a great tool, and it works well with both MicroPython and CircuitPython.

@m-mcgowan m-mcgowan self-assigned this Aug 10, 2023
@m-mcgowan
Copy link
Contributor

Copy link
Contributor Author

@haydenroche5 haydenroche5 left a comment

Choose a reason for hiding this comment

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

Good stuff @m-mcgowan!

exit 1
fi

exit 0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missing newline at end of file.

Copy link
Contributor

Choose a reason for hiding this comment

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

added pre-commit checks to catch this.

- name: Make CircuitPython filesystem writeable to pyboard
if: ${{ matrix.lock_cpy_filesystem }}
run: |
timeout $USB_MSD_ATTACH_TIME bash test/scripts/wait_for_file.sh "$CPY_FS_CIRCUITPY"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this redundant since we already waited for the file to exist at line 104?

Copy link
Contributor

Choose a reason for hiding this comment

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

The previous step may not have run since it's conditional. But I want the check in the previous step to keep the check close to the behavior that affects it.


# only copy if it's changed or not present. After the device has reset, no further changes can be made
# until the filesystem is erased. This allows the workflow to be rerun flash_device=false
diff test/hitl/boot.py "$CPY_FS_CIRCUITPY/boot.py" || test/hitl/boot.py "$CPY_FS_CIRCUITPY"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should test/hitl/boot.py "$CPY_FS_CIRCUITPY" be cp test/hitl/boot.py "$CPY_FS_CIRCUITPY"?

default: true

jobs:
huzzah32:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this be called test instead, to mirror hil-circuitpython.yml?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I had the same thought when I renamed it. The matrix parameters show up in the job run so no need to name it specifically.

exit 1
fi

exit 0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missing newline at EOF.

UART=2

"""
The SCL pin of the I2C bus connected to Notecard
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comment seems slightly misplaced.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed it up when making a pep8 pass through.

examples/notecard-basics/mpy_example.py Outdated Show resolved Hide resolved
mpy_board/espressif_esp32.py Outdated Show resolved Hide resolved
mpy_board/huzzah32.py Outdated Show resolved Hide resolved
mpy_board/espressif_esp32.py Outdated Show resolved Hide resolved
```
b'Performing initial setup\r\nMicroPython v1.20.0 on 2023-04-26; ESP32 module with ESP32\r\nType "help()" for more information.\r\n>>> '

INTERNALERROR>     pyb.enter_raw_repl()
INTERNALERROR>   File "/home/mat/runners/notecard-nbgl-carr_f-huzzah32-serial/_work/note-python/note-python/test/hitl/deps/pyboard.py", line 367, in enter_raw_repl
INTERNALERROR>     raise PyboardError("could not enter raw repl")
INTERNALERROR> pyboard.PyboardError: could not enter raw repl
```
Copy link
Contributor

@m-mcgowan m-mcgowan left a comment

Choose a reason for hiding this comment

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

I'll leave it to you to approve the final review.

exit 1
fi

exit 0
Copy link
Contributor

Choose a reason for hiding this comment

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

added pre-commit checks to catch this.

- name: Make CircuitPython filesystem writeable to pyboard
if: ${{ matrix.lock_cpy_filesystem }}
run: |
timeout $USB_MSD_ATTACH_TIME bash test/scripts/wait_for_file.sh "$CPY_FS_CIRCUITPY"
Copy link
Contributor

Choose a reason for hiding this comment

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

The previous step may not have run since it's conditional. But I want the check in the previous step to keep the check close to the behavior that affects it.

default: true

jobs:
huzzah32:
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I had the same thought when I renamed it. The matrix parameters show up in the job run so no need to name it specifically.

UART=2

"""
The SCL pin of the I2C bus connected to Notecard
Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed it up when making a pep8 pass through.

examples/notecard-basics/mpy_example.py Outdated Show resolved Hide resolved
@m-mcgowan
Copy link
Contributor

@m-mcgowan
Copy link
Contributor

Since Hayden is also an author for this PR, he cannot approve a review. Merging with offline approval from him.

@m-mcgowan m-mcgowan merged commit b50f499 into blues:main Aug 15, 2023
7 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.

2 participants