--- a/toolkit/crashreporter/tools/unit-symbolstore.py
+++ b/toolkit/crashreporter/tools/unit-symbolstore.py
@@ -9,16 +9,17 @@ import mozunit
import os
import platform
import shutil
import struct
import subprocess
import sys
import tempfile
import unittest
+import buildconfig
from mock import patch
from mozpack.manifests import InstallManifest
import mozpack.path as mozpath
import symbolstore
# Some simple functions to mock out files that the platform-specific dumpers will accept.
@@ -30,26 +31,27 @@ def write_elf(filename):
def write_macho(filename):
open(filename, "wb").write(struct.pack("<I28x", 0xfeedface))
def write_pdb(filename):
open(filename, "w").write("aaa")
# write out a fake DLL too
open(os.path.splitext(filename)[0] + ".dll", "w").write("aaa")
-writer = {'Windows': write_pdb,
- 'Microsoft': write_pdb,
+def target_platform():
+ return buildconfig.substs['OS_TARGET']
+
+writer = {'WINNT': write_pdb,
'Linux': write_elf,
'Sunos5': write_elf,
- 'Darwin': write_macho}[platform.system()]
-extension = {'Windows': ".pdb",
- 'Microsoft': ".pdb",
+ 'Darwin': write_macho}[target_platform()]
+extension = {'WINNT': ".pdb",
'Linux': ".so",
'Sunos5': ".so",
- 'Darwin': ".dylib"}[platform.system()]
+ 'Darwin': ".dylib"}[target_platform()]
def add_extension(files):
return [f + extension for f in files]
class HelperMixin(object):
"""
Test that passing filenames to exclude from processing works.
"""
@@ -304,17 +306,17 @@ class TestRepoManifest(HelperMixin, unit
repo_manifest=manifest)
self.assertEqual("git:example.com/bar/projects/one:src1.c:abcd1234",
symbolstore.GetVCSFilename(file1, d.srcdirs)[0])
self.assertEqual("git:example.com/foo/projects/two:src2.c:ffffffff",
symbolstore.GetVCSFilename(file2, d.srcdirs)[0])
self.assertEqual("git:example.com/bar/something_else:src3.c:00000000",
symbolstore.GetVCSFilename(file3, d.srcdirs)[0])
-if platform.system() in ("Windows", "Microsoft"):
+if target_platform() == 'WINNT':
class TestFixFilenameCase(HelperMixin, unittest.TestCase):
def test_fix_filename_case(self):
# self.test_dir is going to be 8.3 paths...
junk = os.path.join(self.test_dir, 'x')
with open(junk, 'wb') as o:
o.write('x')
d = symbolstore.Dumper_Win32(dump_syms='dump_syms',
symbol_path=self.test_dir)
@@ -512,25 +514,24 @@ class TestFunctional(HelperMixin, unitte
dump_syms binary and passing in a real binary to dump symbols from.
Since the rest of the tests in this file mock almost everything and
don't use the actual process pool like buildsymbols does, this tests
that the way symbolstore.py gets called in buildsymbols works.
'''
def setUp(self):
HelperMixin.setUp(self)
- import buildconfig
self.skip_test = False
if buildconfig.substs['MOZ_BUILD_APP'] != 'browser':
self.skip_test = True
self.topsrcdir = buildconfig.topsrcdir
self.script_path = os.path.join(self.topsrcdir, 'toolkit',
'crashreporter', 'tools',
'symbolstore.py')
- if platform.system() in ("Windows", "Microsoft"):
+ if target_platform() == 'WINNT':
if buildconfig.substs['MSVC_HAS_DIA_SDK']:
self.dump_syms = os.path.join(buildconfig.topobjdir,
'dist', 'host', 'bin',
'dump_syms.exe')
else:
self.dump_syms = os.path.join(self.topsrcdir,
'toolkit',
'crashreporter',