forked from OSchip/llvm-project
				
			Another attempt of D77452 - da0e91fee6
				
					
				
			[intel-pt] Improve the way the test determines whether to run - Now I'm creating a default value for the new test parameter - I fixed a small mistake in the skipping logic of the test ... I forgot to clear the cmake cache when testing my diff
This commit is contained in:
		
							parent
							
								
									4f37450b2c
								
							
						
					
					
						commit
						acfee72a05
					
				| 
						 | 
				
			
			@ -137,6 +137,9 @@ all_tests = set()
 | 
			
		|||
# LLDB library directory.
 | 
			
		||||
lldb_libs_dir = None
 | 
			
		||||
 | 
			
		||||
# A plugin whose tests will be enabled, like intel-pt.
 | 
			
		||||
enabled_plugins = []
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def shouldSkipBecauseOfCategories(test_categories):
 | 
			
		||||
    if use_categories:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -467,6 +467,9 @@ def parseOptionsAndInitTestdirs():
 | 
			
		|||
    if args.lldb_libs_dir:
 | 
			
		||||
        configuration.lldb_libs_dir = args.lldb_libs_dir
 | 
			
		||||
 | 
			
		||||
    if args.enabled_plugins:
 | 
			
		||||
        configuration.enabled_plugins = args.enabled_plugins
 | 
			
		||||
 | 
			
		||||
    # Gather all the dirs passed on the command line.
 | 
			
		||||
    if len(args.args) > 0:
 | 
			
		||||
        configuration.testdirs = [os.path.realpath(os.path.abspath(x)) for x in args.args]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -177,6 +177,13 @@ def create_parser():
 | 
			
		|||
        dest='lldb_libs_dir',
 | 
			
		||||
        metavar='path',
 | 
			
		||||
        help='The path to LLDB library directory (containing liblldb)')
 | 
			
		||||
    group.add_argument(
 | 
			
		||||
        '--enable-plugin',
 | 
			
		||||
        dest='enabled_plugins',
 | 
			
		||||
        action='append',
 | 
			
		||||
        type=str,
 | 
			
		||||
        metavar='A plugin whose tests will be enabled',
 | 
			
		||||
        help='A plugin whose tests will be enabled. The only currently supported plugin is intel-pt.')
 | 
			
		||||
 | 
			
		||||
    # Configuration options
 | 
			
		||||
    group = parser.add_argument_group('Remote platform options')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -127,6 +127,10 @@ if config.filecheck:
 | 
			
		|||
if config.lldb_libs_dir:
 | 
			
		||||
  dotest_cmd += ['--lldb-libs-dir', config.lldb_libs_dir]
 | 
			
		||||
 | 
			
		||||
if config.enabled_plugins:
 | 
			
		||||
  for plugin in config.enabled_plugins:
 | 
			
		||||
    dotest_cmd += ['--enable-plugin', plugin]
 | 
			
		||||
 | 
			
		||||
# We don't want to force users passing arguments to lit to use `;` as a
 | 
			
		||||
# separator. We use Python's simple lexical analyzer to turn the args into a
 | 
			
		||||
# list. Pass there arguments last so they can override anything that was
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,6 +23,7 @@ config.dotest_path = "@LLDB_SOURCE_DIR@/test/API/dotest.py"
 | 
			
		|||
config.dotest_args_str = "@LLDB_DOTEST_ARGS@"
 | 
			
		||||
config.lldb_enable_python = @LLDB_ENABLE_PYTHON@
 | 
			
		||||
config.dotest_lit_args_str = None
 | 
			
		||||
config.enabled_plugins = []
 | 
			
		||||
config.lldb_executable = '@LLDB_TEST_EXECUTABLE@'
 | 
			
		||||
config.test_arch = '@LLDB_TEST_ARCH@'
 | 
			
		||||
config.test_compiler = '@LLDB_TEST_COMPILER@'
 | 
			
		||||
