libmicrovmi icon indicating copy to clipboard operation
libmicrovmi copied to clipboard

Unit tests@xen

Open arnabcs17b006 opened this issue 5 years ago • 2 comments

arnabcs17b006 avatar Sep 01 '20 15:09 arnabcs17b006

Codecov Report

Merging #124 into master will decrease coverage by 0.03%. The diff coverage is 0.00%.

Impacted file tree graph

@@            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              
Flag Coverage Δ
#unittests 16.70% <0.00%> (-0.04%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/api.rs 0.00% <0.00%> (ø)
src/driver/kvm.rs 27.05% <0.00%> (-0.10%) :arrow_down:
src/lib.rs 0.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4196a29...812a02a. Read the comment docs.

codecov-commenter avatar Sep 01 '20 17:09 codecov-commenter

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 [email protected] wrote:

@rageagainsthepc commented on this pull request.

In src/driver/xen.rs https://github.com/Wenzel/libmicrovmi/pull/124#discussion_r481995374:

  •    )
    
  •    .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 https://github.com/Wenzel/libmicrovmi/pull/124#pullrequestreview-480724228, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALGMDC4NAGCGPUU3FPTDK4TSDYTQ5ANCNFSM4QR277GQ .

arnabcs17b006 avatar Sep 02 '20 11:09 arnabcs17b006