-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Possible bug in twister gtest harness #72318
Possible bug in twister gtest harness #72318
Comments
Hi @GeekOffTheStreet! We appreciate you submitting your first issue for our open-source project. 🌟 Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙 |
Thank you, I'll take a look this week. |
I am also experiencing a similar issue with twister. In my case I want to integrate CPPUTest so I had a look at the Gtest Harness. This brought me to this issue. As far as I understand the problem is that each test case name obtained dynamically from the std output of the Harness (Gtest in this case), is created by the format
I think that is the reason we get from harness handle from Gtest a created instance with name What happen is the following:
Possible solutionChange the Pass pattern (and similarly the fail pattern as well) to something as
|
The gTest harness asssumed that the lines end with the test name, but some gTest implementations include the test duration in the line. Update both the tests and regex to allow this and also avoid capturing characters into the `test_name` that cannot be valid test name chars. Fixes zephyrproject-rtos#72318 Signed-off-by: Yuval Peress <[email protected]>
The gTest harness asssumed that the lines end with the test name, but some gTest implementations include the test duration in the line. Update both the tests and regex to allow this and also avoid capturing characters into the `test_name` that cannot be valid test name chars. Fixes zephyrproject-rtos#72318 Signed-off-by: Yuval Peress <[email protected]>
I recently stumbled on this issue because I'm seeing the same error It looks like the pull request resolved another issue related to test timing being at the end of the gtest output, but did not address the duplicated suite and test name that vChavezB described above. Am I missing something else here? To elaborate: If I create a testcase.yaml that looks like:
and have a gtest like:
I see that the
which the gtest harness will match If I edit harness.py to remove Additionally, it looks to me like the
and the regex should look something like:
Its still not clear to me if this is just a misconfiguration of testcase.yaml or if the gtest harness is broken. I could use some guidance on what the testcase.yaml for existing gtests should look like. I'm happy to open a new issue to properly capture this, but wanted to start here since it was relevant to the originally closed issue |
@byteinthewild I'm on vacation right now, but I'll try to take a look ASAP |
Thank you very much, enjoy your vacation! |
Applying the changes from here: https://github.com/zephyrproject-rtos/zephyr/pull/65430/files fixed the issue for Googletest 1.15.0. Unfortunately the changes have not been merged into zephyr. |
Started working on this, should have it fixed by the end of the week. |
The gtest 1.15 has slightly different output from the original one that was used to set up the harness. With this change we support both output formats. Fixes zephyrproject-rtos#72318 Signed-off-by: Yuval Peress <[email protected]>
The gTest harness asssumed that the lines end with the test name, but some gTest implementations include the test duration in the line. Update both the tests and regex to allow this and also avoid capturing characters into the `test_name` that cannot be valid test name chars. Fixes zephyrproject-rtos#72318 Signed-off-by: Yuval Peress <[email protected]>
The gTest harness asssumed that the lines end with the test name, but some gTest implementations include the test duration in the line. Update both the tests and regex to allow this and also avoid capturing characters into the `test_name` that cannot be valid test name chars. Fixes zephyrproject-rtos#72318 (cherry picked from commit 1b51740) Original-Signed-off-by: Yuval Peress <[email protected]> GitOrigin-RevId: 1b51740 Change-Id: Ie03b5687c09bfd054b79253bcbc5e4b081e8aa3c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5675559 Tested-by: ChromeOS Prod (Robot) <[email protected]> Reviewed-by: Fabio Baltieri <[email protected]> Commit-Queue: Fabio Baltieri <[email protected]> Reviewed-by: Eric Yilun Lin <[email protected]>
The gtest 1.15 has slightly different output from the original one that was used to set up the harness. With this change we support both output formats. Fixes zephyrproject-rtos#72318 (cherry picked from commit bfb893a) Original-Signed-off-by: Yuval Peress <[email protected]> GitOrigin-RevId: bfb893a Cr-Build-Id: 8738819815572775377 Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8738819815572775377 Copybot-Job-Name: zephyr-main-copybot-downstream Change-Id: I39fdd2f3f10e567a0c19f8532d06d2ad6a6d4953 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5808856 Reviewed-by: Eric Yilun Lin <[email protected]> Commit-Queue: Eric Yilun Lin <[email protected]> Tested-by: ChromeOS Prod (Robot) <[email protected]> Tested-by: Eric Yilun Lin <[email protected]>
Discussed in #71635
Originally posted by GeekOffTheStreet April 17, 2024
I tried using Twister with the gtest harness and ran into issues with it detecting unit test execution. The behavior for how it parses sample.yaml/testcase.yaml doesn't match what I would expect. I should not that I'm not using pigweed. Consider this simple test case:
I build that for qemu using:
If I use the console harness with a sample.yaml resembling:
The test works as expected (sample output):
If I try to use the gtest harness:
The runner tries to match
HelloWorld.foo.HelloWorld.foo
instead of justHelloWorld.foo
and fails:I didn't see an obvious way to alter the matching behavior.
@yperess
The text was updated successfully, but these errors were encountered: