def setUp(self): super(RunIsolatedTest, self).setUp() self.tempdir = run_isolated.make_temp_dir(u'run_isolated_smoke_test', ROOT_DIR) logging.debug(self.tempdir) # The run_isolated local cache. self._isolated_cache_dir = os.path.join(self.tempdir, 'i') self._isolated_server = isolateserver_fake.FakeIsolateServer() self._named_cache_dir = os.path.join(self.tempdir, 'n')
def setUp(self): super(RunIsolatedTest, self).setUp() self.tempdir = run_isolated.make_temp_dir(u'run_isolated_smoke_test', ROOT_DIR) logging.debug(self.tempdir) # run_isolated.zip executable package. self.run_isolated_zip = os.path.join(self.tempdir, 'run_isolated.zip') run_isolated.get_as_zip_package().zip_into_file(self.run_isolated_zip, compress=False) # The run_isolated local cache. self.cache = os.path.join(self.tempdir, 'cache') self.server = isolateserver_mock.MockIsolateServer()
def setUp(self): super(RunIsolatedTest, self).setUp() self.tempdir = run_isolated.make_temp_dir( u'run_isolated_smoke_test', ROOT_DIR) logging.debug(self.tempdir) # run_isolated.zip executable package. self.run_isolated_zip = os.path.join(self.tempdir, 'run_isolated.zip') run_isolated.get_as_zip_package().zip_into_file( self.run_isolated_zip, compress=False) # The run_isolated local cache. self.cache = os.path.join(self.tempdir, 'cache') self.server = isolateserver_mock.MockIsolateServer()
def setUp(self): self.tempdir = run_isolated.make_temp_dir( 'run_isolated_smoke_test', ROOT_DIR) logging.debug(self.tempdir) # run_isolated.zip executable package. self.run_isolated_zip = os.path.join(self.tempdir, 'run_isolated.zip') run_isolated.get_as_zip_package().zip_into_file( self.run_isolated_zip, compress=False) # The "source" hash table. self.table = os.path.join(self.tempdir, 'table') os.mkdir(self.table) # The slave-side cache. self.cache = os.path.join(self.tempdir, 'cache') self.data_dir = os.path.join(ROOT_DIR, 'tests', 'run_isolated')
def setUp(self): self.tempdir = run_isolated.make_temp_dir('run_isolated_smoke_test', ROOT_DIR) logging.debug(self.tempdir) # run_isolated.zip executable package. self.run_isolated_zip = os.path.join(self.tempdir, 'run_isolated.zip') run_isolated.get_as_zip_package().zip_into_file(self.run_isolated_zip, compress=False) # The "source" hash table. self.table = os.path.join(self.tempdir, 'table') os.mkdir(self.table) # The slave-side cache. self.cache = os.path.join(self.tempdir, 'cache') self.data_dir = os.path.join(ROOT_DIR, 'tests', 'run_isolated')
def CMDrun(parser, args): """Runs the test executable in an isolated (temporary) directory. All the dependencies are mapped into the temporary directory and the directory is cleaned up after the target exits. Argument processing stops at -- and these arguments are appended to the command line of the target to run. For example, use: isolate.py run --isolated foo.isolated -- --gtest_filter=Foo.Bar """ add_isolate_options(parser) add_skip_refresh_option(parser) options, args = parser.parse_args(args) process_isolate_options(parser, options, require_isolated=False) complete_state = load_complete_state(options, os.getcwd(), None, options.skip_refresh) cmd = complete_state.saved_state.command + args if not cmd: raise ExecutionError("No command to run.") cmd = tools.fix_python_path(cmd) outdir = run_isolated.make_temp_dir(u"isolate-%s" % datetime.date.today(), os.path.dirname(complete_state.root_dir)) try: # TODO(maruel): Use run_isolated.run_tha_test(). cwd = create_isolate_tree( outdir, complete_state.root_dir, complete_state.saved_state.files, complete_state.saved_state.relative_cwd, complete_state.saved_state.read_only, ) file_path.ensure_command_has_abs_path(cmd, cwd) logging.info("Running %s, cwd=%s" % (cmd, cwd)) try: result = subprocess.call(cmd, cwd=cwd) except OSError: sys.stderr.write( "Failed to executed the command; executable is missing, maybe you\n" "forgot to map it in the .isolate file?\n %s\n in %s\n" % (" ".join(cmd), cwd) ) result = 1 finally: file_path.rmtree(outdir) if complete_state.isolated_filepath: complete_state.save_files() return result
def setUp(self): super(RunIsolatedTest, self).setUp() self.tempdir = run_isolated.make_temp_dir(u'run_isolated_smoke_test', test_env.CLIENT_DIR) logging.debug(self.tempdir) self._root_dir = os.path.join(self.tempdir, 'w') # The run_isolated local cache. self._isolated_cache_dir = os.path.join(self.tempdir, 'i') self._isolated_server = isolateserver_fake.FakeIsolateServer() self._named_cache_dir = os.path.join(self.tempdir, 'n') self._cipd_cache_dir = os.path.join(self.tempdir, u'cipd') self._cipd_packages_cache_dir = os.path.join(self._cipd_cache_dir, 'cache') self._cas_client_dir = os.path.join(self.tempdir, u'cc') # Use the dev instance for testing for now. self._cas_instance = 'chromium-swarm-dev' self._cas_cache_dir = os.path.join(self.tempdir, 'c')
def CMDrun(parser, args): """Runs the test executable in an isolated (temporary) directory. All the dependencies are mapped into the temporary directory and the directory is cleaned up after the target exits. Argument processing stops at -- and these arguments are appended to the command line of the target to run. For example, use: isolate.py run --isolated foo.isolated -- --gtest_filter=Foo.Bar """ add_isolate_options(parser) add_skip_refresh_option(parser) options, args = parser.parse_args(args) process_isolate_options(parser, options, require_isolated=False) complete_state = load_complete_state(options, os.getcwd(), None, options.skip_refresh) cmd = complete_state.saved_state.command + args if not cmd: raise ExecutionError('No command to run.') cmd = tools.fix_python_cmd(cmd) outdir = run_isolated.make_temp_dir( u'isolate-%s' % datetime.date.today(), os.path.dirname(complete_state.root_dir)) try: # TODO(maruel): Use run_isolated.run_tha_test(). cwd = create_isolate_tree(outdir, complete_state.root_dir, complete_state.saved_state.files, complete_state.saved_state.relative_cwd, complete_state.saved_state.read_only) file_path.ensure_command_has_abs_path(cmd, cwd) logging.info('Running %s, cwd=%s' % (cmd, cwd)) try: result = subprocess.call(cmd, cwd=cwd) except OSError: sys.stderr.write( 'Failed to executed the command; executable is missing, maybe you\n' 'forgot to map it in the .isolate file?\n %s\n in %s\n' % (' '.join(cmd), cwd)) result = 1 finally: file_path.rmtree(outdir) if complete_state.isolated_filepath: complete_state.save_files() return result