Esempio n. 1
0
    def setUp(self):
        # Make certain we don't use the network.
        self.urlopen_mock = self.PatchObject(urllib.request, 'urlopen')
        self.request_mock = self.PatchObject(upload_symbols,
                                             'ExecRequest',
                                             return_value={
                                                 'uploadUrl': 'testurl',
                                                 'uploadKey': 'asdgasgas'
                                             })

        # Make 'uploads' go fast.
        self.PatchObject(upload_symbols, 'SLEEP_DELAY', 0)
        self.PatchObject(upload_symbols, 'INITIAL_RETRY_DELAY', 0)

        # So our symbol file content doesn't have to be real.
        self.PatchObject(
            cros_generate_breakpad_symbols,
            'ReadSymsHeader',
            return_value=cros_generate_breakpad_symbols.SymbolHeader(
                os='os', cpu='cpu', id='id', name='name'))

        self.working = os.path.join(self.tempdir, 'expand')
        osutils.SafeMakedirs(self.working)

        self.data = os.path.join(self.tempdir, 'data')
        osutils.SafeMakedirs(self.data)
Esempio n. 2
0
 def setUp(self):
     self.storage_mock = mock.MagicMock()
     self.header_mock = self.PatchObject(
         cros_generate_breakpad_symbols,
         'ReadSymsHeader',
         return_value=cros_generate_breakpad_symbols.SymbolHeader(
             os='os', cpu='cpu', id='id', name='name'))
Esempio n. 3
0
    def testFindDuplicates(self):
        # The first two symbols will be duplicate, the third new.
        sym1 = self.createSymbolFile('sym1.sym')
        sym1.header = cros_generate_breakpad_symbols.SymbolHeader(
            'cpu', 'BEAA9BE', 'sym1_sym', 'os')
        sym2 = self.createSymbolFile('sym2.sym')
        sym2.header = cros_generate_breakpad_symbols.SymbolHeader(
            'cpu', 'B6B1A36', 'sym2_sym', 'os')
        sym3 = self.createSymbolFile('sym3.sym')
        sym3.header = cros_generate_breakpad_symbols.SymbolHeader(
            'cpu', 'D4FC0FC', 'sym3_sym', 'os')

        result = upload_symbols.FindDuplicates((sym1, sym2, sym3),
                                               'fake_url',
                                               api_key='testkey')
        self.assertEqual(list(result), [sym1, sym2, sym3])

        self.assertEqual(sym1.status, upload_symbols.SymbolFile.DUPLICATE)
        self.assertEqual(sym2.status, upload_symbols.SymbolFile.DUPLICATE)
        self.assertEqual(sym3.status, upload_symbols.SymbolFile.INITIAL)
  def setUp(self):
    # Make certain we don't use the network.
    self.isolate_mock = self.PatchObject(isolateserver, 'get_storage_api')
    self.urlopen_mock = self.PatchObject(urllib2, 'urlopen')

    # Make 'uploads' go fast.
    self.PatchObject(upload_symbols, 'SLEEP_DELAY', 0)
    self.PatchObject(upload_symbols, 'INITIAL_RETRY_DELAY', 0)

    # So our symbol file content doesn't have to be real.
    self.PatchObject(cros_generate_breakpad_symbols, 'ReadSymsHeader',
                     return_value=cros_generate_breakpad_symbols.SymbolHeader(
                         os='os', cpu='cpu', id='id', name='name'))

    self.working = os.path.join(self.tempdir, 'expand')
    osutils.SafeMakedirs(self.working)

    self.data = os.path.join(self.tempdir, 'data')
    osutils.SafeMakedirs(self.data)
Esempio n. 5
0
    def setUp(self):
        for d in ('foo', 'bar', 'some/dir/here'):
            d = os.path.join(self.tempdir, d)
            osutils.SafeMakedirs(d)
            for f in ('ignored', 'real.sym', 'no.sym.here'):
                f = os.path.join(d, f)
                osutils.Touch(f)
        self.sym_paths = [
            'bar/real.sym',
            'foo/real.sym',
            'some/dir/here/real.sym',
        ]

        self.upload_mock = self.PatchObject(upload_symbols, 'UploadSymbol')
        self.PatchObject(
            cros_generate_breakpad_symbols,
            'ReadSymsHeader',
            return_value=cros_generate_breakpad_symbols.SymbolHeader(
                os='os', cpu='cpu', id='id', name='name'))