Bug 1737285 - Use pathlib to retrieve the relative path to the Visual Studio SDK. r=calixte,firefox-build-system-reviewers,mhentges DONTBUILD
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Mon, 25 Oct 2021 08:17:34 +0000
changeset 596805 8f78ed673519de2dd9d88ef0e6ee7466eeeee667
parent 596804 32ab6b8790bb1b329a0995685c09631114a6361f
child 596806 9ba9f1947404c1353afffe62f9875da00ac503c8
push id38911
push usernfay@mozilla.com
push dateMon, 25 Oct 2021 09:37:29 +0000
treeherdermozilla-central@8f78ed673519 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscalixte, firefox-build-system-reviewers, mhentges
bugs1737285
milestone95.0a1
first release with
nightly linux32
8f78ed673519 / 95.0a1 / 20211025093729 / files
nightly linux64
8f78ed673519 / 95.0a1 / 20211025093729 / files
nightly mac
8f78ed673519 / 95.0a1 / 20211025093729 / files
nightly win32
8f78ed673519 / 95.0a1 / 20211025093729 / files
nightly win64
8f78ed673519 / 95.0a1 / 20211025093729 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1737285 - Use pathlib to retrieve the relative path to the Visual Studio SDK. r=calixte,firefox-build-system-reviewers,mhentges DONTBUILD To avoid checking for a relative path using string operations, that can fail on Windows when the paths have different casing. Differential Revision: https://phabricator.services.mozilla.com/D129303
testing/parse_build_tests_ccov.py
--- a/testing/parse_build_tests_ccov.py
+++ b/testing/parse_build_tests_ccov.py
@@ -2,16 +2,17 @@
 #
 # 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/.
 
 from __future__ import absolute_import
 import sys
 import os
+import pathlib
 import shutil
 import subprocess
 import tempfile
 import zipfile
 import buildconfig
 
 
 def main():
@@ -44,32 +45,28 @@ def main():
             if opt.startswith("WINDOWSSDKDIR="):
                 windows_sdk_dir = opt[len("WINDOWSSDKDIR=") :]
                 break
 
         assert (
             windows_sdk_dir is not None
         ), "WINDOWSSDKDIR should be in MOZ_CONFIGURE_OPTIONS"
 
-        ignore_dir_abs = os.path.dirname(windows_sdk_dir)
+        ignore_dir_abs = pathlib.Path(windows_sdk_dir).parent
 
         # globs passed to grcov must exist and must be relative to the source directory.
         # If it doesn't exist, maybe it has moved and we need to update the paths above.
         # If it is no longer relative to the source directory, we no longer need to ignore it and
         # this code can be removed.
-        assert os.path.isdir(ignore_dir_abs), "{} is not a directory".format(
-            ignore_dir_abs
-        )
-        assert ignore_dir_abs.startswith(
-            buildconfig.topsrcdir
-        ), "{} should start with {}".format(ignore_dir_abs, buildconfig.topsrcdir)
+        assert ignore_dir_abs.is_dir(), f"{ignore_dir_abs} is not a directory"
+        ignore_dir_rel = ignore_dir_abs.relative_to(buildconfig.topsrcdir)
 
         grcov_command += [
             "--ignore",
-            os.path.relpath(ignore_dir_abs, buildconfig.topsrcdir) + "*",
+            f"{ignore_dir_rel}*",
         ]
 
     if buildconfig.substs["OS_TARGET"] == "Linux":
         gcc_dir = os.path.join(os.environ["MOZ_FETCHES_DIR"], "gcc")
         if "LD_LIBRARY_PATH" in os.environ:
             os.environ["LD_LIBRARY_PATH"] = "{}/lib64/:{}".format(
                 gcc_dir, os.environ["LD_LIBRARY_PATH"]
             )