Repository navigation
Test algorithm samples with and without debugging - #1533
Conversation
Benchmark for ddf9cd0Click to view benchmark
|
15fcc11 to
88479ea
Compare
This change introduces a scenario test under qsc that verifies the behavior of the samples with normal and debug execution. It uses fixed seeds to ensure results are predictable and restricts the slowest test (Shors.qs) to be release only. Included is some cleanup of output from the samples so that compatibel characters are used and no trailing spaces are present.
88479ea to
a662f9a
Compare
Benchmark for 1eb7d76Click to view benchmark
|
Benchmark for 5ddfcb0Click to view benchmark
|
Benchmark for 9504d80Click to view benchmark
|
Benchmark for 6dffb80Click to view benchmark
|
Ha, yeah, it's quite dramatic, isn't it? I'll go into more detail below for posterity, but the short answer is that it does things in memory, in parallel, rather than sequentially with disk reads. That said, I think the other test is still worthwhile (and maybe can be moved to integration tests?), in part because it builds all samples including language samples rather than just the algorithm samples. As soon as a new qs file or qsharp.json project is added to the samples folders, it will get picked up automatically by this part of the build. If after this PR (and ongoing work to add verification output to the language samples) we want to pull those into a test pattern like this, then we can revisit the question of whether the older style is still needed. Longer explanation below... When compiling these as unit tests, the test files are brought in using the |
|
Can we maybe add a build script to iterate through the samples and include all of them in the Rust tests? The fact that each sample is hardcoded sadly takes away from the usefulness of these tests... I can guarantee that the next person to add a sample will not think of adding them to this list :/ |
Not while still using |
|
We could have one big giant It's not obviously clear to me which way's better at the moment, you're right, each approach has its drawbacks - I'll let it sit in the back of my mind for a bit. |
|
I have a couple crazy ideas on how we could add a bit more automation to this, but I need to experiment with them more before I know how bad/good the ideas are... |
Benchmark for d76d1a6Click to view benchmark
|
Benchmark for 49dcbd1Click to view benchmark
|
|
We'll also need a user-facing folder samples/testing when we get to adding
samples of how to test Q# code. So, without looking at the code, I'm in
favor of keeping Rust test code that does not target users outside of the
samples folder so as not to confuse these two.
…On Wed, Jun 19, 2024 at 7:43 AM Stefan J. Wernli ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
On samples_test/Cargo.toml
<#1533 (comment)>:
I debated on that one. My thinking was that right now the samples folder
is pretty cleanly for folks looking to find Q# samples. We link to it from
other places, like QCOM. If there were Rust tests mixed in, especially
slightly arcane ones like these that are generated from a build script, it
makes the folder confusing for newcomers.
On a related note, I also debated about keeping these as a test under
"compiler/qsc" where I had originally put them. But it occurred to me that
with the way the build script is set up to watch the samples folder, any
change to samples would cause qsc to be rebuilt, which is not ideal. This
way there is a clearer division: samples_test depends on samples and qsc,
so changes to either of those will rebuild samples_test, but qsc won't
depend on the samples folder.
—
Reply to this email directly, view it on GitHub
<#1533 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNFAADBN4W5KV3T7NRWNLTZIGKKXAVCNFSM6AAAAABHZPYGA6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCMRYGQ4DSNJVGA>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
Benchmark for a40e6d2Click to view benchmark
|
Benchmark for f46ca1cClick to view benchmark
|
Benchmark for 7e1ffa5Click to view benchmark
|
Finally put the ideas this question triggered into a PR: #1739. Is the shift away from Python, qsc-based tests worth the build.rs complexity? We can let the team discuss. But at least we know it's possible! |


This change introduces a scenario test under qsc that verifies the behavior of the algorithm samples with normal and debug execution. It uses fixed seeds to ensure results are predictable and restricts the slowest test (Shors.qs) to be release only.
Included is some cleanup of output from the samples so that compatible characters are used and no trailing spaces are present.