From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- testing/mozbase/manifestparser/manifestparser/toml.py | 8 +++++++- .../mozbase/manifestparser/tests/test_manifestparser.py | 7 +++++++ testing/mozbase/mozdebug/mozdebug/mozdebug.py | 8 ++++---- testing/mozbase/mozinfo/mozinfo/mozinfo.py | 14 ++++++++++---- testing/mozbase/mozrunner/mozrunner/devices/base.py | 2 +- testing/mozbase/rust/mozdevice/src/lib.rs | 2 -- testing/mozbase/rust/mozprofile/src/prefreader.rs | 1 - testing/mozbase/rust/mozrunner/src/runner.rs | 1 - 8 files changed, 29 insertions(+), 14 deletions(-) (limited to 'testing/mozbase') diff --git a/testing/mozbase/manifestparser/manifestparser/toml.py b/testing/mozbase/manifestparser/manifestparser/toml.py index e028a4b0d7..4defd99156 100644 --- a/testing/mozbase/manifestparser/manifestparser/toml.py +++ b/testing/mozbase/manifestparser/manifestparser/toml.py @@ -163,8 +163,14 @@ def read_toml( # merge combined defaults into each section sections = [(i, combine_fields(defaults, j)) for i, j in sections] - if not document: + if document: + # Take the line where the test name appears in the file. + for i, _ in enumerate(sections): + line = contents.split(sections[i][0])[0].count(os.linesep) + 1 + manifest.setdefault(sections[i][0], {})["lineno"] = str(line) + else: manifest = None + return sections, defaults, manifest diff --git a/testing/mozbase/manifestparser/tests/test_manifestparser.py b/testing/mozbase/manifestparser/tests/test_manifestparser.py index f1774cfffb..ddbc6ecc79 100755 --- a/testing/mozbase/manifestparser/tests/test_manifestparser.py +++ b/testing/mozbase/manifestparser/tests/test_manifestparser.py @@ -5,6 +5,7 @@ # You can obtain one at http://mozilla.org/MPL/2.0/. import os +import re import shutil import tempfile import unittest @@ -620,6 +621,12 @@ yellow = submarine after = "edit-manifest-after.toml" after_path = os.path.join(here, after) after_str = open(after_path, "r", encoding="utf-8").read() + + # Define the regex pattern to match lines containing 'lineno' + pattern = re.compile(r"^.*lineno.*$\n?", re.MULTILINE) + # Remove lines containing 'lineno' + manifest_str = re.sub(pattern, "", manifest_str) + assert manifest_str == after_str diff --git a/testing/mozbase/mozdebug/mozdebug/mozdebug.py b/testing/mozbase/mozdebug/mozdebug/mozdebug.py index beecc2cd9d..d8d0b85795 100755 --- a/testing/mozbase/mozdebug/mozdebug/mozdebug.py +++ b/testing/mozbase/mozdebug/mozdebug/mozdebug.py @@ -6,9 +6,9 @@ import json import os +import shutil import sys from collections import namedtuple -from distutils.spawn import find_executable from subprocess import check_output import mozinfo @@ -108,7 +108,7 @@ def get_debugger_path(debugger): if path: return path except Exception: - # Just default to find_executable instead. + # Just default to shutil.which instead. pass if mozinfo.os == "win" and debugger == "devenv.exe": @@ -122,10 +122,10 @@ def get_debugger_path(debugger): vsinfo[0]["installationPath"], "Common7", "IDE", "devenv.exe" ) except Exception: - # Just default to find_executable instead. + # Just default to shutil.which instead. pass - return find_executable(debugger) + return shutil.which(debugger) def get_debugger_info(debugger, debuggerArgs=None, debuggerInteractive=False): diff --git a/testing/mozbase/mozinfo/mozinfo/mozinfo.py b/testing/mozbase/mozinfo/mozinfo/mozinfo.py index bb04be54c8..0114b17f66 100755 --- a/testing/mozbase/mozinfo/mozinfo/mozinfo.py +++ b/testing/mozbase/mozinfo/mozinfo/mozinfo.py @@ -65,7 +65,13 @@ if system in ["Microsoft", "Windows"]: version = "%d.%d.%d" % (major, minor, build_number) if major == 10 and minor == 0 and build_number >= 22000: major = 11 - os_version = "%d.%d" % (major, minor) + + # 2009 == 22H2 software update. These are the build numbers + # we use 2009 as the "build" which maps to what taskcluster tasks see + if build_number == 22621 or build_number == 19045: + build_number = 2009 + + os_version = "%d.%d" % (major, build_number) elif system.startswith(("MINGW", "MSYS_NT")): # windows/mingw python build (msys) info["os"] = "win" @@ -107,7 +113,7 @@ elif system == "Darwin": (release, versioninfo, machine) = platform.mac_ver() version = "OS X %s" % release versionNums = release.split(".")[:2] - os_version = "%s.%s" % (versionNums[0], versionNums[1]) + os_version = "%s.%s" % (versionNums[0], versionNums[1].ljust(2, "0")) info["os"] = "mac" elif sys.platform in ("solaris", "sunos5"): info["os"] = "unix" @@ -277,8 +283,8 @@ def find_and_update_from_json(*dirs, **kwargs): except (BuildEnvironmentNotFoundException, MozconfigFindException): pass - for d in dirs: - d = _os.path.abspath(d) + for dir in dirs: + d = _os.path.abspath(dir) json_path = _os.path.join(d, "mozinfo.json") if _os.path.isfile(json_path): update(json_path) diff --git a/testing/mozbase/mozrunner/mozrunner/devices/base.py b/testing/mozbase/mozrunner/mozrunner/devices/base.py index 6197b0d6ce..05eb61ca86 100644 --- a/testing/mozbase/mozrunner/mozrunner/devices/base.py +++ b/testing/mozbase/mozrunner/mozrunner/devices/base.py @@ -118,7 +118,7 @@ class Device(object): # The file will still be deleted at the end of the `with` block. # See the "Opening the temporary file again" paragraph in: # https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile - with tempfile.NamedTemporaryFile(delete=False) as new_profiles_ini: + with tempfile.NamedTemporaryFile(mode="w", delete=False) as new_profiles_ini: config.write(new_profiles_ini) self.backup_file(self.app_ctx.remote_profiles_ini) self.device.push(new_profiles_ini.name, self.app_ctx.remote_profiles_ini) diff --git a/testing/mozbase/rust/mozdevice/src/lib.rs b/testing/mozbase/rust/mozdevice/src/lib.rs index 5fd13b4903..45f7d4d2cf 100644 --- a/testing/mozbase/rust/mozdevice/src/lib.rs +++ b/testing/mozbase/rust/mozdevice/src/lib.rs @@ -12,10 +12,8 @@ use log::{debug, info, trace, warn}; use once_cell::sync::Lazy; use regex::Regex; use std::collections::BTreeMap; -use std::convert::TryFrom; use std::fs::File; use std::io::{self, Read, Write}; -use std::iter::FromIterator; use std::net::TcpStream; use std::num::{ParseIntError, TryFromIntError}; use std::path::{Component, Path}; diff --git a/testing/mozbase/rust/mozprofile/src/prefreader.rs b/testing/mozbase/rust/mozprofile/src/prefreader.rs index 9c94666e7d..a7294af120 100644 --- a/testing/mozbase/rust/mozprofile/src/prefreader.rs +++ b/testing/mozbase/rust/mozprofile/src/prefreader.rs @@ -8,7 +8,6 @@ use std::borrow::Cow; use std::char; use std::error::Error; use std::io::{self, Write}; -use std::iter::Iterator; use std::str; use thiserror::Error; diff --git a/testing/mozbase/rust/mozrunner/src/runner.rs b/testing/mozbase/rust/mozrunner/src/runner.rs index 5d544029a0..3b5ff37f88 100644 --- a/testing/mozbase/rust/mozrunner/src/runner.rs +++ b/testing/mozbase/rust/mozrunner/src/runner.rs @@ -381,7 +381,6 @@ pub mod platform { #[cfg(target_os = "macos")] pub mod platform { use crate::path::{find_binary, is_app_bundle, is_binary}; - use dirs; use plist::Value; use std::path::PathBuf; -- cgit v1.2.3