-
Notifications
You must be signed in to change notification settings - Fork 14
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
Unit tests@xen #124
base: master
Are you sure you want to change the base?
Unit tests@xen #124
Conversation
d42a7f7
to
fc71313
Compare
Codecov Report
@@ Coverage Diff @@
## master #124 +/- ##
==========================================
- Coverage 16.73% 16.70% -0.04%
==========================================
Files 5 5
Lines 472 473 +1
Branches 65 70 +5
==========================================
Hits 79 79
- Misses 382 383 +1
Partials 11 11
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
src/driver/xen.rs
Outdated
let mut xenevtchn_mock = MockXenEventChannel::default(); | ||
let mut xenforeignmemory_mock = MockXenForeignMem::default(); | ||
let mut xenstore_mock = MockXs::default(); | ||
let error: Box<dyn std::error::Error + std::marker::Sync + std::marker::Send + 'static> = Box::new(std::error::Error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are trying to create an object of a trait here. That's not possible.
How to create a failure::Error object? I need to return it in one of my
expected mock functions
…On Wed, Sep 2, 2020, 16:55 Dorian Eikenberg ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/driver/xen.rs
<#124 (comment)>:
> + )
+ .expect("Failed to create driver");
+ let paddr = 0;
+
+ let result = xen.set_page_access(paddr, Access::R);
+
+ assert!(result.is_err(), "Expected error, got ok instead");
+ }
+
+ /*#[test]
+ fn test_fail_to_create_xen_driver_if_xenforeignmemory_init_returns_error() {
+ let mut xencontrol_mock = MockXenControl::default();
+ let mut xenevtchn_mock = MockXenEventChannel::default();
+ let mut xenforeignmemory_mock = MockXenForeignMem::default();
+ let mut xenstore_mock = MockXs::default();
+ let error: Box<dyn std::error::Error + std::marker::Sync + std::marker::Send + 'static> = Box::new(std::error::Error);
You are trying to create an object of a trait here. That's not possible.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#124 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALGMDC4NAGCGPUU3FPTDK4TSDYTQ5ANCNFSM4QR277GQ>
.
|
c19d528
to
c89ed33
Compare
No description provided.