def _command_from_driver_input(self, driver_input): # FIXME: performance tests pass in full URLs instead of test names. if driver_input.test_name.startswith('http://') or driver_input.test_name.startswith('https://') or driver_input.test_name == ('about:blank'): command = driver_input.test_name elif self.is_web_platform_test(driver_input.test_name) or self.is_webkit_specific_web_platform_test(driver_input.test_name) or self.is_http_test(driver_input.test_name): command = self.test_to_uri(driver_input.test_name) command += "'--absolutePath'" absPath = self._port.abspath_for_test(driver_input.test_name, self._target_host) if sys.platform == 'cygwin': absPath = path.cygpath(absPath) command += absPath else: command = self._port.abspath_for_test(driver_input.test_name, self._target_host) if sys.platform == 'cygwin': command = path.cygpath(command) assert not driver_input.image_hash or driver_input.should_run_pixel_test # ' is the separator between arguments. if self._port.supports_per_test_timeout(): command += "'--timeout'%s" % driver_input.timeout if driver_input.should_run_pixel_test: command += "'--pixel-test" if driver_input.should_dump_jsconsolelog_in_stderr: command += "'--dump-jsconsolelog-in-stderr" if driver_input.image_hash: command += "'" + driver_input.image_hash return command + "\n"
def setup_crash_log_saving(self): if '_NT_SYMBOL_PATH' not in os.environ: _log.warning( "The _NT_SYMBOL_PATH environment variable is not set. Crash logs will not be saved." ) return None ntsd_path = self._ntsd_location() if not ntsd_path: _log.warning("Can't find ntsd.exe. Crash logs will not be saved.") return None # If we used -c (instead of -cf) we could pass the commands directly on the command line. But # when the commands include multiple quoted paths (e.g., for .logopen and .srcpath), Windows # fails to invoke the post-mortem debugger at all (perhaps due to a bug in Windows's command # line parsing). So we save the commands to a file instead and tell the debugger to execute them # using -cf. command_file = self.create_debugger_command_file() if not command_file: return None debugger_options = '"{0}" -p %ld -e %ld -g -noio -lines -cf "{1}"'.format( cygpath(ntsd_path), cygpath(command_file)) registry_settings = {'Debugger': debugger_options, 'Auto': "1"} for key in registry_settings: for arch in ["--wow32", "--wow64"]: self.previous_debugger_values[( arch, "HKLM", key)] = self.read_registry_string( self.POST_MORTEM_DEBUGGER_KEY, arch, "HKLM", key) self.write_registry_string(self.POST_MORTEM_DEBUGGER_KEY, arch, "HKLM", key, registry_settings[key])
def setup_crash_log_saving(self): if "_NT_SYMBOL_PATH" not in os.environ: _log.warning("The _NT_SYMBOL_PATH environment variable is not set. Using Microsoft Symbol Server.") os.environ["_NT_SYMBOL_PATH"] = "SRV*http://msdl.microsoft.com/download/symbols" ntsd_path = self._ntsd_location() if not ntsd_path: _log.warning("Can't find ntsd.exe. Crash logs will not be saved.") return None # If we used -c (instead of -cf) we could pass the commands directly on the command line. But # when the commands include multiple quoted paths (e.g., for .logopen and .srcpath), Windows # fails to invoke the post-mortem debugger at all (perhaps due to a bug in Windows's command # line parsing). So we save the commands to a file instead and tell the debugger to execute them # using -cf. command_file = self.create_debugger_command_file() if not command_file: return None debugger_options = '"{0}" -p %ld -e %ld -g -noio -lines -cf "{1}"'.format( cygpath(ntsd_path), cygpath(command_file) ) registry_settings = {"Debugger": debugger_options, "Auto": "1"} for key in registry_settings: for arch in ["--wow32", "--wow64"]: self.previous_debugger_values[(arch, "HKLM", key)] = self.read_registry_string( self.POST_MORTEM_DEBUGGER_KEY, arch, "HKLM", key ) self.write_registry_string(self.POST_MORTEM_DEBUGGER_KEY, arch, "HKLM", key, registry_settings[key])
def create_debugger_command_file(self): debugger_temp_directory = str(self._filesystem.mkdtemp()) command_file = self._filesystem.join(debugger_temp_directory, "debugger-commands.txt") commands = ''.join(['.logopen /t "%s\\%s.txt"\n' % (cygpath(self.results_directory()), self.CRASH_LOG_PREFIX), '.srcpath "%s"\n' % cygpath(self._webkit_finder.webkit_base()), '!analyze -vv\n', '~*kpn\n', 'q\n']) self._filesystem.write_text_file(command_file, commands) return command_file
def test_stop_cygpath_subprocess(self): if sys.platform != 'cygwin': return # Call cygpath to ensure the subprocess is running. path.cygpath("/cygdrive/c/foo.txt") self.assertTrue(path._CygPath._singleton.is_running()) # Stop it. path._CygPath.stop_cygpath_subprocess() # Ensure that it is stopped. self.assertFalse(path._CygPath._singleton.is_running())
def _command_from_driver_input(self, driver_input): # FIXME: performance tests pass in full URLs instead of test names. if driver_input.test_name.startswith('http://') or driver_input.test_name.startswith('https://') or driver_input.test_name == ('about:blank'): command = driver_input.test_name elif self.is_web_platform_test(driver_input.test_name) or (self.is_http_test(driver_input.test_name) and (self._port.get_option('webkit_test_runner') or sys.platform == "cygwin")): command = self.test_to_uri(driver_input.test_name) command += "'--absolutePath'" command += self._port.abspath_for_test(driver_input.test_name) else: command = self._port.abspath_for_test(driver_input.test_name) if sys.platform == 'cygwin': command = path.cygpath(command) assert not driver_input.image_hash or driver_input.should_run_pixel_test # ' is the separator between arguments. if self._port.supports_per_test_timeout(): command += "'--timeout'%s" % driver_input.timeout if driver_input.should_run_pixel_test: command += "'--pixel-test" if driver_input.should_dump_jsconsolelog_in_stderr: command += "'--dump-jsconsolelog-in-stderr" if driver_input.image_hash: command += "'" + driver_input.image_hash return command + "\n"
def _setup_environ_for_driver(self, environment): build_root_path = str(self._port._build_path()) self._append_environment_variable_path(environment, 'DYLD_LIBRARY_PATH', build_root_path) self._append_environment_variable_path(environment, '__XPC_DYLD_LIBRARY_PATH', build_root_path) self._append_environment_variable_path(environment, 'DYLD_FRAMEWORK_PATH', build_root_path) self._append_environment_variable_path(environment, '__XPC_DYLD_FRAMEWORK_PATH', build_root_path) # Use an isolated temp directory that can be deleted after testing (especially important on Mac, as # CoreMedia disk cache is in the temp directory). environment['TMPDIR'] = str(self._driver_tempdir) environment['DIRHELPER_USER_DIR_SUFFIX'] = self._driver_user_directory_suffix # Put certain normally persistent files into the temp directory (e.g. IndexedDB storage). if sys.platform == 'cygwin': environment['DUMPRENDERTREE_TEMP'] = path.cygpath(str(self._driver_tempdir)) else: environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir) environment['LOCAL_RESOURCE_ROOT'] = str(self._port.layout_tests_dir()) environment['ASAN_OPTIONS'] = "allocator_may_return_null=1" environment['__XPC_ASAN_OPTIONS'] = environment['ASAN_OPTIONS'] # Disable vnode-guard related simulated crashes for WKTR / DRT (rdar://problem/40674034). environment['SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS'] = os.path.realpath(environment['DUMPRENDERTREE_TEMP']) environment['__XPC_SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS'] = environment['SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS'] if self._profiler: environment = self._profiler.adjusted_environment(environment) return environment
def _setup_environ_for_driver(self, environment): build_root_path = str(self._port._build_path()) self._append_environment_variable_path(environment, 'DYLD_LIBRARY_PATH', build_root_path) self._append_environment_variable_path(environment, '__XPC_DYLD_LIBRARY_PATH', build_root_path) self._append_environment_variable_path(environment, 'DYLD_FRAMEWORK_PATH', build_root_path) self._append_environment_variable_path(environment, '__XPC_DYLD_FRAMEWORK_PATH', build_root_path) # Use an isolated temp directory that can be deleted after testing (especially important on Mac, as # CoreMedia disk cache is in the temp directory). environment['TMPDIR'] = str(self._driver_tempdir) environment[ 'DIRHELPER_USER_DIR_SUFFIX'] = self._driver_user_directory_suffix # Put certain normally persistent files into the temp directory (e.g. IndexedDB storage). if sys.platform == 'cygwin': environment['DUMPRENDERTREE_TEMP'] = path.cygpath( str(self._driver_tempdir)) else: environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir) environment['LOCAL_RESOURCE_ROOT'] = str(self._port.layout_tests_dir()) environment['ASAN_OPTIONS'] = "allocator_may_return_null=1" environment['__XPC_ASAN_OPTIONS'] = environment['ASAN_OPTIONS'] if 'WEBKIT_OUTPUTDIR' in os.environ: environment['WEBKIT_OUTPUTDIR'] = os.environ['WEBKIT_OUTPUTDIR'] if self._profiler: environment = self._profiler.adjusted_environment(environment) return environment
def _command_from_driver_input(self, driver_input): # FIXME: performance tests pass in full URLs instead of test names. if ( driver_input.test_name.startswith("http://") or driver_input.test_name.startswith("https://") or driver_input.test_name == ("about:blank") ): command = driver_input.test_name elif self.is_http_test(driver_input.test_name): command = self.test_to_uri(driver_input.test_name) else: command = self._port.abspath_for_test(driver_input.test_name) if sys.platform == "cygwin": command = path.cygpath(command) assert not driver_input.image_hash or driver_input.should_run_pixel_test # ' is the separator between arguments. if self._port.supports_per_test_timeout(): command += "'--timeout'%s" % driver_input.timeout if driver_input.should_run_pixel_test: command += "'--pixel-test" if driver_input.image_hash: command += "'" + driver_input.image_hash return command + "\n"
def _command_from_driver_input(self, driver_input): # FIXME: performance tests pass in full URLs instead of test names. if driver_input.test_name.startswith( 'http://') or driver_input.test_name.startswith( 'https://') or driver_input.test_name == ('about:blank'): command = driver_input.test_name elif self.is_http_test( driver_input.test_name) or self.is_web_platform_test( driver_input.test_name): command = self.test_to_uri(driver_input.test_name) else: command = self._port.abspath_for_test(driver_input.test_name) if sys.platform == 'cygwin': command = path.cygpath(command) assert not driver_input.image_hash or driver_input.should_run_pixel_test # ' is the separator between arguments. if self._port.supports_per_test_timeout(): command += "'--timeout'%s" % driver_input.timeout if driver_input.should_run_pixel_test: command += "'--pixel-test" if driver_input.image_hash: command += "'" + driver_input.image_hash return command + "\n"
def setup_crash_log_saving(self): if '_NT_SYMBOL_PATH' not in os.environ: _log.warning("The _NT_SYMBOL_PATH environment variable is not set. Using Microsoft Symbol Server.") os.environ['_NT_SYMBOL_PATH'] = 'SRV*http://msdl.microsoft.com/download/symbols' # Add build path to symbol path os.environ['_NT_SYMBOL_PATH'] += ";" + self._build_path() ntsd_path = self._ntsd_location() if not ntsd_path: _log.warning("Can't find ntsd.exe. Crash logs will not be saved.") return None # If we used -c (instead of -cf) we could pass the commands directly on the command line. But # when the commands include multiple quoted paths (e.g., for .logopen and .srcpath), Windows # fails to invoke the post-mortem debugger at all (perhaps due to a bug in Windows's command # line parsing). So we save the commands to a file instead and tell the debugger to execute them # using -cf. command_file = self.create_debugger_command_file() if not command_file: return None debugger_options = '"{0}" -p %ld -e %ld -g -noio -lines -cf "{1}"'.format(cygpath(ntsd_path), cygpath(command_file)) registry_settings = {'Debugger': [debugger_options, self._REG_SZ], 'Auto': ["1", self._REG_SZ]} for key, value in registry_settings.iteritems(): for arch in ["--wow32", "--wow64"]: self.previous_debugger_values[(arch, self._HKLM, key)] = self.read_registry_value(self.POST_MORTEM_DEBUGGER_KEY, arch, self._HKLM, key) self.previous_wow64_debugger_values[(arch, self._HKLM, key)] = self.read_registry_value(self.WOW64_POST_MORTEM_DEBUGGER_KEY, arch, self._HKLM, key) self.write_registry_value(self.POST_MORTEM_DEBUGGER_KEY, arch, self._HKLM, key, value[1], value[0]) self.write_registry_value(self.WOW64_POST_MORTEM_DEBUGGER_KEY, arch, self._HKLM, key, value[1], value[0])
def results_directory(self): """Absolute path to the place to store the test results (uses --results-directory).""" if not self._results_directory: option_val = self.get_option('results_directory') or self.default_results_directory() self._results_directory = self._filesystem.abspath(option_val) if sys.platform == 'cygwin': self._results_directory = cygpath(self._results_directory) self._abs_results_directory = self._filesystem.abspath(option_val) return self._results_directory
def _setup_environ_for_driver(self, environment): self._port._clear_global_caches_and_temporary_files() self._create_temporal_directories() build_root_path = str(self._port._build_path()) self._append_environment_variable_path(environment, 'DYLD_LIBRARY_PATH', build_root_path) self._append_environment_variable_path(environment, '__XPC_DYLD_LIBRARY_PATH', build_root_path) self._append_environment_variable_path(environment, 'DYLD_FRAMEWORK_PATH', build_root_path) self._append_environment_variable_path(environment, '__XPC_DYLD_FRAMEWORK_PATH', build_root_path) # Use an isolated temp directory that can be deleted after testing (especially important on Mac, as # CoreMedia disk cache is in the temp directory). environment['TMPDIR'] = str(self._driver_tempdir) environment[ 'DIRHELPER_USER_DIR_SUFFIX'] = self._driver_user_directory_suffix # Put certain normally persistent files into the temp directory (e.g. IndexedDB storage). if sys.platform == 'cygwin': environment['DUMPRENDERTREE_TEMP'] = path.cygpath( str(self._driver_tempdir)) else: environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir) environment['LOCAL_RESOURCE_ROOT'] = str(self._port.layout_tests_dir()) environment['ASAN_OPTIONS'] = "allocator_may_return_null=1" environment['__XPC_ASAN_OPTIONS'] = environment['ASAN_OPTIONS'] # Disable vnode-guard related simulated crashes for WKTR / DRT (rdar://problem/40674034). environment['SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS'] = os.path.realpath( environment['DUMPRENDERTREE_TEMP']) environment[ '__XPC_SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS'] = environment[ 'SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS'] environment['JSC_useKernTCSM'] = 'false' environment['__XPC_JSC_useKernTCSM'] = environment['JSC_useKernTCSM'] if sys.platform.startswith('linux'): # Currently on WebKit2, there is no API for setting the application cache directory. # Each worker should have it's own and it should be cleaned afterwards. # Set it to inside the temporary folder by prepending XDG_CACHE_HOME with DRIVER_TEMPDIR. environment['XDG_CACHE_HOME'] = self._port.host.filesystem.join( str(self._driver_tempdir), 'appcache') # Use an empty/volatile home inside DRIVER_TEMPDIR to ensure that the test results # are not affected by the user settings of any library. environment['HOME'] = self._port.host.filesystem.join( str(self._driver_tempdir), 'home') self._target_host.filesystem.maybe_make_directory( environment['HOME']) if self._profiler: environment = self._profiler.adjusted_environment(environment) return environment
def _command_from_driver_input(self, driver_input): if self.is_http_test(driver_input.test_name): command = self.test_to_uri(driver_input.test_name) else: command = self._port.abspath_for_test(driver_input.test_name) if sys.platform == 'cygwin': command = cygpath(command) if driver_input.image_hash: # FIXME: Why the leading quote? command += "'" + driver_input.image_hash return command + "\n"
def _command_from_driver_input(self, driver_input): # FIXME: performance tests pass in full URLs instead of test names. if driver_input.test_name.startswith('http://') or driver_input.test_name.startswith('https://') or driver_input.test_name == ('about:blank'): command = driver_input.test_name elif self.is_http_test(driver_input.test_name): command = self.test_to_uri(driver_input.test_name) else: command = self._port.abspath_for_test(driver_input.test_name) if sys.platform == 'cygwin': command = cygpath(command) if driver_input.image_hash: # FIXME: Why the leading quote? command += "'" + driver_input.image_hash return command + "\n"
def _command_from_driver_input(self, driver_input): # FIXME: performance tests pass in full URLs instead of test names. if driver_input.test_name.startswith( 'http://') or driver_input.test_name.startswith('https://'): command = driver_input.test_name elif self.is_http_test(driver_input.test_name): command = self.test_to_uri(driver_input.test_name) else: command = self._port.abspath_for_test(driver_input.test_name) if sys.platform == 'cygwin': command = cygpath(command) if driver_input.image_hash: # FIXME: Why the leading quote? command += "'" + driver_input.image_hash return command + "\n"
def setup_crash_log_saving(self): if '_NT_SYMBOL_PATH' not in os.environ: _log.warning("The _NT_SYMBOL_PATH environment variable is not set. Crash logs will not be saved.") return None ntsd_path = self._ntsd_location() if not ntsd_path: _log.warning("Can't find ntsd.exe. Crash logs will not be saved.") return None # If we used -c (instead of -cf) we could pass the commands directly on the command line. But # when the commands include multiple quoted paths (e.g., for .logopen and .srcpath), Windows # fails to invoke the post-mortem debugger at all (perhaps due to a bug in Windows's command # line parsing). So we save the commands to a file instead and tell the debugger to execute them # using -cf. command_file = self.create_debugger_command_file() if not command_file: return None debugger_options = '"{0}" -p %ld -e %ld -g -noio -lines -cf "{1}"'.format(cygpath(ntsd_path), cygpath(command_file)) registry_settings = {'Debugger': debugger_options, 'Auto': "1"} for key in registry_settings: self.previous_debugger_values[key] = self.read_registry_string(key) self.write_registry_string(key, registry_settings[key])
def _command_from_driver_input(self, driver_input): # FIXME: performance tests pass in full URLs instead of test names. if driver_input.test_name.startswith( 'http://') or driver_input.test_name.startswith( 'https://') or driver_input.test_name == ('about:blank'): command = driver_input.test_name elif self.is_http_test(driver_input.test_name): command = self.test_to_uri(driver_input.test_name) else: command = self._port.abspath_for_test(driver_input.test_name) if sys.platform == 'cygwin': command = path.cygpath(command) assert not driver_input.image_hash or driver_input.should_run_pixel_test if driver_input.should_run_pixel_test: if self._port.supports_switching_pixel_tests_per_test(): # We did not start the driver with --pixel-tests, instead we specify it per test. # "'" is the separator of command fields. command += "'" + '--pixel-test' if driver_input.image_hash: command += "'" + driver_input.image_hash return command + "\n"
def _setup_environ_for_driver(self, environment): build_root_path = str(self._port._build_path()) # FIXME: DYLD_* variables should be Mac-only. Even iOS Simulator doesn't need them, as LayoutTestRelay is a host binary. self._append_environment_variable_path(environment, 'DYLD_LIBRARY_PATH', build_root_path) self._append_environment_variable_path(environment, '__XPC_DYLD_LIBRARY_PATH', build_root_path) self._append_environment_variable_path(environment, 'DYLD_FRAMEWORK_PATH', build_root_path) self._append_environment_variable_path(environment, '__XPC_DYLD_FRAMEWORK_PATH', build_root_path) # Use an isolated temp directory that can be deleted after testing (especially important on Mac, as # CoreMedia disk cache is in the temp directory). environment['TMPDIR'] = str(self._driver_tempdir) environment['DIRHELPER_USER_DIR_SUFFIX'] = self._driver_user_directory_suffix # Put certain normally persistent files into the temp directory (e.g. IndexedDB storage). if sys.platform == 'cygwin': environment['DUMPRENDERTREE_TEMP'] = path.cygpath(str(self._driver_tempdir)) else: environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir) environment['LOCAL_RESOURCE_ROOT'] = str(self._port.layout_tests_dir()) environment['ASAN_OPTIONS'] = "allocator_may_return_null=1" environment['__XPC_ASAN_OPTIONS'] = environment['ASAN_OPTIONS'] if 'WEBKIT_OUTPUTDIR' in os.environ: environment['WEBKIT_OUTPUTDIR'] = os.environ['WEBKIT_OUTPUTDIR'] if self._profiler: environment = self._profiler.adjusted_environment(environment) return environment
def _driver_tempdir_for_environment(self): return cygpath(self._driver_tempdir())
def _convert_path(self, path): """Handles filename conversion for subprocess command line args.""" # See note above in diff_image() for why we need this. if sys.platform == "cygwin": return cygpath(path) return path
def _convert_path(self, path): """Handles filename conversion for subprocess command line args.""" # See note above in diff_image() for why we need this. if sys.platform == 'cygwin': return cygpath(path) return path