Exemple #1
0
  def setUp(self, test_methods_to_run):
    super(JavaScriptTestRunner, self).setUp(test_methods_to_run)
    additional_metadata = self._get_additional_metadata(test_methods_to_run)
    args = self.get_launch_chrome_command(
        self._get_js_test_options(),
        additional_metadata=additional_metadata)
    prep_launch_chrome.update_arc_metadata(additional_metadata, args)

    # List of sourcemap files. This needs to be sync with the build-time
    # configuration. cf) src/packaging/config.py.
    runtime_dir = build_common.get_runtime_out_dir()
    test_template_dir = build_common.get_build_path_for_gen_test_template(
        self.name)
    annotator = source_annotator.SourceAnnotator([
        ('gen_main.min.js',
         os.path.join(runtime_dir, 'gen_main.min.js'),
         os.path.join(runtime_dir, 'gen_main.min.js.map')),
        ('gen_index.min.js',
         os.path.join(runtime_dir, 'gen_index.min.js'),
         os.path.join(runtime_dir, 'gen_index.min.js.map')),
        ('gen_test.min.js',
         os.path.join(test_template_dir, 'gen_test.min.js'),
         os.path.join(test_template_dir, 'gen_test.min.js.map'))
    ])
    self._logger = _JavaScriptLoggerWrapper(self._logger, annotator)
Exemple #2
0
def _launch_nacl_gdb(gdb_type, nacl_irt_path, port):
  nmf = os.path.join(build_common.get_runtime_out_dir(),
                     'arc_' + OPTIONS.target() + '.nmf')
  assert os.path.exists(nmf), (
      nmf + ' not found, you will have a bad time debugging')

  # TODO(nativeclient:3739): We explicitly specify the path of
  # runnable-ld.so to work-around the issue in nacl-gdb, but we should
  # let nacl-gdb find the path from NMF.
  gdb_args = ['-ex', 'nacl-manifest %s' % nmf]
  if nacl_irt_path:
    gdb_args.extend(['-ex', 'nacl-irt %s' % nacl_irt_path])
  gdb_args.extend(['-ex', 'target remote %s:%s' % (_LOCAL_HOST, port),
                   build_common.get_bionic_runnable_ld_so()])
  _launch_plugin_gdb(gdb_args, gdb_type)
Exemple #3
0
def _launch_nacl_gdb(gdb_type, nacl_irt_path, port):
    nmf = os.path.join(build_common.get_runtime_out_dir(),
                       'arc_' + OPTIONS.target() + '.nmf')
    assert os.path.exists(nmf), (
        nmf + ' not found, you will have a bad time debugging')

    # TODO(nativeclient:3739): We explicitly specify the path of
    # runnable-ld.so to work-around the issue in nacl-gdb, but we should
    # let nacl-gdb find the path from NMF.
    gdb_args = ['-ex', 'nacl-manifest %s' % nmf]
    if nacl_irt_path:
        gdb_args.extend(['-ex', 'nacl-irt %s' % nacl_irt_path])
    gdb_args.extend([
        '-ex',
        'target remote %s:%s' % (_LOCAL_HOST, port),
        build_common.get_bionic_runnable_ld_so()
    ])
    _launch_plugin_gdb(gdb_args, gdb_type)
Exemple #4
0
def _compute_chrome_plugin_params(parsed_args):
  params = []
  params.append(
      '--load-extension=' +
      remote_executor.resolve_path(build_common.get_runtime_out_dir()))

  # Do not use user defined data directory if user name for remote host is
  # provided. The mounted cryptohome directory is used instead.
  if not parsed_args.login_user:
    params.append(
        '--user-data-dir=' + remote_executor.resolve_path(_USER_DATA_DIR))

  # Force-enable nonsfi mode on targets that do not allow it by default
  # (for example, non-ChromeOS Linux) for testing purposes.
  if (OPTIONS.is_bare_metal_build() and
      not platform_util.is_running_on_chromeos()):
    params.append('--enable-nacl-nonsfi-mode')

  return params
