Skip to content

unit_test: Restore 'waf test' functionality#69

Merged
gmarull merged 1 commit intopebble-dev:mainfrom
Colin-Suckow:fix_tests
Mar 16, 2025
Merged

unit_test: Restore 'waf test' functionality#69
gmarull merged 1 commit intopebble-dev:mainfrom
Colin-Suckow:fix_tests

Conversation

@Colin-Suckow
Copy link

Restores the waf test command, hopefully resolving #46.

Any tests failing to compile were commented out and appended with 'UNIT_TEST_DISABLED' for easy location in the future. Additionally, the entire fw/comm test suite was disabled because of missing bluetooth library headers (GAPAPI.h, GATTAPI.h).

I also added CI steps that run the test suite and parses the output junit.xml file. The test and parse steps are setup to not fail the entire build.

Comment on lines +67 to +69
- name: Run tests
run: ./waf test
continue-on-error: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will run on each matrix combination, feels like unnecessary. Maybe a new CI workflow for unit tests should be added?

Copy link
Author

Choose a reason for hiding this comment

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

Agreed. I have split the test runner out into a separate workflow. I also took the opportunity to add a step for uploading the failed visual diff result pngs.

Comment on lines +186 to +190
# clar(ctx,
# sources_ant_glob = \
# " src/fw/applib/graphics/gtypes.c" \
# " src/fw/applib/graphics/graphics_circle.c",
# test_sources_ant_glob = "test_graphics_circle.c")
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't there a better way to disable a test that doesn't involve commenting out code? like a quarantine list

Copy link
Author

Choose a reason for hiding this comment

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

I refactored the test skipping into an exclusion list. Good call on this one. The new solution feels a lot cleaner.

@gmarull gmarull requested a review from Hexxeh March 5, 2025 09:37
def build(bld):
# These tests don't compile because the bluetooth library needed was removed. The 'COMM_TESTS_DISABLED'
# flag has been added to temporarily disabled them.
if 'COMM_TESTS_DISABLED' in bld.env.DEFINES:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This feels like the wrong place to put this flag, since you're not. actually using it in C code. It should be just part of the waf env itself I think?

Copy link
Author

Choose a reason for hiding this comment

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

Agreed. This specific flag has been replaced by the test exclusion list, but I did add a new flag for skipping the python tool tests. That flag has been added directly to env.

Copy link
Collaborator

@Hexxeh Hexxeh left a comment

Choose a reason for hiding this comment

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

Can we create tickets for the things we had to disable to remember to go back and fix them?

@Colin-Suckow
Copy link
Author

Can we create tickets for the things we had to disable to remember to go back and fix them?

Sounds like a good idea to me. How do you want to handle this? Should I go ahead make the issues now or after this closes?

@Hexxeh
Copy link
Collaborator

Hexxeh commented Mar 6, 2025

Can we create tickets for the things we had to disable to remember to go back and fix them?

Sounds like a good idea to me. How do you want to handle this? Should I go ahead make the issues now or after this closes?

Given they're broken already I think you could go ahead and create them now. Or we could just list them on the original ticket for this.

@Colin-Suckow
Copy link
Author

Created #77 to track the disabled tests

@gmarull gmarull requested a review from Hexxeh March 7, 2025 16:24
pull_request:
branches: [main]

env:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way to re-use these between files (same with the first few steps below)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess it's time to setup a CI Docker image :-)

Copy link
Author

Choose a reason for hiding this comment

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

How do we feel about making a new issue for that docker image? Outside of my wheel house and seems significant enough to deserve its own review.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good with me :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

yep, can happen later

Copy link
Author

Choose a reason for hiding this comment

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

Created #82 for it

tests/wscript Outdated
# time_t is defined in sys/types in newlib, and time.h on recent Linux
# so just force the defined type for testing time
bld.env.CFLAGS.append('-Dtime_t=__SYSCALL_SLONG_TYPE')
#bld.env.CFLAGS.append('-Dtime_t=__SYSCALL_SLONG_TYPE')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be removed rather than just commenting, if it isn't needed anymore?

Copy link
Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

@gmarull gmarull left a comment

Choose a reason for hiding this comment

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

could you squash changes or reduce diffs somehow? looks like you're undoing initial changes in later commits

@Colin-Suckow Colin-Suckow force-pushed the fix_tests branch 2 times, most recently from 5b83a1f to 40306fa Compare March 12, 2025 01:57
@Colin-Suckow
Copy link
Author

could you squash changes or reduce diffs somehow? looks like you're undoing initial changes in later commits

Done (and done a second time because I found a test I forgot to uncomment and add to BROKEN_TESTS :) )

@gmarull gmarull requested a review from Hexxeh March 12, 2025 11:02
# time_t is defined in sys/types in newlib, and time.h on recent Linux
# so just force the defined type for testing time
pdc2png_env.CFLAGS.append('-Dtime_t=__SYSCALL_SLONG_TYPE')
#pdc2png_env.CFLAGS.append('-Dtime_t=__SYSCALL_SLONG_TYPE')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this just be removed (I think this was commented before, was the change maybe just lost)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Removed. This is a separate define from the last one. Forgot about it during the last fix.

Signed-off-by: Colin Suckow <colin@suckow.dev>
@gmarull gmarull merged commit 44e7092 into pebble-dev:main Mar 16, 2025
6 checks passed
@Colin-Suckow Colin-Suckow mentioned this pull request Mar 19, 2025
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.

3 participants