microsoft / microsoft/VFSForGit
Integrate assertions in kext & mock code with XCTest assertions
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.1k
- Forks
- 474
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 8
Description
Assertions in the kext unit testing environment have various problems at the moment:
-
assert()s in the kext currently don't do anything in the testable kext target. It should instead be possible to verify in a unit test that anassert()in the kext code under test failed. -
assert()s in the mock code (vnode,mount, etc.) use the platform/stdlibassertimplementation and thus crash the test runner when they fail. - The
XCTAssert*macros don't work outside instance methods of the test class. - The
XCTAssert*macros don't terminate the current test when they fail, thus making it likely that the rest of the failing test will trigger undefined behaviour (dereferencing null pointers that were asserted to be non-null, etc.) - Related: The XCTest framework really isn't designed for testing C++ code and assumes various Objective-C-isms.
The above problems have similar or highly related solutions, so it makes sense to track them under the umbrella of one issue.
Contributor guide
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
Start by examining the testable kext target and the assertion paths in the kext and mock code, including the vnode and mount mocks. Review how XCTest assertions are used outside test instance methods and determine the expected behavior when each assertion fails. Done means the listed assertion cases are handled without crashing the test runner and are verifiable from unit tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- operating-systems, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100