#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import os import shutil import struct import subprocess import sys import tempfile import unittest from unittest import mock from unittest.mock import patch import buildconfig import mozpack.path as mozpath import mozunit import symbolstore from mozpack.manifests import InstallManifest from symbolstore import realpath # Some simple functions to mock out files that the platform-specific dumpers will accept. # dump_syms itself will not be run (we mock that call out), but we can't override # the ShouldProcessFile method since we actually want to test that. def write_elf(filename): open(filename, "wb").write( struct.pack("<7B45x", 0x7F, ord("E"), ord("L"), ord("F"), 1, 1, 1) ) def write_macho(filename): open(filename, "wb").write(struct.pack("= 1, "should have a FILE line for " + match ) # Skip this check for local git repositories. if not os.path.isdir(mozpath.join(self.topsrcdir, ".hg")): return for line in match_lines: filename = line.split(None, 2)[2] self.assertEqual("hg:", filename[:3]) # Check that nsBrowserApp.cpp is listed as a FILE line, and that # it was properly mapped to the source repo. check_hg_path(file_lines, "nsBrowserApp.cpp") # Also check Sprintf.h to verify that files from dist/include # are properly mapped. check_hg_path(file_lines, "mfbt/Sprintf.h") if __name__ == "__main__": mozunit.main()