This revision was automatically updated to reflect the committed changes.
Closed by commit rGf8f4d8f87ba4: [lldb] Improve CPUInfo test predicate 
(authored by DavidSpickett).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99729/new/

https://reviews.llvm.org/D99729

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1274,7 +1274,7 @@
 
         # TODO other platforms, please implement this function
         if not re.match(".*-.*-linux", triple):
-            return False
+            return ""
 
         # Need to do something different for non-Linux/Android targets
         cpuinfo_path = self.getBuildArtifact("cpuinfo")
@@ -1284,11 +1284,10 @@
             cpuinfo_path = "/proc/cpuinfo"
 
         try:
-            f = open(cpuinfo_path, 'r')
-            cpuinfo = f.read()
-            f.close()
+            with open(cpuinfo_path, 'r') as f:
+                cpuinfo = f.read()
         except:
-            return False
+            return ""
 
         return cpuinfo
 


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1274,7 +1274,7 @@
 
         # TODO other platforms, please implement this function
         if not re.match(".*-.*-linux", triple):
-            return False
+            return ""
 
         # Need to do something different for non-Linux/Android targets
         cpuinfo_path = self.getBuildArtifact("cpuinfo")
@@ -1284,11 +1284,10 @@
             cpuinfo_path = "/proc/cpuinfo"
 
         try:
-            f = open(cpuinfo_path, 'r')
-            cpuinfo = f.read()
-            f.close()
+            with open(cpuinfo_path, 'r') as f:
+                cpuinfo = f.read()
         except:
-            return False
+            return ""
 
         return cpuinfo
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] D99... David Spickett via Phabricator via lldb-commits
    • [Lldb-commits] [PATCH... David Spickett via Phabricator via lldb-commits

Reply via email to