Skip to content

Conversation

@ivila
Copy link
Contributor

@ivila ivila commented Jan 6, 2026

There are several changes in this PR:

  1. Add a mock feature to optee-utee-sys, following the mockall FFI example.
  2. Use the optee-utee-sys mock feature for unit testing in optee-utee.
  3. Remove the optee-utee-mock crate.
  4. Some minor changes, including fixing compiler warnings and formatting files.

closes #218

@ivila ivila added enhancement New feature or request refactor labels Jan 6, 2026
@ivila ivila requested a review from DemesneGH January 6, 2026 08:44
@ivila ivila merged commit fac9759 into apache:main Jan 7, 2026
12 checks passed
@DemesneGH
Copy link
Contributor

@ivila Sorry for missing your message, a bit busy these days...

The PR looks good for me, and the reorganization of mock features makes a lot of sense. Thanks for the effort!

I've tested it locally with optee-utee's object tests:

$ cargo test --package optee-utee --lib -- object::persistent_object::tests --nocapture
...
running 4 tests
test object::persistent_object::tests::test_create_and_drop ... ok
test object::persistent_object::tests::test_create_and_failed_close_delete ... ok
test object::persistent_object::tests::test_create_and_successfully_close_delete ... ok
test object::persistent_object::tests::test_create_failed ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 10 filtered out; finished in 0.00s

Two more considerations:

  • Could you please add a simple doc in docs/ regarding the mock's background and usage, like "OP-TEE Modules Unit Testing with Mocks"? Having a reference would be very helpful for other contributors who are willing to develop the optee modules.
  • Consider adding this unit test into our CI jobs?

@ivila
Copy link
Contributor Author

ivila commented Jan 7, 2026

@ivila Sorry for missing your message, a bit busy these days...

The PR looks good for me, and the reorganization of mock features makes a lot of sense. Thanks for the effort!

I've tested it locally with optee-utee's object tests:

$ cargo test --package optee-utee --lib -- object::persistent_object::tests --nocapture
...
running 4 tests
test object::persistent_object::tests::test_create_and_drop ... ok
test object::persistent_object::tests::test_create_and_failed_close_delete ... ok
test object::persistent_object::tests::test_create_and_successfully_close_delete ... ok
test object::persistent_object::tests::test_create_failed ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 10 filtered out; finished in 0.00s

Two more considerations:

  • Could you please add a simple doc in docs/ regarding the mock's background and usage, like "OP-TEE Modules Unit Testing with Mocks"? Having a reference would be very helpful for other contributors who are willing to develop the optee modules.
  • Consider adding this unit test into our CI jobs?

Could you please add a simple doc

Yes, will do

Consider adding this unit test into our CI jobs

Sorry for my previous response, we have already added this into the CI jobs:

(cd optee-utee && cargo test --features no_panic_handler -vv)

@DemesneGH
Copy link
Contributor

Sorry for my previous response, we have already added this into the CI jobs:

Ah I see, thanks!

@ivila ivila deleted the opt_cmock_zc_1229 branch January 9, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TODO] Use optee-utee-mock in unit testing of LoadablePlugin

2 participants