-
Notifications
You must be signed in to change notification settings - Fork 48
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
Sonata CI #364
Sonata CI #364
Conversation
608f9ac
to
12248ca
Compare
Does the Sonata TB...
|
Unfortunately none of those, our current CI monitors the uart log file and based on the output there closes the simulation. I probably should change the script to do that instead of having a fixed timeout. |
3588284
to
12248ca
Compare
It would be nice to reuse one of the many existing mechanisms, rather than invent a new one. |
12248ca
to
b583a93
Compare
The only existing solution I know of is our Sonata test runner script: https://github.com/lowRISC/sonata-system/blob/c4b717946aa64a06593feb95487fa498d457f920/util/test_runner.py#L176 |
d60b096
to
b15ef2b
Compare
b15ef2b
to
c9b2e9a
Compare
Ok, I think I'm relatively happy with the state of this PR now. It runs all the examples on the Sonata simulator. It monitors the UART log and kills the simulator if it sees the model output match. There's also a timeout built in so the simulation doesn't take forever. The main question is whether you are happy with this mechanism I built here or whether you feel strongly enough to block this in favour of making changes to the simulator to add simulation control. |
I don't like cluttering the tree with model output in directories that users will explore. If we're going to do that, we need to make sure that all of the READMEs tell people not to look at those files. Is there really no way of exiting the Sonata simulator from in the simulation? That seems like a core feature for a simulator or emulator. Is it very hard to add one? The Ibex-SAFE one is hacked in a little bit in the verilator wrapper for the UART: it just reads the top bit and exits if you write something to the UART with the top bit set. Not very clean, but it does work (until you forget about it and write binary data over the UART). I also don't like the custom logic for running Sonata. We probably should have a sonata-sim board description that uses a different run script, so that we can just |
Thanks David, I can move the model output to this folder For exiting the simulator, I don't think it's particularly hard but it would mean blocking this PR until I make that change in Sonata system. I was trying to get xmake run to work. Is there a way to make the sonata simulator board description be the same as the main Sonata one but then with the following fields changed? |
I think that's fine. I want to restructure the scripts directory at some point and split the scripts that are part of the SDK from the ancillary ones, so anything in there is up for grabs.
Happy to merge this as a temporary fix, if that can come later.
Not easily other than copy and paste currently. My plan at some point is to add something like json patch support in the build system. I'm pondering a simpler solution of look for a .jq file if there isn't a .json file and have that run and consume the output. That would let us have a file that is a small jq script that took a json file in the same directory and made some small changes. Unfortunately, we use some small JSON5 extensions (hex literals) and jq doesn't currently support them. In particular, there's a bunch of stuff that's Ibex-specific that we should be able to share between a few places. Renode currently uses the sail JSON, but it should be possible to make it a 'sail + these bits' one. |
c9b2e9a
to
00198cf
Compare
0836079
to
bf6907c
Compare
Ok, I'm now happy with the state of this PR again. I've done the following things:
Some open things, which I don't think need to be dealt with before the merging:
|
These fixes were made in the Sonata prerelease board file.
This is useful in CI to see if examples are running correctly. The output is added to the scripts directory so that it is not confusing to users that are not necessarily familiar with CI. The names of the examples do not include the number because at the moment I've not found a clean way to get the number in xmake because the firmware image has the number removed. Also, output may vary per board so the model output is first divided up per board.
It uses the SONATA_SIMULATOR, SONATA_SIMULATOR_BOOT_STUB and SONATA_SIMULATOR_UART_LOG environment variables. It has two modes, one where the simulator runs in the foreground indefinitely and needs the user to manually stop the script. The second mode runs the simulator in the background and the UART log is monitored for a value given as a parameter to the script. When running in the monitoring mode, there is a 60 second timeout just so the script does not run forever. Example command, which returns 0 on success and 1 on failure: scripts/run-sonata-sim.sh examples/01.hello_world/build/cheriot/cheriot/release/hello_world scripts/model_output/sonata-simulator/examples/01.hello_world.txt
This is to stay consistent with the rest of the examples
It add Sonata pre-release to the matrix of boards. Xmake run tries to use the Sonata FPGA which does not exist in this CI. The test suite doesn't run on the simulator at the moment because HyperRAM is not supported in the RTOS right now. The Sonata smoke test runs each example and checks the content of the UART log against the model output. Debug executables are currently not running on Sonata because the UART log gets too full and causes the UART log to become unavailable inside the GitHub runners.
This is a copy of the Sonata prerelease board file with the simulator and simulation fields changed.
Instead of having a separate section to run examples in CI, this is now done in xmake instead using the newly created sonata-simulator board file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Thanks! |
Thanks for all your reviews, it's much better now than my first attempt :) |
This PR makes a few fixes to the Sonata board file and adds a script to run programs on the Sonata simulator.
Finally this PR is adding it to the CI, where all examples are run on the Sonata simulator and the UART output is checked against the model output.
This PR builds on top of adding the Sonata simulator and simulation boot stub to the development container: CHERIoT-Platform/devcontainer#19 and CHERIoT-Platform/devcontainer#21