[Lldb-commits] [PATCH] D77452: [intel-pt] Improve the way the test determines whether to run

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 6 13:04:44 PDT 2020


wallace updated this revision to Diff 255445.
wallace edited the summary of this revision.
wallace added a comment.

See the new description of the diff for the updates


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77452

Files:
  lldb/test/API/tools/intel-features/intel-pt/test/TestIntelPTSimpleBinary.py
  lldb/utils/lldb-dotest/lldb-dotest.in


Index: lldb/utils/lldb-dotest/lldb-dotest.in
===================================================================
--- lldb/utils/lldb-dotest/lldb-dotest.in
+++ lldb/utils/lldb-dotest/lldb-dotest.in
@@ -1,6 +1,7 @@
 #!@PYTHON_EXECUTABLE@
 import subprocess
 import sys
+import os
 
 dotest_path = '@LLDB_SOURCE_DIR_CONFIGURED@/test/API/dotest.py'
 build_dir = '@LLDB_TEST_BUILD_DIRECTORY_CONFIGURED@'
@@ -11,6 +12,7 @@
 dsymutil = '@LLDB_TEST_DSYMUTIL_CONFIGURED@'
 filecheck = '@LLDB_TEST_FILECHECK_CONFIGURED@'
 lldb_libs_dir = "@LLDB_LIBS_DIR_CONFIGURED@"
+lldb_build_intel_pt = "@LLDB_BUILD_INTEL_PT@".lower()
 
 if __name__ == '__main__':
     wrapper_args = sys.argv[1:]
@@ -26,6 +28,11 @@
     cmd.extend(['--filecheck', filecheck])
     cmd.extend(['--lldb-libs-dir', lldb_libs_dir])
     cmd.extend(wrapper_args)
+
+    if lldb_build_intel_pt not in ["", "false", "off", "n", "no", "ignore"] \
+        and not lldb_build_intel_pt.endswith("-NOTFOUND"):
+        os.environ['TEST_INTEL_PT'] = "true"
+
     # Invoke dotest.py and return exit code.
     print(' '.join(cmd))
     sys.exit(subprocess.call(cmd))
Index: lldb/test/API/tools/intel-features/intel-pt/test/TestIntelPTSimpleBinary.py
===================================================================
--- lldb/test/API/tools/intel-features/intel-pt/test/TestIntelPTSimpleBinary.py
+++ lldb/test/API/tools/intel-features/intel-pt/test/TestIntelPTSimpleBinary.py
@@ -14,22 +14,21 @@
     mydir = TestBase.compute_mydir(__file__)
     NO_DEBUG_INFO_TESTCASE = True
 
+    def setUp(self):
+        TestBase.setUp(self)
+        if os.environ["TEST_INTEL_PT"] != "true":
+            self.skipTest("Intel PT not supported")
+
+        plugin_path = os.path.join(os.environ["LLDB_IMPLIB_DIR"], "liblldbIntelFeatures.so")
+        self.runCmd("plugin load " + plugin_path)
+
     @skipIf(oslist=no_match(['linux']))
     @skipIf(archs=no_match(['i386', 'x86_64']))
     @skipIfRemote
     def test_basic_flow(self):
         """Test collection, decoding, and dumping instructions"""
-        if os.environ.get('TEST_INTEL_PT') != '1':
-            self.skipTest("The environment variable TEST_INTEL_PT=1 is needed to run this test.")
-
-        lldb_exec_dir = os.environ["LLDB_IMPLIB_DIR"]
-        lldb_lib_dir = os.path.join(lldb_exec_dir, os.pardir, "lib")
-        plugin_file = os.path.join(lldb_lib_dir, "liblldbIntelFeatures.so")
 
         self.build()
-
-        self.runCmd("plugin load " + plugin_file)
-
         exe = self.getBuildArtifact("a.out")
         lldbutil.run_to_name_breakpoint(self, "main", exe_name=exe)
         # We start tracing from main
@@ -52,9 +51,9 @@
         self.expect("processor-trace show-instr-log -c 100",
             patterns=[
                 # We expect to have seen the first instruction of 'fun'
-                hex(fun_start_adddress),  
+                hex(fun_start_adddress),
                 # We expect to see the exit condition of the for loop
-                "at main.cpp:" + str(line_number('main.cpp', '// Break for loop')) 
+                "at main.cpp:" + str(line_number('main.cpp', '// Break for loop'))
             ])
 
         self.runCmd("processor-trace stop")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77452.255445.patch
Type: text/x-patch
Size: 3197 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200406/c1a40147/attachment-0001.bin>


More information about the lldb-commits mailing list