Best Python code snippet using prospector_python
lit.common.cfg.py
Source:lit.common.cfg.py
1# -*- Python -*-2# Setup source root.3config.test_source_root = os.path.join(os.path.dirname(__file__), "TestCases")4config.name = "SanitizerCommon-" + config.name_suffix5default_tool_options = []6collect_stack_traces = ""7if config.tool_name == "asan":8 tool_cflags = ["-fsanitize=address"]9 tool_options = "ASAN_OPTIONS"10elif config.tool_name == "tsan":11 tool_cflags = ["-fsanitize=thread"]12 tool_options = "TSAN_OPTIONS"13elif config.tool_name == "msan":14 tool_cflags = ["-fsanitize=memory"]15 tool_options = "MSAN_OPTIONS"16 collect_stack_traces = "-fsanitize-memory-track-origins"17elif config.tool_name == "lsan":18 tool_cflags = ["-fsanitize=leak"]19 tool_options = "LSAN_OPTIONS"20elif config.tool_name == "ubsan":21 tool_cflags = ["-fsanitize=undefined"]22 tool_options = "UBSAN_OPTIONS"23else:24 lit_config.fatal("Unknown tool for sanitizer_common tests: %r" % config.tool_name)25config.available_features.add(config.tool_name)26if config.host_os == 'Linux' and config.tool_name == "lsan" and config.target_arch == 'i386':27 config.available_features.add("lsan-x86")28if config.host_os == 'Darwin':29 # On Darwin, we default to `abort_on_error=1`, which would make tests run30 # much slower. Let's override this and run lit tests with 'abort_on_error=0'.31 default_tool_options += ['abort_on_error=0']32elif config.android:33 # The same as on Darwin, we default to "abort_on_error=1" which slows down34 # testing. Also, all existing tests are using "not" instead of "not --crash"35 # which does not work for abort()-terminated programs.36 default_tool_options += ['abort_on_error=0']37default_tool_options_str = ':'.join(default_tool_options)38if default_tool_options_str:39 config.environment[tool_options] = default_tool_options_str40 default_tool_options_str += ':'41extra_link_flags = []42if config.host_os in ['Linux']:43 extra_link_flags += ["-ldl"]44clang_cflags = config.debug_info_flags + tool_cflags + [config.target_cflags]45clang_cflags += extra_link_flags46clang_cxxflags = config.cxx_mode_flags + clang_cflags47def build_invocation(compile_flags):48 return " " + " ".join([config.clang] + compile_flags) + " "49config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )50config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )51config.substitutions.append( ("%collect_stack_traces", collect_stack_traces) )52config.substitutions.append( ("%tool_name", config.tool_name) )53config.substitutions.append( ("%tool_options", tool_options) )54config.substitutions.append( ('%env_tool_opts=',55 'env ' + tool_options + '=' + default_tool_options_str))56config.suffixes = ['.c', '.cpp']57if config.host_os not in ['Linux', 'Darwin', 'NetBSD', 'FreeBSD']:58 config.unsupported = True59if not config.parallelism_group:60 config.parallelism_group = 'shadow-memory'61if config.host_os == 'NetBSD':...
lit.common.cfg
Source:lit.common.cfg
1# -*- Python -*-2# Setup source root.3config.test_source_root = os.path.join(os.path.dirname(__file__), "TestCases")4config.name = "SanitizerCommon-" + config.name_suffix5default_tool_options = []6if config.tool_name == "asan":7 tool_cflags = ["-fsanitize=address"]8 tool_options = "ASAN_OPTIONS"9elif config.tool_name == "tsan":10 tool_cflags = ["-fsanitize=thread"]11 tool_options = "TSAN_OPTIONS"12elif config.tool_name == "msan":13 tool_cflags = ["-fsanitize=memory"]14 tool_options = "MSAN_OPTIONS"15elif config.tool_name == "lsan":16 tool_cflags = ["-fsanitize=leak"]17 tool_options = "LSAN_OPTIONS"18else:19 lit_config.fatal("Unknown tool for sanitizer_common tests: %r" % config.tool_name)20config.available_features.add(config.tool_name)21if config.target_arch not in ['arm', 'armhf', 'aarch64']:22 config.available_features.add('stable-runtime')23if config.host_os == 'Darwin':24 # On Darwin, we default to `abort_on_error=1`, which would make tests run25 # much slower. Let's override this and run lit tests with 'abort_on_error=0'.26 default_tool_options += ['abort_on_error=0']27default_tool_options_str = ':'.join(default_tool_options)28if default_tool_options_str:29 config.environment[tool_options] = default_tool_options_str30 default_tool_options_str += ':'31clang_cflags = config.debug_info_flags + tool_cflags + [config.target_cflags]32clang_cxxflags = config.cxx_mode_flags + clang_cflags33def build_invocation(compile_flags):34 return " " + " ".join([config.clang] + compile_flags) + " "35config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )36config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )37config.substitutions.append( ("%tool_name", config.tool_name) )38config.substitutions.append( ("%tool_options", tool_options) )39config.substitutions.append( ('%env_tool_opts=',40 'env ' + tool_options + '=' + default_tool_options_str))41config.suffixes = ['.c', '.cc', '.cpp']42if config.host_os not in ['Linux', 'Darwin']:...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!