| 
						 | 
				
			
			@ -32,6 +33,11 @@ config.filecheck = '@LLDB_TEST_FILECHECK@'
 | 
			
		|||
config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-api")
 | 
			
		||||
config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-api")
 | 
			
		||||
 | 
			
		||||
# Plugins
 | 
			
		||||
lldb_build_intel_pt = '@LLDB_BUILD_INTEL_PT@'
 | 
			
		||||
if lldb_build_intel_pt == '1':
 | 
			
		||||
    config.enabled_plugins.append('intel-pt')
 | 
			
		||||
 | 
			
		||||
# Additional dotest arguments can be passed to lit by providing a
 | 
			
		||||
# semicolon-separates list: --param dotest-args="arg;arg".
 | 
			
		||||
dotest_lit_args_str = lit_config.params.get('dotest-args', None)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@ import time
 | 
			
		|||
from lldbsuite.test.decorators import *
 | 
			
		||||
from lldbsuite.test.lldbtest import *
 | 
			
		||||
from lldbsuite.test import lldbutil
 | 
			
		||||
from lldbsuite.test import configuration
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TestIntelPTSimpleBinary(TestBase):
 | 
			
		||||
| 
						 | 
				
			
			@ -14,22 +15,22 @@ class TestIntelPTSimpleBinary(TestBase):
 | 
			
		|||
    mydir = TestBase.compute_mydir(__file__)
 | 
			
		||||
    NO_DEBUG_INFO_TESTCASE = True
 | 
			
		||||
 | 
			
		||||
    def setUp(self):
 | 
			
		||||
        TestBase.setUp(self)
 | 
			
		||||
 | 
			
		||||
        if 'intel-pt' not in configuration.enabled_plugins:
 | 
			
		||||
            self.skipTest("The intel-pt test plugin is not enabled")
 | 
			
		||||
 | 
			
		||||
        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 +53,9 @@ class TestIntelPTSimpleBinary(TestBase):
 | 
			
		|||
        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")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -158,6 +158,7 @@ endif()
 | 
			
		|||
 | 
			
		||||
# These values are not canonicalized within LLVM.
 | 
			
		||||
llvm_canonicalize_cmake_booleans(
 | 
			
		||||
  LLDB_BUILD_INTEL_PT
 | 
			
		||||
  LLDB_ENABLE_PYTHON
 | 
			
		||||
  LLDB_ENABLE_LUA
 | 
			
		||||
  LLDB_ENABLE_LZMA
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,10 @@ set_target_properties(lldb-dotest PROPERTIES FOLDER "lldb utils")
 | 
			
		|||
get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
 | 
			
		||||
set(LLDB_LIBS_DIR "${LLVM_LIBRARY_OUTPUT_INTDIR}")
 | 
			
		||||
 | 
			
		||||
llvm_canonicalize_cmake_booleans(
 | 
			
		||||
  LLDB_BUILD_INTEL_PT
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
# Generate lldb-dotest Python driver script for each build mode.
 | 
			
		||||
if(LLDB_BUILT_STANDALONE)
 | 
			
		||||
  set(config_types ".")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@ compiler = '@LLDB_TEST_COMPILER_CONFIGURED@'
 | 
			
		|||
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@"
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    wrapper_args = sys.argv[1:]
 | 
			
		||||
| 
						 | 
				
			
			@ -25,6 +26,8 @@ if __name__ == '__main__':
 | 
			
		|||
    cmd.extend(['--dsymutil', dsymutil])
 | 
			
		||||
    cmd.extend(['--filecheck', filecheck])
 | 
			
		||||
    cmd.extend(['--lldb-libs-dir', lldb_libs_dir])
 | 
			
		||||
    if lldb_build_intel_pt == "1":
 | 
			
		||||
        cmd.extend(['--enable-plugin', 'intel-pt'])
 | 
			
		||||
    cmd.extend(wrapper_args)
 | 
			
		||||
    # Invoke dotest.py and return exit code.
 | 
			
		||||
    print(' '.join(cmd))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue