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

Add a C test library for easier testing of the generated bindings #764

Merged
merged 1 commit into from
Jan 21, 2023

Conversation

cameronwhite
Copy link
Contributor

@cameronwhite cameronwhite commented Jan 16, 2023

This is related to #504 - I decided to experiment with this after writing a C library to test out #763, and found it really useful to have a simple C function (which I could also add printouts to, etc) to test against
I think this could make it easier to have more extensive tests for correctness, which can run without a display and without requiring a lot of boilerplate code to call a function with the parameter type we want to test (e.g. having to construct a GTK application and widgets)

Still a work in progress, but wanted to get some initial feedback on whether this would be worth adding?
Also a couple questions:

  • Currently I have this as a separate script. I wasn't sure about making this part of the default build since it adds the requirement of having a C toolchain, gir-related tools, etc?
  • The library is currently generated into the Libs folder like everything else, but it could perhaps go elsewhere. I'm not sure if there are any things to watch out for with this, e.g. would it be pulled into the Nuget packages?

TODOs

  • Needs testing on other platforms, currently only tested on macOS
  • Add to CI build script

@badcel
Copy link
Member

badcel commented Jan 16, 2023

I did not look at the code but the idea is very welcome!


Edit: I like how you separated the new stuff from the old. I would not like to require a C toolchain for dotnet developers.

I updated #504 with a new idea.

@cameronwhite cameronwhite force-pushed the feature/c-test-library branch 17 times, most recently from 1d36d5b to 7023e1c Compare January 18, 2023 03:13
@cameronwhite
Copy link
Contributor Author

I've got the Windows build sorted out now, so this is building and running the test successfully on all platforms 🎉

@cameronwhite cameronwhite marked this pull request as ready for review January 18, 2023 03:26
@badcel
Copy link
Member

badcel commented Jan 18, 2023

Can you update the reademe's Build section and include a dotnet build GirCore.Libs.slnf?

Additionally I think it would be helpful to explain why the solution filter exists.

@cameronwhite cameronwhite force-pushed the feature/c-test-library branch 6 times, most recently from b6051a2 to a137b27 Compare January 20, 2023 00:52
@badcel badcel linked an issue Jan 20, 2023 that may be closed by this pull request
@badcel badcel self-requested a review January 20, 2023 07:52
Copy link
Member

@badcel badcel left a comment

Choose a reason for hiding this comment

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

Thanks for your work, very well done. This helps a lot to establish a much improved testability of the generator it is very much appreciated.

Please fix the remaining (minor) remarks and it is good to go.

This will hopefully make it easier to have more extensive tests for correctness, which can run without a display and without requiring a lot of boilerplate code (e.g. constructing a GTK application and widgets)

Related to #504
@cameronwhite cameronwhite force-pushed the feature/c-test-library branch from a137b27 to 1f113a5 Compare January 21, 2023 19:42
@cameronwhite
Copy link
Contributor Author

Thanks! I've pushed fixes for those issues

@badcel badcel merged commit 9654296 into main Jan 21, 2023
@badcel badcel deleted the feature/c-test-library branch January 21, 2023 23:08
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.

Verify how to run system tests during CI
2 participants