Mac v2 signing - Bug 1064952 - Update Cpp unit test harness for the new v2 bundle structure on OSX. r=jmaher

This commit is contained in:
Stephen Pohl 2014-09-29 11:51:39 -07:00
parent d16e3504d5
commit 1e3e94d28b
2 changed files with 18 additions and 2 deletions

View File

@ -414,6 +414,14 @@ int main(int argc, char** argv)
nsCOMPtr<nsIFile> manifest; nsCOMPtr<nsIFile> manifest;
scrv = NS_GetSpecialDirectory(NS_GRE_DIR, scrv = NS_GetSpecialDirectory(NS_GRE_DIR,
getter_AddRefs(manifest)); getter_AddRefs(manifest));
#ifdef XP_MACOSX
if (NS_SUCCEEDED(scrv)) {
nsCOMPtr<nsIFile> parent;
manifest->GetParent(getter_AddRefs(parent));
parent->AppendNative(NS_LITERAL_CSTRING("MacOS"));
manifest = parent.forget();
}
#endif
if (NS_FAILED(scrv)) { if (NS_FAILED(scrv)) {
fail("NS_XPCOM_CURRENT_PROCESS_DIR"); fail("NS_XPCOM_CURRENT_PROCESS_DIR");
return 1; return 1;

View File

@ -97,17 +97,23 @@ class CPPUnitTests(object):
env = dict(os.environ) env = dict(os.environ)
env = self.build_core_environment(env) env = self.build_core_environment(env)
pathvar = "" pathvar = ""
libpath = self.xre_path
if mozinfo.os == "linux": if mozinfo.os == "linux":
pathvar = "LD_LIBRARY_PATH" pathvar = "LD_LIBRARY_PATH"
elif mozinfo.os == "mac": elif mozinfo.os == "mac":
applibpath = os.path.join(os.path.dirname(libpath), 'MacOS')
if os.path.exists(applibpath):
# Set the library load path to Contents/MacOS if we're run from
# the app bundle.
libpath = applibpath
pathvar = "DYLD_LIBRARY_PATH" pathvar = "DYLD_LIBRARY_PATH"
elif mozinfo.os == "win": elif mozinfo.os == "win":
pathvar = "PATH" pathvar = "PATH"
if pathvar: if pathvar:
if pathvar in env: if pathvar in env:
env[pathvar] = "%s%s%s" % (self.xre_path, os.pathsep, env[pathvar]) env[pathvar] = "%s%s%s" % (libpath, os.pathsep, env[pathvar])
else: else:
env[pathvar] = self.xre_path env[pathvar] = libpath
# Use llvm-symbolizer for ASan if available/required # Use llvm-symbolizer for ASan if available/required
llvmsym = os.path.join(self.xre_path, "llvm-symbolizer") llvmsym = os.path.join(self.xre_path, "llvm-symbolizer")
@ -209,6 +215,8 @@ def main():
progs = extract_unittests_from_args(args, options.manifest_file) progs = extract_unittests_from_args(args, options.manifest_file)
options.xre_path = os.path.abspath(options.xre_path) options.xre_path = os.path.abspath(options.xre_path)
if mozinfo.isMac:
options.xre_path = os.path.join(os.path.dirname(options.xre_path), 'Resources')
tester = CPPUnitTests() tester = CPPUnitTests()
try: try: