예제 #1
0
 def test_load_isolated_os_bad(self):
     data = {u"os": "foo"}
     try:
         run_isolated.load_isolated(json.dumps(data))
         self.fail()
     except run_isolated.ConfigError:
         pass
예제 #2
0
 def test_load_isolated_bad(self):
     data = {u"files": {u"a": {u"l": u"somewhere", u"h": u"0123456789abcdef0123456789abcdef01234567"}}}
     try:
         run_isolated.load_isolated(json.dumps(data))
         self.fail()
     except run_isolated.ConfigError:
         pass
예제 #3
0
 def test_load_isolated_os_bad(self):
   data = {
     u'os': 'foo',
   }
   try:
     run_isolated.load_isolated(json.dumps(data))
     self.fail()
   except run_isolated.ConfigError:
     pass
예제 #4
0
 def test_load_isolated_bad(self):
   data = {
     u'files': {
       u'a': {
         u'l': u'somewhere',
         u'h': u'0123456789abcdef0123456789abcdef01234567'
       }
     },
   }
   try:
     run_isolated.load_isolated(json.dumps(data))
     self.fail()
   except run_isolated.ConfigError:
     pass
예제 #5
0
 def test_load_isolated_bad(self):
   data = {
     u'files': {
       u'a': {
         u'l': u'somewhere',
         u'h': u'0123456789abcdef0123456789abcdef01234567'
       }
     },
   }
   try:
     run_isolated.load_isolated(json.dumps(data))
     self.fail()
   except run_isolated.ConfigError:
     pass
예제 #6
0
def main():
  parser = run_test_cases.OptionParserTestCases(
      usage='%prog <options> -s <something.isolated>')
  parser.add_option(
      '-s', '--isolated',
      help='The isolated file')
  options, args = parser.parse_args()

  if args:
    parser.error('Unsupported arg: %s' % args)
  if not options.isolated:
    parser.error('--isolated is required')
  if not options.isolated.endswith('.isolated'):
    parser.error('--isolated argument must end with .isolated')

  # Retrieve the command from the .isolated file.
  with open(options.isolated) as f:
    data = run_isolated.load_isolated(f.read())
  if 'includes' in data:
    parser.error('includes key is not supported yet')

  command = data.get('command')
  if not command:
    parser.error('A command must be defined')
  test_cases = parser.process_gtest_options(
      run_isolated.fix_python_path(command),
      data.get('relative_cwd', os.getcwd()),
      options)
  if not test_cases:
    print >> sys.stderr, 'No test case to run'
    return 1

  return not fix_all(options.isolated, test_cases)
예제 #7
0
 def test_load_isolated_good(self):
     data = {
         u"command": [u"foo", u"bar"],
         u"files": {
             u"a": {u"l": u"somewhere", u"m": 123},
             u"b": {u"m": 123, u"h": u"0123456789abcdef0123456789abcdef01234567"},
         },
         u"includes": [u"0123456789abcdef0123456789abcdef01234567"],
         u"os": run_isolated.get_flavor(),
         u"read_only": False,
         u"relative_cwd": u"somewhere_else",
     }
     m = run_isolated.load_isolated(json.dumps(data))
     self.assertEquals(data, m)
예제 #8
0
 def test_load_isolated_good(self):
   data = {
     u'command': [u'foo', u'bar'],
     u'files': {
       u'a': {
         u'l': u'somewhere',
         u'm': 123,
       },
       u'b': {
         u'm': 123,
         u'h': u'0123456789abcdef0123456789abcdef01234567'
       }
     },
     u'includes': [u'0123456789abcdef0123456789abcdef01234567'],
     u'os': run_isolated.get_flavor(),
     u'read_only': False,
     u'relative_cwd': u'somewhere_else'
   }
   m = run_isolated.load_isolated(json.dumps(data))
   self.assertEquals(data, m)
예제 #9
0
 def test_load_isolated_good(self):
   data = {
     u'command': [u'foo', u'bar'],
     u'files': {
       u'a': {
         u'l': u'somewhere',
         u'm': 123,
       },
       u'b': {
         u'm': 123,
         u'h': u'0123456789abcdef0123456789abcdef01234567'
       }
     },
     u'includes': [u'0123456789abcdef0123456789abcdef01234567'],
     u'os': run_isolated.get_flavor(),
     u'read_only': False,
     u'relative_cwd': u'somewhere_else'
   }
   m = run_isolated.load_isolated(json.dumps(data))
   self.assertEqual(data, m)
예제 #10
0
 def test_load_isolated_os_only(self):
   data = {
     u'os': run_isolated.get_flavor(),
   }
   m = run_isolated.load_isolated(json.dumps(data))
   self.assertEquals(data, m)
예제 #11
0
 def test_load_isolated_empty(self):
   m = run_isolated.load_isolated('{}')
   self.assertEquals({}, m)
예제 #12
0
 def test_load_isolated_os_only(self):
   data = {
     u'os': run_isolated.get_flavor(),
   }
   m = run_isolated.load_isolated(json.dumps(data))
   self.assertEqual(data, m)
예제 #13
0
 def test_load_isolated_empty(self):
   m = run_isolated.load_isolated('{}')
   self.assertEqual({}, m)
def _GetDataFilesForTestSuite(product_dir, test_suite_basename):
  """Returns a list of data files/dirs needed by the test suite.

  Args:
    product_dir: Absolute path to product directory (e.g. /../out/Debug).
    test_suite_basename: The test suite basename (e.g. base_unittests).

  Returns:
    A list of test file and directory paths.
  """
  # TODO(frankf): *.isolated should be generated by gyp using foo_tests_run
  # targets. This is a stop-gap solution as currently there are no such
  # targets for content_unittests and content_browsertests.
  isolate_rel_path = _ISOLATE_FILE_PATHS.get(test_suite_basename)
  if isolate_rel_path:
    isolate_abs_path = os.path.join(constants.DIR_SOURCE_ROOT, isolate_rel_path)
    isolated_abs_path = os.path.join(
        product_dir, '%s.isolated' % test_suite_basename)
    assert os.path.exists(isolate_abs_path)
    isolate_cmd = [
      'python', _ISOLATE_SCRIPT,
      'check',
      '--isolate=%s' % isolate_abs_path,
      '--isolated=%s' % isolated_abs_path,
      '-V', 'PRODUCT_DIR=%s' % product_dir,
      '-V', 'OS=android',
      '--outdir=%s' % product_dir,
      ]
    assert not cmd_helper.RunCmd(isolate_cmd)
    with open(isolated_abs_path) as f:
      isolated_content = run_isolated.load_isolated(f.read(),
                                                    os_flavor='android')
      assert isolated_content['os'] == 'android'
      return isolated_content['files'].keys()

  logging.info('Did not find an isolate file for the test suite.')
  # Ideally, we'd just push all test data. However, it has >100MB, and a lot
  # of the files are not relevant (some are used for browser_tests, others for
  # features not supported, etc..).
  if test_suite_basename == 'unit_tests':
    test_files = [
        'base/test/data/',
        'chrome/test/data/download-test1.lib',
        'chrome/test/data/extensions/bad_magic.crx',
        'chrome/test/data/extensions/good.crx',
        'chrome/test/data/extensions/icon1.png',
        'chrome/test/data/extensions/icon2.png',
        'chrome/test/data/extensions/icon3.png',
        'chrome/test/data/extensions/allow_silent_upgrade/',
        'chrome/test/data/extensions/app/',
        'chrome/test/data/extensions/bad/',
        'chrome/test/data/extensions/effective_host_permissions/',
        'chrome/test/data/extensions/empty_manifest/',
        'chrome/test/data/extensions/good/Extensions/',
        'chrome/test/data/extensions/manifest_tests/',
        'chrome/test/data/extensions/page_action/',
        'chrome/test/data/extensions/permissions/',
        'chrome/test/data/extensions/script_and_capture/',
        'chrome/test/data/extensions/unpacker/',
        'chrome/test/data/bookmarks/',
        'chrome/test/data/components/',
        'chrome/test/data/extensions/json_schema_test.js',
        'chrome/test/data/History/',
        'chrome/test/data/json_schema_validator/',
        'chrome/test/data/pref_service/',
        'chrome/test/data/simple_open_search.xml',
        'chrome/test/data/top_sites/',
        'chrome/test/data/web_app_info/',
        'chrome/test/data/webui/',
        'chrome/third_party/mock4js/',
        'components/test/data/web_database',
        'net/data/ssl/certificates',
        'third_party/accessibility-developer-tools/gen/axs_testing.js',
        'third_party/zlib/google/test/data',
    ]
    # The following are spell check data. Now only list the data under
    # third_party/hunspell_dictionaries which are used by unit tests.
    old_cwd = os.getcwd()
    os.chdir(constants.DIR_SOURCE_ROOT)
    test_files += glob.glob('third_party/hunspell_dictionaries/*.bdic')
    os.chdir(old_cwd)
    return test_files
  elif test_suite_basename == 'media_unittests':
    return [
        'media/test/data',
    ]
  elif test_suite_basename == 'net_unittests':
    return [
        'chrome/test/data/animate1.gif',
        'chrome/test/data/simple.html',
        'net/data/cache_tests',
        'net/data/filter_unittests',
        'net/data/ftp',
        'net/data/proxy_resolver_v8_tracing_unittest',
        'net/data/proxy_resolver_v8_unittest',
        'net/data/proxy_script_fetcher_unittest',
        'net/data/ssl/certificates',
        'net/data/test.html',
        'net/data/url_request_unittest/',
        ]
  elif test_suite_basename == 'ui_tests':
    return [
        'chrome/test/data/dromaeo',
        'chrome/test/data/json2.js',
        'chrome/test/data/sunspider',
        ]
  elif test_suite_basename == 'ui_unittests':
    return [
        'ui/base/test/data/data_pack_unittest/truncated-header.pak',
    ]
  elif test_suite_basename == 'content_unittests':
    return [
        'content/test/data/gpu/webgl_conformance_test_expectations.txt',
        'content/test/data/page_state/',
        'net/data/ssl/certificates/',
        'third_party/hyphen/hyph_en_US.dic',
        'webkit/data/dom_storage/webcore_test_database.localstorage',
        ]
  elif test_suite_basename == 'cc_perftests':
    return [
      'cc/test/data',
    ]
  elif test_suite_basename == 'perf_tests':
    return [
      'base/test/data',
    ]
  elif test_suite_basename == 'content_browsertests':
    return [
        'content/test/data/content-disposition-inline.html',
        'content/test/data/title1.html',
        'content/test/data/post_message2.html',
        'content/test/data/content-sniffer-test0.html.mock-http-headers',
        'content/test/data/content-sniffer-test1.html.mock-http-headers',
        'content/test/data/speech',
        'content/test/data/page404.html.mock-http-headers',
        'content/test/data/content-sniffer-test3.html',
        'content/test/data/post_message.html',
        'content/test/data/remove_frame_on_unload.html',
        'content/test/data/cross-origin-redirect-blocked.html',
        'content/test/data/prerender',
        'content/test/data/device_orientation',
        'content/test/data/content-disposition-empty.html',
        'content/test/data/workers',
        'content/test/data/content-sniffer-test3.html.mock-http-headers',
        'content/test/data/content-sniffer-test0.html',
        'content/test/data/browser_plugin_title_change.html',
        'content/test/data/android',
        'content/test/data/page404.html',
        'content/test/data/dynamic2.html',
        'content/test/data/browser_plugin_embedder.html',
        'content/test/data/indexeddb',
        'content/test/data/content-disposition-inline.html.mock-http-headers',
        'content/test/data/nosniff-test.html',
        'content/test/data/title3.html',
        'content/test/data/browser_plugin_post_message_guest.html',
        'content/test/data/content-disposition-empty.html.mock-http-headers',
        'content/test/data/session_history',
        'content/test/data/browser_plugin_embedder.html',
        'content/test/data/overscroll_navigation.html',
        'content/test/data/simple_database.html',
        'content/test/data/gtk_key_bindings_test_gtkrc',
        'content/test/data/browser_plugin_embedder_guest_unresponsive.html',
        'content/test/data/sync_xmlhttprequest.html',
        'content/test/data/content-sniffer-test3-frame.txt.mock-http-headers',
        'content/test/data/frame_tree',
        'content/test/data/content-sniffer-test2.html.mock-http-headers',
        'content/test/data/sync_xmlhttprequest_disallowed.html',
        'content/test/data/rwh_simple.html',
        'content/test/data/title2.html',
        'content/test/data/webkit',
        'content/test/data/content-sniffer-test1.html',
        'content/test/data/download',
        'content/test/data/content-sniffer-test2.html',
        'content/test/data/simple_page.html',
        'content/test/data/google.mht',
        'content/test/data/site_per_process_main.html',
        'content/test/data/gpu',
        'content/test/data/onunload_cookie.html',
        'content/test/data/textinput',
        'content/test/data/navigate_opener.html',
        'content/test/data/dom_storage',
        'content/test/data/sync_xmlhttprequest_during_unload.html',
        'content/test/data/browser_plugin_dragging.html',
        'content/test/data/fileapi',
        'content/test/data/npapi',
        'content/test/data/nosniff-test.html.mock-http-headers',
        'content/test/data/accessibility',
        'content/test/data/dynamic1.html',
        'content/test/data/browser_plugin_focus_child.html',
        'content/test/data/rwhv_compositing_animation.html',
        'content/test/data/click-noreferrer-links.html',
        'content/test/data/browser_plugin_focus.html',
        'content/test/data/media',
        'third_party/webgl_conformance',
    ]
  return []
예제 #15
0
 def test_load_isolated_empty(self):
     m = run_isolated.load_isolated("{}")
     self.assertEquals({}, m)