hardware check: Catch errors opening /dev/mem during MMIO check
    
    Catch error, print, and continue, instead of exiting test.
    
    Signed-off-by: Michael Hinton <[email protected]>

diff --git a/tools/jailhouse-hardware-check b/tools/jailhouse-hardware-check
index 51dea82d..517175c5 100755
--- a/tools/jailhouse-hardware-check
+++ b/tools/jailhouse-hardware-check
@@ -102,15 +102,17 @@ class MSR:
 
 class MMIO:
     def __init__(self, base, size):
-        f = os.open('/dev/mem', os.O_RDONLY | os.O_SYNC)
         self.mmap = None
         try:
+            f = os.open('/dev/mem', os.O_RDONLY | os.O_SYNC)
             self.mmap = mmap.mmap(f, size, mmap.MAP_SHARED, mmap.PROT_READ,
                                   offset=base)
         except PermissionError:
             pass
         except mmap.error:
             pass
+        except OSError as e:
+            print(' ERROR: %s' % e)
 
     def read64(self, offset):
         if self.mmap is None:

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to