Catch error, print, and continue, instead of exiting test.

Signed-off-by: Michael Hinton <[email protected]>
---
 tools/jailhouse-hardware-check | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/jailhouse-hardware-check b/tools/jailhouse-hardware-check
index 51dea82d..1c73011b 100755
--- a/tools/jailhouse-hardware-check
+++ b/tools/jailhouse-hardware-check
@@ -102,8 +102,13 @@ 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)
+        except OSError as e:
+            print(' ERROR: Failed to open /dev/mem: %s' % e)
+            return
+
         try:
             self.mmap = mmap.mmap(f, size, mmap.MAP_SHARED, mmap.PROT_READ,
                                   offset=base)
-- 
2.17.1

-- 
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