Exemple #5
0
    def setUp(self, test_methods_to_run):
        super(JavaScriptTestRunner, self).setUp(test_methods_to_run)
        additional_metadata = self._get_additional_metadata(
            test_methods_to_run)
        args = self.get_launch_chrome_command(
            self._get_js_test_options(),
            additional_metadata=additional_metadata)
        prep_launch_chrome.update_arc_metadata(additional_metadata, args)

        # List of sourcemap files. This needs to be sync with the build-time
        # configuration. cf) src/packaging/config.py.
        runtime_dir = build_common.get_runtime_out_dir()
        test_template_dir = build_common.get_build_path_for_gen_test_template(
            self.name)
        annotator = source_annotator.SourceAnnotator([
            ('gen_main.min.js', os.path.join(runtime_dir, 'gen_main.min.js'),
             os.path.join(runtime_dir, 'gen_main.min.js.map')),
            ('gen_index.min.js', os.path.join(runtime_dir, 'gen_index.min.js'),
             os.path.join(runtime_dir, 'gen_index.min.js.map')),
            ('gen_test.min.js',
             os.path.join(test_template_dir, 'gen_test.min.js'),
             os.path.join(test_template_dir, 'gen_test.min.js.map'))
        ])
        self._logger = _JavaScriptLoggerWrapper(self._logger, annotator)
Exemple #6
0
def generate_test_ninjas():
  n = ninja_generator.PpapiTestNinjaGenerator(
      'posix_translation_test',
      base_path='src/posix_translation',
      force_compiler='clang',
      enable_cxx11=True)
  # Build a rootfs image for tests.
  rule_name = 'gen_test_fs_image'
  script_path = 'src/posix_translation/scripts/create_test_fs_image.py'

  gen_prod_image = (
      build_common.get_posix_translation_readonly_fs_image_file_path())

  # This is a little odd, but we use the documented path to the production image
  # to also store a test image in the same location for simplicity.
  out_path = os.path.dirname(gen_prod_image)
  gen_test_image = os.path.join(out_path, 'test_readonly_fs_image.img')

  n.rule(rule_name,
         command=script_path + ' $out_path',
         description=rule_name + ' $in_real_path')
  n.add_ppapi_compile_flags()
  n.build([gen_test_image], rule_name,
          variables={'out_path': out_path},
          # The script calls create_readonly_fs_image.py.
          implicit=[script_path,
                    _CREATE_READONLY_FS_IMAGE_SCRIPT,
                    ])
  all_files = n.find_all_contained_test_sources()

  n.build_default(all_files, base_path=None)
  n.add_compiler_flags('-Werror')
  n.add_library_deps('libposix_translation_static.a',
                     'libchromium_base.a',
                     'libcommon.a',
                     'libgccdemangle_static.a')
  if build_common.use_ndk_direct_execution():
    n.add_defines('USE_NDK_DIRECT_EXECUTION')
  implicit = [gen_test_image]
  if open_source.is_open_source_repo():
    implicit.append(gen_prod_image)
    n.add_defines('PROD_READONLY_FS_IMAGE="%s"' % gen_prod_image)
  else:
    # Add runtime to implicit dependencies because ReadonlyFsReaderTest uses
    # the readonly FS image in runtime.
    implicit.append(build_common.get_runtime_build_stamp())
    n.add_defines('PROD_READONLY_FS_IMAGE="%s"' % os.path.join(
                  build_common.get_runtime_platform_specific_path(
                      build_common.get_runtime_out_dir(), OPTIONS.target()),
                  os.path.basename(gen_prod_image)))
    n.run(n.link(), implicit=implicit)

  # To be able to refer mock implementation from outside of posix_translation.
  # Setting instance count is zero because usage count verifier doesn't check
  # the reference from test executable. See verify_usage_counts in
  # ninja_generator.py
  n = ninja_generator.ArchiveNinjaGenerator(
      'mock_posix_translation',
      instances=0,
      force_compiler='clang',
      enable_cxx11=True)
  n.add_libchromium_base_compile_flags()
  n.add_compiler_flags('-Werror')
  all_files = ['src/posix_translation/test_util/mock_virtual_file_system.cc']
  n.build_default(all_files).archive()