KhronosGroup / KhronosGroup/OpenCL-ICD-Loader
Improved Unit Testing Feedback
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 304
- Forks
- 172
- Avg merge
- 11h 30m
- Merged PRs (30d)
- 1
Description
I've been experimenting with alternate ways to test the OpenCL ICD loader, with the following goals in mind:
- Use a modern unit testing framework.
- Test as much as possible without needing to manually setup a stub ICD.
- Automatically generate as much test content as possible.
I have something working and I'm looking for feedback before proceeding further, mostly because there is still some manual work needed to setup each test, and I won't spend the time doing this if it looks like things aren't moving in the right direction.
Some details:
-
My work is staged here:
https://github.com/bashbaug/OpenCL-ICD-Loader/tree/improved-testing
Most of the new code is currently in the "test_new" directory. I can create a WIP pull request if that is easier for review.
-
I'm using Googletest for now, which I am most familiar with, but I can switch to a different testing framework if desired.
-
I've managed to generate almost all of the "recorder" ICD, which I use for testing. The "recorder" ICD simply records each of the arguments it received in memory before returning. The test code can then ensure that the arguments that were recorded match the arguments that it passed. This is very similar to the existing "stub" ICD, except it records the arguments in memory rather than in a file.
-
I've managed to generate a "template" to simplify test development for each API, but some parts of the template still need to be filled in manually. If anyone has ideas to completely generate each test I'd love to hear them!
-
Things this won't test: any of the ICD discovery code, such as the code to scan the registry or /etc/OpenCL/vendors.
What I'm looking for:
-
Is this helpful? Should I keep going?
-
Are there any suggested tweaks to the test "template" before I start adding the remaining APIs?
Aside: I think we should be able to automatically generate a bunch of the ICD loader code itself, similar to the way I've generated the recorder ICD and test template. I plan to look at this at some point in the near future, but if someone else wants to take a look at it first, the gen_tester.py script could be a helpful place to start from.
Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the improved-testing branch, especially the test_new directory, to understand the proposed Googletest setup, recorder ICD, and generated test templates. Read gen_tester.py and the existing stub ICD tests before deciding whether to continue the approach. Done would mean an agreed testing direction and a defined path for covering the remaining APIs without manual ICD discovery setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100