From 159f674171e382663b89fd2b48ee08c6f76b0ba6 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 4 Mar 2024 09:03:50 -0700 Subject: rust_uprev: specify category for `equery w rust` `rust` now has many `cross-*` triples. Specifying the category allows portage to figure out which one is meant (even though they're all the same in this case, anyway :) ). BUG=b:324414750 TEST=ran the script Change-Id: I6b22c9c25e67e95f4e91714b55386dbd36f84d7e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5345429 Reviewed-by: Bob Haarman Tested-by: George Burgess Commit-Queue: George Burgess --- rust_tools/rust_uprev.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust_tools/rust_uprev.py b/rust_tools/rust_uprev.py index ee956137..76fe471f 100755 --- a/rust_tools/rust_uprev.py +++ b/rust_tools/rust_uprev.py @@ -1201,7 +1201,7 @@ def main() -> None: # Determine the template version, if not given. template_version = args.template if template_version is None: - rust_ebuild = find_ebuild_for_package("rust") + rust_ebuild = find_ebuild_for_package("dev-lang/rust") template_version = RustVersion.parse_from_ebuild(rust_ebuild) run_step("create new repo", lambda: create_new_repo(args.uprev)) -- cgit v1.2.3 From 423ae14da869adfc68f1d471cc61fd0135625dbd Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 4 Mar 2024 09:08:36 -0700 Subject: rust_uprev: skip fetching bootstrap tbz2 Other automation should make sure this exists when it can exist. As it stands, this check blocks Rust updates pretty early because an optimization in rust-bootstrap is still processing. That's probably not the trade-off we want. BUG=b:324414750 TEST=ran the script Change-Id: If6424033e7f4f75ffd0af9f68f93e3665f1e0cdf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5345430 Reviewed-by: Bob Haarman Commit-Queue: George Burgess Tested-by: George Burgess --- rust_tools/rust_uprev.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rust_tools/rust_uprev.py b/rust_tools/rust_uprev.py index 76fe471f..9845c7c7 100755 --- a/rust_tools/rust_uprev.py +++ b/rust_tools/rust_uprev.py @@ -204,10 +204,6 @@ def compute_rustc_src_name(version: RustVersion) -> str: return f"rustc-{version}-src.tar.gz" -def compute_rust_bootstrap_prebuilt_name(version: RustVersion) -> str: - return f"rust-bootstrap-{version}.tbz2" - - def find_ebuild_for_package(name: str) -> str: """Returns the path to the ebuild for the named package.""" return run_in_chroot( @@ -546,7 +542,6 @@ def fetch_bootstrap_distfiles(version: RustVersion) -> None: are available on the mirror and the local copies are the same as the ones on the mirror. """ - fetch_distfile_from_mirror(compute_rust_bootstrap_prebuilt_name(version)) fetch_distfile_from_mirror(compute_rustc_src_name(version)) -- cgit v1.2.3 From 1ea2d92fc136317a1904becce316e959010222a9 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 5 Mar 2024 07:52:33 -0700 Subject: pgo_rust: emerge `cross-*/rust` packages Without this, PGO benchmarking for other arches fails due to lack of similarly-configured Rust stdlibs. BUG=b:324414750 TEST=ran the script Change-Id: I949119c9538f68df3e1e8c7abb54d94874fa34f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5345431 Tested-by: George Burgess Reviewed-by: Bob Haarman Commit-Queue: George Burgess --- pgo_tools_rust/pgo_rust.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pgo_tools_rust/pgo_rust.py b/pgo_tools_rust/pgo_rust.py index ecf4f050..7d9e4f7b 100755 --- a/pgo_tools_rust/pgo_rust.py +++ b/pgo_tools_rust/pgo_rust.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 -# # Copyright 2022 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # pylint: disable=line-too-long + """Handle most aspects of creating and benchmarking PGO profiles for Rust. This is meant to be done at Rust uprev time. Ultimately profdata files need @@ -278,7 +278,6 @@ def build_rust( use_frontend_profile: bool = False, use_llvm_profile: bool = False, ): - if use_frontend_profile or use_llvm_profile: assert not generate_frontend_profile and not generate_llvm_profile, ( "Can't build a compiler to both use profile information " @@ -301,15 +300,20 @@ def build_rust( env_use = os.getenv("USE", "").rstrip() use = (env_use + " " + use).strip() + rust_cross_packages = [ + f"cross-{x}/rust" for x in TARGET_TRIPLES if "-pc-linux-" not in x + ] + # -E to preserve environment variables like USE, FEATURES, etc. run( [ "sudo", "-E", "emerge", + "-j", "dev-lang/rust-host", - "dev-lang/rust", - ], + ] + + rust_cross_packages, env={"USE": use}, ) -- cgit v1.2.3 From 7707b2c71530b8de5ee8e3ecada88825e4ceb12b Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 5 Mar 2024 09:14:33 -0700 Subject: auto_update_rust_bootstrap: gracefully handle multiple CLs This tool may upload multiple CLs at once if, say, it detects that a new Rust version has landed (which causes a new rust-bootstrap to be buildable, and likely causes old versions to be no longer needed). Handle that properly. BUG=b:327588669 TEST=Unittests Change-Id: Iaa4e444c6a79f99b35385dc95c0c3eed96cf96cb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5345809 Tested-by: George Burgess Reviewed-by: Bob Haarman Commit-Queue: George Burgess --- rust_tools/auto_update_rust_bootstrap.py | 41 ++++++++++++++------------- rust_tools/auto_update_rust_bootstrap_test.py | 34 ++++++++++++++++++++-- 2 files changed, 53 insertions(+), 22 deletions(-) diff --git a/rust_tools/auto_update_rust_bootstrap.py b/rust_tools/auto_update_rust_bootstrap.py index 09df9bdd..c41fcd03 100755 --- a/rust_tools/auto_update_rust_bootstrap.py +++ b/rust_tools/auto_update_rust_bootstrap.py @@ -377,17 +377,17 @@ def commit_all_changes( ) -def scrape_git_push_cl_id(git_push_output: str) -> int: +def scrape_git_push_cl_id_strs(git_push_output: str) -> List[str]: id_regex = re.compile( r"^remote:\s+https://chromium-review\S+/\+/(\d+)\s", re.MULTILINE ) results = id_regex.findall(git_push_output) - if len(results) != 1: + if not results: raise ValueError( - f"Found {len(results)} matches of {id_regex} in" - f"{git_push_output!r}; expected 1" + f"Found 0 matches of {id_regex} in {git_push_output!r}; expected " + "at least 1." ) - return int(results[0]) + return results def upload_changes(git_dir: Path): @@ -405,22 +405,25 @@ def upload_changes(git_dir: Path): print(result.stdout, end=None) result.check_returncode() - cl_id = str(scrape_git_push_cl_id(result.stdout)) - logging.info("Uploaded crrev.com/c/%s successfully!", cl_id) - gerrit_commands = ( - ["gerrit", "label-v", cl_id, "1"], - ["gerrit", "label-cq", cl_id, "1"], - ["gerrit", "label-as", cl_id, "1"], - ["gerrit", "reviewers", cl_id] + list(DEFAULT_CL_REVIEWERS), - ["gerrit", "ready", cl_id], + cl_ids = scrape_git_push_cl_id_strs(result.stdout) + logging.info( + "Uploaded %s successfully!", [f"crrev.com/c/{x}" for x in cl_ids] ) - for command in gerrit_commands: - logging.info("Running gerrit command: %s", command) - subprocess.run( - command, - check=True, - stdin=subprocess.DEVNULL, + for cl_id in cl_ids: + gerrit_commands = ( + ["gerrit", "label-v", cl_id, "1"], + ["gerrit", "label-cq", cl_id, "1"], + ["gerrit", "label-as", cl_id, "1"], + ["gerrit", "reviewers", cl_id] + list(DEFAULT_CL_REVIEWERS), + ["gerrit", "ready", cl_id], ) + for command in gerrit_commands: + logging.info("Running gerrit command: %s", command) + subprocess.run( + command, + check=True, + stdin=subprocess.DEVNULL, + ) def maybe_add_newest_prebuilts( diff --git a/rust_tools/auto_update_rust_bootstrap_test.py b/rust_tools/auto_update_rust_bootstrap_test.py index ea58e723..0578539d 100755 --- a/rust_tools/auto_update_rust_bootstrap_test.py +++ b/rust_tools/auto_update_rust_bootstrap_test.py @@ -5,7 +5,6 @@ """Tests for auto_update_rust_bootstrap.""" - import os from pathlib import Path import shutil @@ -36,6 +35,26 @@ To https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay * [new reference] HEAD -> refs/for/main """ +_GIT_PUSH_MULTI_CL_OUTPUT = r""" +remote: Waiting for private key checker: 2/2 objects left +remote: +remote: Processing changes: new: 1 (\) +remote: Processing changes: new: 1 (|) +remote: Processing changes: new: 1 (/) +remote: Processing changes: refs: 1, new: 1 (/) +remote: Processing changes: refs: 1, new: 1 (/) +remote: Processing changes: refs: 1, new: 1 (/) +remote: Processing changes: refs: 1, new: 1, done +remote: +remote: SUCCESS +remote: +remote: https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/5339923 rust-bootstrap: add version 1.75.0 [NEW] +remote: https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/5339924 rust-bootstrap: remove unused ebuilds [NEW] +remote: +To https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay + * [new reference] HEAD -> refs/for/main +""" + class Test(unittest.TestCase): """Tests for auto_update_rust_bootstrap.""" @@ -49,8 +68,17 @@ class Test(unittest.TestCase): def test_git_cl_id_scraping(self): self.assertEqual( - auto_update_rust_bootstrap.scrape_git_push_cl_id(_GIT_PUSH_OUTPUT), - 5018826, + auto_update_rust_bootstrap.scrape_git_push_cl_id_strs( + _GIT_PUSH_OUTPUT + ), + ["5018826"], + ) + + self.assertEqual( + auto_update_rust_bootstrap.scrape_git_push_cl_id_strs( + _GIT_PUSH_MULTI_CL_OUTPUT + ), + ["5339923", "5339924"], ) def test_ebuild_linking_logic_handles_direct_relative_symlinks(self): -- cgit v1.2.3 From 84141e2b6d1b00eaf820ec2128980ad94dfa3416 Mon Sep 17 00:00:00 2001 From: mobiletc-prebuild Date: Mon, 11 Mar 2024 08:00:22 -0700 Subject: compiler_wrapper: automatic sync This CL automatically brings toolchain-utils' compiler_wrapper/ directory in sync with chromiumos-overlay's. Please see go/crostc-repo/+/main:sync_compiler_wrapper_within_cros.sh for more info on this process. BUG=None TEST=None Change-Id: I81b8f6c5c407b414f647f525fffd6fd7bcc446e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5359381 Commit-Queue: George Burgess Tested-by: mobiletc-prebuild Role Account Auto-Submit: mobiletc-prebuild Role Account Reviewed-by: George Burgess --- compiler_wrapper/README.md | 35 ++++++- compiler_wrapper/compiler_wrapper.go | 25 +---- compiler_wrapper/compiler_wrapper_test.go | 33 +++---- compiler_wrapper/iwyu_flag.go | 158 ------------------------------ compiler_wrapper/iwyu_flag_test.go | 136 ------------------------- 5 files changed, 49 insertions(+), 338 deletions(-) delete mode 100644 compiler_wrapper/iwyu_flag.go delete mode 100644 compiler_wrapper/iwyu_flag_test.go diff --git a/compiler_wrapper/README.md b/compiler_wrapper/README.md index 7a05c818..38ff8a65 100644 --- a/compiler_wrapper/README.md +++ b/compiler_wrapper/README.md @@ -2,12 +2,9 @@ Copyright 2023 The ChromiumOS Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. +### What Toolchain utils compiler wrapper sources. -Build the wrapper: -./build.py --config= --use_ccache= \ - --use_llvm_next= --output_file= - Please note that there's a regular syncing operation between `chromiumos-overlay/sys-devel/llvm/files/compiler_wrapper` and `toolchain-utils/compiler_wrapper`. This sync is one way (from @@ -15,3 +12,33 @@ chromiumos-overlay to `toolchain-utils`). Syncing in this way helps the Android toolchain keep up-to-date with our wrapper easily, as they're a downstream consumer of it. For this reason, **please be sure to land all actual changes in chromeos-overlay**. + +### Build + Run Tests +1. Install the wrapper locally in chroot (builds as well) +``` +(chroot) ./install_compiler_wrapper.sh +``` + +#### Running a manual test +Test a manual build command with `-print-cmdline` +``` +(chroot) x86_64-cros-linux-gnu-clang++ -o test_exec -f='some_value' -print-cmdline test.cc +``` +- `test.cc` doesn't actually have to exist. +- The command above will output the additional build flags that are added in by the wrapper. + +#### Testing your changes +1. Add tests to your wrapper changes +1. Run all the tests via: +``` +go test -vet=all +``` + +### Build Only +This is handy if you just want to test that the build works. + +Build the wrapper: +``` +./build.py --config= --use_ccache= \ + --use_llvm_next= --output_file= + ``` diff --git a/compiler_wrapper/compiler_wrapper.go b/compiler_wrapper/compiler_wrapper.go index 22109e3c..7f2c8d11 100644 --- a/compiler_wrapper/compiler_wrapper.go +++ b/compiler_wrapper/compiler_wrapper.go @@ -168,8 +168,7 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int return 0, newErrorwithSourceLocf("unsupported compiler: %s", mainBuilder.target.compiler) } } else { - _, tidyFlags, tidyMode := processClangTidyFlags(mainBuilder) - cSrcFile, iwyuFlags, iwyuMode := processIWYUFlags(mainBuilder) + cSrcFile, tidyFlags, tidyMode := processClangTidyFlags(mainBuilder) crashArtifactsDir := detectCrashArtifactsDir(env, cfg) if mainBuilder.target.compilerType == clangType { err := prepareClangCommand(crashArtifactsDir, mainBuilder) @@ -200,19 +199,6 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int } } - if iwyuMode != iwyuModeNone { - if iwyuMode == iwyuModeError { - panic("Unknown IWYU mode") - } - - allowCCache = false - clangCmdWithoutRemoteBuildAndCCache := mainBuilder.build() - err := runIWYU(env, clangCmdWithoutRemoteBuildAndCCache, cSrcFile, iwyuFlags) - if err != nil { - return 0, err - } - } - if remoteBuildUsed, err = processRemoteBuildAndCCacheFlags(allowCCache, mainBuilder); err != nil { return 0, err } @@ -350,9 +336,9 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int } } -func hasFlag(flag string, flagList ...string) bool { - for _, flagVal := range flagList { - if strings.Contains(flagVal, flag) { +func hasUserArg(argName string, builder *commandBuilder) bool { + for _, argValue := range builder.args { + if strings.Contains(argValue.value, argName) && argValue.fromUser { return true } } @@ -367,8 +353,7 @@ func prepareClangCommand(crashArtifactsDir string, builder *commandBuilder) (err var crashDiagFlagName = "-fcrash-diagnostics-dir" if crashArtifactsDir != "" && - !hasFlag(crashDiagFlagName, builder.cfg.clangFlags...) && - !hasFlag(crashDiagFlagName, builder.cfg.clangPostFlags...) { + !hasUserArg(crashDiagFlagName, builder) { builder.addPreUserArgs(crashDiagFlagName + "=" + crashArtifactsDir) } diff --git a/compiler_wrapper/compiler_wrapper_test.go b/compiler_wrapper/compiler_wrapper_test.go index 2cace6e9..79edab6e 100644 --- a/compiler_wrapper/compiler_wrapper_test.go +++ b/compiler_wrapper/compiler_wrapper_test.go @@ -253,45 +253,38 @@ func TestCalculateAndroidWrapperPath(t *testing.T) { } } -// If "crash-diagnostics-dir" flag is already provided, only use that flag and don't add a dupe -func TestCrashDiagPreFlag(t *testing.T) { +// If "crash-diagnostics-dir" flag is not provided, add one in +func TestCrashDiagDefault(t *testing.T) { withTestContext(t, func(ctx *testContext) { - ctx.cfg.clangFlags = []string{"-fcrash-diagnostics-dir=/build/something/foo"} ctx.env = []string{ "CROS_ARTIFACTS_TMP_DIR=/tmp/foo", } cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(clangX86_64, mainCc))) - if err := verifyArgCount(cmd, 1, "-fcrash-diagnostics-dir=/build/something/foo"); err != nil { + + // Verify that we added the default flag + if err := verifyArgCount(cmd, 1, "-fcrash-diagnostics-dir=/tmp/foo/toolchain/clang_crash_diagnostics"); err != nil { t.Error(err) } }) } -// If "crash-diagnostics-dir" flag is already provided, only use that flag and don't add a dupe -func TestCrashDiagPostFlag(t *testing.T) { +// If "crash-diagnostics-dir" flag is already provided by the user, only use that flag and don't add a dupe +func TestCrashDiagUserFlag(t *testing.T) { withTestContext(t, func(ctx *testContext) { - ctx.cfg.clangPostFlags = []string{"-fcrash-diagnostics-dir=/build/something/foo"} ctx.env = []string{ "CROS_ARTIFACTS_TMP_DIR=/tmp/foo", } cmd := ctx.must(callCompiler(ctx, ctx.cfg, - ctx.newCommand(clangX86_64, mainCc))) - if err := verifyArgCount(cmd, 1, "-fcrash-diagnostics-dir=/build/something/foo"); err != nil { + ctx.newCommand(clangX86_64, mainCc, "-fcrash-diagnostics-dir=/build/something/foozz"))) + + // Verify that user flag is not removed + if err := verifyArgCount(cmd, 1, "-fcrash-diagnostics-dir=/build/something/foozz"); err != nil { t.Error(err) } - }) -} -// If "crash-diagnostics-dir" flag is not provided, add one in -func TestCrashDiagDefault(t *testing.T) { - withTestContext(t, func(ctx *testContext) { - ctx.env = []string{ - "CROS_ARTIFACTS_TMP_DIR=/tmp/foo", - } - cmd := ctx.must(callCompiler(ctx, ctx.cfg, - ctx.newCommand(clangX86_64, mainCc))) - if err := verifyArgCount(cmd, 1, "-fcrash-diagnostics-dir=/tmp/foo/toolchain/clang_crash_diagnostics"); err != nil { + // Verify that we did not add the default flag + if err := verifyArgCount(cmd, 0, "-fcrash-diagnostics-dir=/tmp/foo/toolchain/clang_crash_diagnostics"); err != nil { t.Error(err) } }) diff --git a/compiler_wrapper/iwyu_flag.go b/compiler_wrapper/iwyu_flag.go deleted file mode 100644 index 5788d8c7..00000000 --- a/compiler_wrapper/iwyu_flag.go +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright 2022 The ChromiumOS Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package main - -import ( - "bufio" - "bytes" - "fmt" - "os" - "path/filepath" - "strings" -) - -type useIWYUMode int - -const ( - iwyuModeNone useIWYUMode = iota - iwyuModeAll - iwyuModeError -) - -var srcFileSuffixes = []string{ - ".c", - ".cc", - ".cpp", - ".C", - ".cxx", - ".c++", -} - -func findWithIWYUFlag(args []builderArg) (string, []builderArg) { - for i := range args { - if args[i].value == "--with-iwyu" { - args = append(args[:i], args[i+1:]...) - return "1", args - } - } - return "", args -} - -func processIWYUFlags(builder *commandBuilder) (cSrcFile string, iwyuFlags []string, mode useIWYUMode) { - builder.transformArgs(func(arg builderArg) string { - const prefix = "-iwyu-flag=" - if !strings.HasPrefix(arg.value, prefix) { - return arg.value - } - - iwyuFlags = append(iwyuFlags, arg.value[len(prefix):]) - return "" - }) - - cSrcFile = "" - lastArg := "" - for _, arg := range builder.args { - if lastArg != "-o" { - for _, suffix := range srcFileSuffixes { - if strings.HasSuffix(arg.value, suffix) { - cSrcFile = arg.value - break - } - } - } - lastArg = arg.value - } - - if cSrcFile == "" { - return "", iwyuFlags, iwyuModeNone - } - - withIWYU, _ := builder.env.getenv("WITH_IWYU") - if withIWYU == "" { - withIWYU, builder.args = findWithIWYUFlag(builder.args) - if withIWYU == "" { - return cSrcFile, iwyuFlags, iwyuModeNone - } - } - - if withIWYU != "1" { - return cSrcFile, iwyuFlags, iwyuModeError - } - - return cSrcFile, iwyuFlags, iwyuModeAll -} - -func calcIWYUInvocation(env env, clangCmd *command, cSrcFile string, iwyuFlags ...string) (*command, error) { - resourceDir, err := getClangResourceDir(env, clangCmd.Path) - if err != nil { - return nil, err - } - - iwyuPath := filepath.Join(filepath.Dir(clangCmd.Path), "include-what-you-use") - args := append([]string{}, iwyuFlags...) - args = append(args, "-resource-dir="+resourceDir) - args = append(args, clangCmd.Args...) - - for i := 0; i < len(args); i++ { - for j := 0; j < len(srcFileSuffixes); j++ { - if strings.HasSuffix(args[i], srcFileSuffixes[j]) { - args = append(args[:i], args[i+1:]...) - break - } - } - } - args = append(args, cSrcFile) - - return &command{ - Path: iwyuPath, - Args: args, - EnvUpdates: clangCmd.EnvUpdates, - }, nil -} - -func runIWYU(env env, clangCmd *command, cSrcFile string, extraIWYUFlags []string) error { - extraIWYUFlags = append(extraIWYUFlags, "-Xiwyu", "--mapping_file=/usr/share/include-what-you-use/libcxx.imp", "-Xiwyu", "--no_fwd_decls") - iwyuCmd, err := calcIWYUInvocation(env, clangCmd, cSrcFile, extraIWYUFlags...) - if err != nil { - return fmt.Errorf("calculating include-what-you-use invocation: %v", err) - } - - // Note: We pass nil as stdin as we checked before that the compiler - // was invoked with a source file argument. - var stderr bytes.Buffer - stderrWriter := bufio.NewWriter(&stderr) - exitCode, err := wrapSubprocessErrorWithSourceLoc(iwyuCmd, - env.run(iwyuCmd, nil, nil, stderrWriter)) - stderrMessage := stderr.String() - fmt.Fprintln(env.stderr(), stderrMessage) - - if err == nil && exitCode != 0 { - // Note: We continue on purpose when include-what-you-use fails - // to maintain compatibility with the previous wrapper. - fmt.Fprintln(env.stderr(), "include-what-you-use failed") - } - - iwyuDir := filepath.Join(getCompilerArtifactsDir(env), "linting-output", "iwyu") - if err := os.MkdirAll(iwyuDir, 0777); err != nil { - return fmt.Errorf("creating fixes directory at %q: %v", iwyuDir, err) - } - - f, err := os.CreateTemp(iwyuDir, "*.out") - if err != nil { - return fmt.Errorf("making output file for iwyu: %v", err) - } - writer := bufio.NewWriter(f) - if _, err := writer.WriteString(stderrMessage); err != nil { - return fmt.Errorf("writing output file for iwyu: %v", err) - } - if err := writer.Flush(); err != nil { - return fmt.Errorf("flushing output file buffer for iwyu: %v", err) - } - if err := f.Close(); err != nil { - return fmt.Errorf("finalizing output file for iwyu: %v", err) - } - - return err -} diff --git a/compiler_wrapper/iwyu_flag_test.go b/compiler_wrapper/iwyu_flag_test.go deleted file mode 100644 index e2db3b48..00000000 --- a/compiler_wrapper/iwyu_flag_test.go +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2022 The ChromiumOS Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package main - -import ( - "errors" - "io" - "strings" - "testing" -) - -func TestIWYUArgOrder(t *testing.T) { - withIWYUTestContext(t, func(ctx *testContext) { - ctx.cmdMock = func(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { - if ctx.cmdCount == 2 { - if err := verifyArgOrder(cmd, "-checks=.*", mainCc, "--", "-resource-dir=.*", mainCc, "--some_arg"); err != nil { - return err - } - } - return nil - } - ctx.must(callCompiler(ctx, ctx.cfg, - ctx.newCommand(clangX86_64, mainCc, "--some_arg"))) - if ctx.cmdCount < 2 { - t.Error("expected multiple calls.") - } - }) -} - -func TestIgnoreNonZeroExitCodeFromIWYU(t *testing.T) { - withIWYUTestContext(t, func(ctx *testContext) { - ctx.cmdMock = func(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { - if ctx.cmdCount == 2 { - return newExitCodeError(23) - } - return nil - } - ctx.must(callCompiler(ctx, ctx.cfg, - ctx.newCommand(clangX86_64, mainCc))) - stderr := ctx.stderrString() - if err := verifyNonInternalError(stderr, "include-what-you-use failed"); err != nil { - t.Error(err) - } - }) -} - -func TestReportGeneralErrorsFromIWYU(t *testing.T) { - withIWYUTestContext(t, func(ctx *testContext) { - ctx.cmdMock = func(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { - if ctx.cmdCount > 1 { - return errors.New("someerror") - } - return nil - } - stderr := ctx.mustFail(callCompiler(ctx, ctx.cfg, - ctx.newCommand(clangX86_64, mainCc))) - if err := verifyInternalError(stderr); err != nil { - t.Fatal(err) - } - if !strings.Contains(stderr, "someerror") { - t.Errorf("unexpected error. Got: %s", stderr) - } - }) -} - -func TestUseIWYUBasedOnFileExtension(t *testing.T) { - withIWYUTestContext(t, func(ctx *testContext) { - testData := []struct { - args []string - iwyu bool - }{ - {[]string{"main.cc"}, true}, - {[]string{"main.cc"}, true}, - {[]string{"main.C"}, true}, - {[]string{"main.cxx"}, true}, - {[]string{"main.c++"}, true}, - {[]string{"main.xy"}, false}, - {[]string{"-o", "main.cc"}, false}, - {[]string{}, false}, - } - for _, tt := range testData { - ctx.cmdCount = 0 - ctx.must(callCompiler(ctx, ctx.cfg, - ctx.newCommand(clangX86_64, tt.args...))) - if ctx.cmdCount == 2 && !tt.iwyu { - t.Errorf("expected a call to iwyu but got none for args %s", tt.args) - } - if ctx.cmdCount == 1 && tt.iwyu { - t.Errorf("expected no call to iwyu but got one for args %s", tt.args) - } - } - }) -} - -func TestIWYUFiltersIWYUFlags(t *testing.T) { - withIWYUTestContext(t, func(ctx *testContext) { - addedFlag := "--some_iwyu_flag=flag" - ctx.cmdMock = func(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { - switch ctx.cmdCount { - case 1: - if err := verifyPath(cmd, "usr/bin/clang"); err != nil { - t.Error(err) - } else if err := verifyArgCount(cmd, 0, addedFlag); err != nil { - t.Error(err) - } - return nil - case 2: - if err := verifyPath(cmd, "usr/bin/include-what-you-use"); err != nil { - t.Error(err) - } else if verifyArgCount(cmd, 1, addedFlag); err != nil { - t.Error(err) - } - return nil - default: - return nil - } - } - cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(clangX86_64, mainCc, "-iwyu-flag="+addedFlag))) - if ctx.cmdCount < 2 { - t.Errorf("expected multiple calls.") - } - if err := verifyPath(cmd, "usr/bin/clang"); err != nil { - t.Error(err) - } - }) -} - -func withIWYUTestContext(t *testing.T, work func(ctx *testContext)) { - withTestContext(t, func(ctx *testContext) { - artifactDir := t.TempDir() - ctx.env = []string{"WITH_IWYU=1", "CROS_ARTIFACTS_TMP_DIR=" + artifactDir} - work(ctx) - }) -} -- cgit v1.2.3 From db4d68ea10ff3b299d92fb4fbf90cea8082b0d61 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 11 Mar 2024 13:52:28 -0600 Subject: afdo_tools: fix script output for stable channel We only search the current branch number for profiles on stable. Don't print that we searched other branches. BUG=b:322182978 TEST=Ran the script; error message is now more accurate Change-Id: I1bca9a0324a2ee694ea480938562b826f8ea25eb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5362319 Tested-by: George Burgess Commit-Queue: George Burgess Reviewed-by: Ryan Beltran --- afdo_tools/update_kernel_afdo | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/afdo_tools/update_kernel_afdo b/afdo_tools/update_kernel_afdo index 6bfa53fa..26cfff55 100755 --- a/afdo_tools/update_kernel_afdo +++ b/afdo_tools/update_kernel_afdo @@ -257,8 +257,14 @@ do fi if [[ -z "${latest}" ]] then - echo "ERROR: No M${curr_branch_number}, M${prev_branch} profiles in\ + if [[ "${channel}" == "stable" ]] + then + echo "ERROR: No M${curr_branch_number} profiles in\ + ${arch_gsbase[${arch}]}/${kver}/" >&2 + else + echo "ERROR: No M${curr_branch_number}, M${prev_branch} profiles in\ ${arch_gsbase[${arch}]}/${kver}/" >&2 + fi echo "Skipping ${arch}/${kver}" >&2 errs="${errs} ${kver}" continue -- cgit v1.2.3 From e28af8e16fee2c8f155fcb2868d315c3c53b0f38 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 11 Mar 2024 15:53:05 -0600 Subject: update_kernel_afdo: roll for kernels 6.6 and 6.1 BUG=b:329139584 TEST=Ran the script (with hacks so it sources this file) Change-Id: I52c1b55fb6dea99b9083f26433e20f9f0816cbfc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5362329 Reviewed-by: Ryan Beltran Commit-Queue: George Burgess Tested-by: George Burgess --- afdo_tools/update_kernel_afdo.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afdo_tools/update_kernel_afdo.cfg b/afdo_tools/update_kernel_afdo.cfg index 821c9c1f..9124c345 100644 --- a/afdo_tools/update_kernel_afdo.cfg +++ b/afdo_tools/update_kernel_afdo.cfg @@ -2,7 +2,7 @@ # All changes here won't affect kernel afdo update in branches. # WARNING: Changes must be submitted to have effect. -AMD_KVERS="5.4 5.10 5.15" +AMD_KVERS="5.4 5.10 5.15 6.1 6.6" ARM_KVERS="5.15" AMD_METADATA_FILE="afdo_metadata/kernel_afdo.json" ARM_METADATA_FILE="afdo_metadata/kernel_arm_afdo.json" -- cgit v1.2.3 From ddbd42cfc7d73ffe281ecd3f662bdc6cdf3175dc Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 11 Mar 2024 10:27:48 -0600 Subject: llvm_tools: s/chroot_path/chromeos_path This path talks about a ChromeOS source tree, not a chroot. The flag should reflect that. I had to change a few scripts simultaneously, since these all depend on `test_helpers` for `chroot_path`. BUG=b:325884106, b:325895866 TEST=Unittests Change-Id: Ie6e8a5ca62257e6b2b49f0a688d06da45715f50c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5360712 Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: George Burgess Tested-by: George Burgess --- llvm_tools/README.md | 4 +- llvm_tools/auto_llvm_bisection.py | 8 ++-- llvm_tools/copy_helpers_to_chromiumos_overlay.py | 6 +-- llvm_tools/get_upstream_patch.py | 23 +++++---- llvm_tools/llvm_bisection.py | 12 ++--- llvm_tools/llvm_bisection_unittest.py | 6 +-- llvm_tools/modify_a_tryjob.py | 29 ++++++------ llvm_tools/modify_a_tryjob_unittest.py | 16 +++---- llvm_tools/test_helpers.py | 2 +- llvm_tools/update_chromeos_llvm_hash.py | 50 ++++++++++---------- llvm_tools/update_chromeos_llvm_hash_unittest.py | 36 +++++++-------- llvm_tools/update_packages_and_run_tests.py | 51 ++++++++++---------- .../update_packages_and_run_tests_unittest.py | 54 +++++++++++----------- 13 files changed, 149 insertions(+), 148 deletions(-) diff --git a/llvm_tools/README.md b/llvm_tools/README.md index 8d0ff58c..f556c8a0 100644 --- a/llvm_tools/README.md +++ b/llvm_tools/README.md @@ -244,7 +244,7 @@ $ ./auto_llvm_bisection.py --start_rev 369410 --end_rev 369420 \ --last_tested /abs/path/to/last_tested_file.json \ --extra_change_lists 513590 1394249 \ --options latest-toolchain nochromesdk \ - --chroot_path /path/to/chromeos/chroot \ + --chromeos_path /path/to/chromeos/chroot \ --builder eve-release-tryjob ``` @@ -449,7 +449,7 @@ of commits as well as differential reviews. Usage: ``` -./get_upstream_patch.py --chroot_path /abs/path/to/chroot --start_sha llvm +./get_upstream_patch.py --chromeos_path /abs/path/to/chroot --start_sha llvm --sha 174c3eb69f19ff2d6a3eeae31d04afe77e62c021 --sha 174c3eb69f19ff2d6a3eeae31d04afe77e62c021 --differential D123456 ``` diff --git a/llvm_tools/auto_llvm_bisection.py b/llvm_tools/auto_llvm_bisection.py index d94b6f0b..2b4f6f99 100755 --- a/llvm_tools/auto_llvm_bisection.py +++ b/llvm_tools/auto_llvm_bisection.py @@ -58,7 +58,7 @@ builder_status_mapping = { } -def GetBuildResult(chroot_path, buildbucket_id): +def GetBuildResult(chromeos_path, buildbucket_id): """Returns the conversion of the result of 'cros buildresult'.""" # Calls 'cros buildresult' to get the status of the tryjob. @@ -72,7 +72,7 @@ def GetBuildResult(chroot_path, buildbucket_id): "--report", "json", ], - cwd=chroot_path, + cwd=chromeos_path, stderr=subprocess.STDOUT, encoding="utf-8", ) @@ -105,7 +105,7 @@ def main(): args_output = llvm_bisection.GetCommandLineArgs() - chroot.VerifyChromeOSRoot(args_output.chroot_path) + chroot.VerifyChromeOSRoot(args_output.chromeos_path) if os.path.isfile(args_output.last_tested): print("Resuming bisection for %s" % args_output.last_tested) @@ -132,7 +132,7 @@ def main(): == update_tryjob_status.TryjobStatus.PENDING.value ): status = GetBuildResult( - args_output.chroot_path, tryjob["buildbucket_id"] + args_output.chromeos_path, tryjob["buildbucket_id"] ) if status: tryjob["status"] = status diff --git a/llvm_tools/copy_helpers_to_chromiumos_overlay.py b/llvm_tools/copy_helpers_to_chromiumos_overlay.py index 18510a43..59a664d5 100755 --- a/llvm_tools/copy_helpers_to_chromiumos_overlay.py +++ b/llvm_tools/copy_helpers_to_chromiumos_overlay.py @@ -27,7 +27,7 @@ def _find_repo_root(script_root): def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( - "--chroot_path", + "--chromeos_path", help="Path to where CrOS' source tree lives. Will autodetect if you're " "running this from inside the CrOS source tree.", ) @@ -35,13 +35,13 @@ def main(): my_dir = os.path.abspath(os.path.dirname(__file__)) - repo_root = args.chroot_path + repo_root = args.chromeos_path if repo_root is None: repo_root = _find_repo_root(my_dir) if repo_root is None: sys.exit( "Couldn't detect the CrOS checkout root; please provide a " - "value for --chroot_path" + "value for --chromeos_path" ) chromiumos_overlay = os.path.join( diff --git a/llvm_tools/get_upstream_patch.py b/llvm_tools/get_upstream_patch.py index 52634cd9..18b08b00 100755 --- a/llvm_tools/get_upstream_patch.py +++ b/llvm_tools/get_upstream_patch.py @@ -26,7 +26,7 @@ import patch_utils __DOC_EPILOGUE = """ Example Usage: - get_upstream_patch --chroot_path ~/chromiumos --platform chromiumos \ + get_upstream_patch --chromeos_path ~/chromiumos --platform chromiumos \ --sha 1234567 --sha 890abdc """ @@ -320,7 +320,7 @@ def resolve_symbolic_sha(start_sha: str, llvm_symlink_dir: str) -> str: def find_patches_and_make_cl( - chroot_path: str, + chromeos_path: str, patches: t.List[str], start_rev: git_llvm_rev.Rev, llvm_config: git_llvm_rev.LLVMConfig, @@ -360,14 +360,14 @@ def find_patches_and_make_cl( packages = get_package_names(parsed_patch.sha, llvm_config.dir) # Find out the ebuild of the corresponding ChromeOS packages ebuild_paths = chroot.GetChrootEbuildPaths( - chroot_path, + chromeos_path, [ "sys-devel/llvm" if package == "llvm" else "sys-libs/" + package for package in packages ], ) ebuild_paths = chroot.ConvertChrootPathsToAbsolutePaths( - chroot_path, ebuild_paths + chromeos_path, ebuild_paths ) # Create a local patch for all the affected llvm projects try: @@ -390,7 +390,6 @@ def find_patches_and_make_cl( successes.append(parsed_patch.sha) if create_cl: - commit_messages.extend( [ parsed_patch.git_msg(), @@ -492,7 +491,7 @@ def _get_duplicate_shas( def get_from_upstream( - chroot_path: str, + chromeos_path: str, create_cl: bool, start_sha: str, patches: t.List[str], @@ -503,8 +502,8 @@ def get_from_upstream( cc: t.Optional[t.List[str]] = None, ): llvm_symlink = chroot.ConvertChrootPathsToAbsolutePaths( - chroot_path, - chroot.GetChrootEbuildPaths(chroot_path, ["sys-devel/llvm"]), + chromeos_path, + chroot.GetChrootEbuildPaths(chromeos_path, ["sys-devel/llvm"]), )[0] llvm_symlink_dir = os.path.dirname(llvm_symlink) @@ -525,7 +524,7 @@ def get_from_upstream( start_sha = resolve_llvm_ref(llvm_config.dir, start_sha) find_patches_and_make_cl( - chroot_path=chroot_path, + chromeos_path=chromeos_path, patches=patches, platforms=platforms, start_rev=git_llvm_rev.translate_sha_to_rev(llvm_config, start_sha), @@ -555,7 +554,7 @@ def main(): epilog=__DOC_EPILOGUE, ) parser.add_argument( - "--chroot_path", + "--chromeos_path", default=os.path.join(os.path.expanduser("~"), "chromiumos"), help="the path to the chroot (default: %(default)s)", ) @@ -604,7 +603,7 @@ def main(): "when --differential appears exactly once.", ) args = parser.parse_args() - chroot.VerifyChromeOSRoot(args.chroot_path) + chroot.VerifyChromeOSRoot(args.chromeos_path) if not (args.sha or args.differential): parser.error("--sha or --differential required") @@ -616,7 +615,7 @@ def main(): ) get_from_upstream( - chroot_path=args.chroot_path, + chromeos_path=args.chromeos_path, allow_failures=args.allow_failures, create_cl=args.create_cl, start_sha=args.start_sha, diff --git a/llvm_tools/llvm_bisection.py b/llvm_tools/llvm_bisection.py index 2c5bc1a6..336d4334 100755 --- a/llvm_tools/llvm_bisection.py +++ b/llvm_tools/llvm_bisection.py @@ -115,7 +115,7 @@ def GetCommandLineArgs(): # Add argument for a specific chroot path. parser.add_argument( - "--chroot_path", + "--chromeos_path", default=cros_root, help="the path to the chroot (default: %(default)s)", ) @@ -279,7 +279,7 @@ def Bisect( bisect_state, last_tested, update_packages, - chroot_path, + chromeos_path, extra_change_lists, options, builder, @@ -292,7 +292,7 @@ def Bisect( update_packages, git_hash, svn_revision, - chroot_path, + chromeos_path, extra_change_lists, options, builder, @@ -333,7 +333,7 @@ def main(args_output): """ chroot.VerifyOutsideChroot() - chroot.VerifyChromeOSRoot(args_output.chroot_path) + chroot.VerifyChromeOSRoot(args_output.chromeos_path) start = args_output.start_rev end = args_output.end_rev @@ -410,7 +410,7 @@ def main(args_output): if args_output.cleanup: # Abandon all the CLs created for bisection gerrit = os.path.join( - args_output.chroot_path, "chromite/bin/gerrit" + args_output.chromeos_path, "chromite/bin/gerrit" ) for build in bisect_state["jobs"]: try: @@ -439,7 +439,7 @@ def main(args_output): bisect_state, args_output.last_tested, update_chromeos_llvm_hash.DEFAULT_PACKAGES, - args_output.chroot_path, + args_output.chromeos_path, args_output.extra_change_lists, args_output.options, args_output.builder, diff --git a/llvm_tools/llvm_bisection_unittest.py b/llvm_tools/llvm_bisection_unittest.py index 1c1c8166..273a4c9b 100755 --- a/llvm_tools/llvm_bisection_unittest.py +++ b/llvm_tools/llvm_bisection_unittest.py @@ -247,7 +247,7 @@ class LLVMBisectionTest(unittest.TestCase): bisection_contents, temp_json_file, packages, - args_output.chroot_path, + args_output.chromeos_path, args_output.extra_change_lists, args_output.options, args_output.builders, @@ -321,7 +321,7 @@ class LLVMBisectionTest(unittest.TestCase): args_output.end_rev = end args_output.parallel = 3 args_output.src_path = None - args_output.chroot_path = "somepath" + args_output.chromeos_path = "somepath" args_output.cleanup = True self.assertEqual( @@ -345,7 +345,7 @@ class LLVMBisectionTest(unittest.TestCase): mock.call( [ os.path.join( - args_output.chroot_path, "chromite/bin/gerrit" + args_output.chromeos_path, "chromite/bin/gerrit" ), "abandon", str(cl), diff --git a/llvm_tools/modify_a_tryjob.py b/llvm_tools/modify_a_tryjob.py index e5b583c3..a1fd4cbf 100755 --- a/llvm_tools/modify_a_tryjob.py +++ b/llvm_tools/modify_a_tryjob.py @@ -93,7 +93,7 @@ def GetCommandLineArgs() -> argparse.Namespace: # Add argument for a specific chroot path. parser.add_argument( - "--chroot_path", + "--chromeos_path", default=cros_root, help="the path to the chroot (default: %(default)s)", ) @@ -128,7 +128,7 @@ def GetCLAfterUpdatingPackages( packages: Iterable[str], git_hash: str, svn_version: int, - chroot_path: Union[Path, str], + chromeos_path: Union[Path, str], svn_option: Union[int, str], ) -> git.CommitContents: """Updates the packages' LLVM_NEXT.""" @@ -139,7 +139,7 @@ def GetCLAfterUpdatingPackages( llvm_variant=update_chromeos_llvm_hash.LLVMVariant.next, git_hash=git_hash, svn_version=svn_version, - chroot_path=Path(chroot_path), + chromeos_path=Path(chromeos_path), mode=failure_modes.FailureModes.DISABLE_PATCHES, git_hash_source=svn_option, extra_commit_msg_lines=None, @@ -160,7 +160,7 @@ def CreateNewTryjobEntryForBisection( extra_cls: List[int], options: List[str], builder: str, - chroot_path: Union[Path, str], + chromeos_path: Union[Path, str], cl_url: str, revision, ) -> Dict: @@ -178,7 +178,7 @@ def CreateNewTryjobEntryForBisection( # } # ] tryjob_results = update_packages_and_run_tests.RunTryJobs( - cl, extra_cls, options, [builder], chroot_path + cl, extra_cls, options, [builder], chromeos_path ) print("\nTryjob:") print(tryjob_results[0]) @@ -198,7 +198,7 @@ def AddTryjob( packages: Iterable[str], git_hash: str, revision: int, - chroot_path: Union[Path, str], + chromeos_path: Union[Path, str], extra_cls: List[int], options: List[str], builder: str, @@ -210,7 +210,7 @@ def AddTryjob( packages, git_hash, revision, - chroot_path, + chromeos_path, svn_option, ) @@ -219,7 +219,7 @@ def AddTryjob( extra_cls, options, builder, - chroot_path, + chromeos_path, change_list.url, revision, ) @@ -234,7 +234,7 @@ def PerformTryjobModification( extra_cls: List[int], options: List[str], builder: str, - chroot_path: Union[Path, str], + chromeos_path: Union[Path, str], ) -> None: """Removes, relaunches, or adds a tryjob. @@ -246,8 +246,7 @@ def PerformTryjobModification( extra_cls: Extra change lists to be run alongside tryjob options: Extra options to pass into 'cros tryjob'. builder: The builder to use for 'cros tryjob'. - chroot_path: The absolute path to the chroot (used by 'cros tryjob' - when relaunching a tryjob). + chromeos_path: The absolute path to the chromeos checkout. """ # Format of 'bisect_contents': @@ -289,7 +288,7 @@ def PerformTryjobModification( bisect_contents["jobs"][tryjob_index]["extra_cls"], bisect_contents["jobs"][tryjob_index]["options"], bisect_contents["jobs"][tryjob_index]["builder"], - chroot_path, + chromeos_path, ) bisect_contents["jobs"][tryjob_index][ @@ -326,7 +325,7 @@ def PerformTryjobModification( update_chromeos_llvm_hash.DEFAULT_PACKAGES, git_hash, revision, - chroot_path, + chromeos_path, extra_cls, options, builder, @@ -356,7 +355,7 @@ def main() -> None: args_output = GetCommandLineArgs() - chroot.VerifyChromeOSRoot(args_output.chroot_path) + chroot.VerifyChromeOSRoot(args_output.chromeos_path) PerformTryjobModification( args_output.revision, @@ -365,7 +364,7 @@ def main() -> None: args_output.extra_change_lists, args_output.options, args_output.builder, - args_output.chroot_path, + args_output.chromeos_path, ) diff --git a/llvm_tools/modify_a_tryjob_unittest.py b/llvm_tools/modify_a_tryjob_unittest.py index 8b72ffd7..0f693dc3 100755 --- a/llvm_tools/modify_a_tryjob_unittest.py +++ b/llvm_tools/modify_a_tryjob_unittest.py @@ -44,7 +44,7 @@ class ModifyATryjobTest(unittest.TestCase): args_output.extra_change_lists, args_output.options, args_output.builders, - args_output.chroot_path, + args_output.chromeos_path, ) self.assertEqual( @@ -88,7 +88,7 @@ class ModifyATryjobTest(unittest.TestCase): args_output.extra_change_lists, args_output.options, args_output.builders, - args_output.chroot_path, + args_output.chromeos_path, ) self.assertEqual( @@ -130,7 +130,7 @@ class ModifyATryjobTest(unittest.TestCase): args_output.extra_change_lists, args_output.options, args_output.builders, - args_output.chroot_path, + args_output.chromeos_path, ) # Verify that the tryjob was removed from the status file. @@ -198,7 +198,7 @@ class ModifyATryjobTest(unittest.TestCase): args_output.extra_change_lists, args_output.options, args_output.builders, - args_output.chroot_path, + args_output.chromeos_path, ) # Verify that the tryjob's information was updated after submtting @@ -265,7 +265,7 @@ class ModifyATryjobTest(unittest.TestCase): args_output.extra_change_lists, args_output.options, args_output.builders, - args_output.chroot_path, + args_output.chromeos_path, ) self.assertEqual( @@ -312,7 +312,7 @@ class ModifyATryjobTest(unittest.TestCase): args_output.extra_change_lists, args_output.options, args_output.builders, - args_output.chroot_path, + args_output.chromeos_path, ) self.assertEqual( @@ -376,7 +376,7 @@ class ModifyATryjobTest(unittest.TestCase): args_output.extra_change_lists, args_output.options, args_output.builders, - args_output.chroot_path, + args_output.chromeos_path, ) # Verify that the tryjob was added to the status file. @@ -429,7 +429,7 @@ class ModifyATryjobTest(unittest.TestCase): args_output.extra_change_lists, args_output.options, args_output.builders, - args_output.chroot_path, + args_output.chromeos_path, ) self.assertEqual( diff --git a/llvm_tools/test_helpers.py b/llvm_tools/test_helpers.py index ea47a695..44d56f82 100644 --- a/llvm_tools/test_helpers.py +++ b/llvm_tools/test_helpers.py @@ -14,7 +14,7 @@ class ArgsOutputTest: """Testing class to simulate a argument parser object.""" def __init__(self, svn_option="google3"): - self.chroot_path = "/abs/path/to/chroot" + self.chromeos_path = "/abs/path/to/chroot" self.last_tested = "/abs/path/to/last_tested_file.json" self.llvm_version = svn_option self.extra_change_lists = None diff --git a/llvm_tools/update_chromeos_llvm_hash.py b/llvm_tools/update_chromeos_llvm_hash.py index ea09af48..50e0d6f0 100755 --- a/llvm_tools/update_chromeos_llvm_hash.py +++ b/llvm_tools/update_chromeos_llvm_hash.py @@ -133,7 +133,7 @@ class PortagePackage: def defaultCrosRoot() -> Path: - """Get default location of chroot_path. + """Get default location of chromeos_path. The logic assumes that the cros_root is ~/chromiumos, unless llvm_tools is inside of a CrOS checkout, in which case that checkout should be used. @@ -164,7 +164,7 @@ def GetCommandLineArgs(): # Add argument for a specific chroot path. parser.add_argument( - "--chroot_path", + "--chromeos_path", type=Path, default=defaultCrosRoot(), help="the path to the chroot (default: %(default)s)", @@ -523,24 +523,26 @@ def StagePackagesPatchResultsForCommit( return commit_messages -def UpdatePortageManifests(packages: Iterable[str], chroot_path: Path) -> None: +def UpdatePortageManifests( + packages: Iterable[str], chromeos_path: Path +) -> None: """Updates portage manifest files for packages. Args: packages: A list of packages to update manifests for. - chroot_path: The absolute path to the chroot. + chromeos_path: The absolute path to the chromeos checkout. Raises: CalledProcessError: ebuild failed to update manifest. """ - manifest_ebuilds = chroot.GetChrootEbuildPaths(chroot_path, packages) + manifest_ebuilds = chroot.GetChrootEbuildPaths(chromeos_path, packages) for ebuild_path in manifest_ebuilds: ebuild_dir = os.path.dirname(ebuild_path) subprocess_helpers.ChrootRunCommand( - chroot_path, ["ebuild", ebuild_path, "manifest"] + chromeos_path, ["ebuild", ebuild_path, "manifest"] ) subprocess_helpers.ChrootRunCommand( - chroot_path, ["git", "-C", ebuild_dir, "add", "Manifest"] + chromeos_path, ["git", "-C", ebuild_dir, "add", "Manifest"] ) @@ -550,7 +552,7 @@ def UpdatePackages( llvm_variant: LLVMVariant, git_hash: str, svn_version: int, - chroot_path: Path, + chromeos_path: Path, mode: Optional[failure_modes.FailureModes], git_hash_source: Union[int, str], extra_commit_msg_lines: Optional[Iterable[str]], @@ -568,7 +570,7 @@ def UpdatePackages( llvm_variant: The LLVM hash to update. git_hash: The new git hash. svn_version: The SVN-style revision number of git_hash. - chroot_path: The absolute path to the chroot. + chromeos_path: The absolute path to the chroot. mode: The mode of the patch manager when handling an applicable patch. If None is passed, the patch manager won't be invoked. that failed to apply. @@ -584,9 +586,9 @@ def UpdatePackages( If upload_changes is set, a git.CommitContents object. Otherwise None. """ - portage_packages = (PortagePackage(chroot_path, pkg) for pkg in packages) + portage_packages = (PortagePackage(chromeos_path, pkg) for pkg in packages) chromiumos_overlay_path = ( - chroot_path / "src" / "third_party" / "chromiumos-overlay" + chromeos_path / "src" / "third_party" / "chromiumos-overlay" ) branch_name = "update-" + llvm_variant.value + "-" + git_hash @@ -615,14 +617,14 @@ def UpdatePackages( updated_packages.append(pkg.package) commit_lines.append(pkg.package) if manifest_packages: - UpdatePortageManifests(manifest_packages, chroot_path) + UpdatePortageManifests(manifest_packages, chromeos_path) commit_lines.append("Updated manifest for:") commit_lines.extend(manifest_packages) - EnsurePackageMaskContains(chroot_path, git_hash) + EnsurePackageMaskContains(chromeos_path, git_hash) # Handle the patches for each package. if mode is not None: package_info_dict = UpdatePackagesPatchMetadataFile( - chroot_path, svn_version, updated_packages, mode + chromeos_path, svn_version, updated_packages, mode ) # Update the commit message if changes were made to a package's # patches. @@ -645,12 +647,12 @@ def UpdatePackages( def EnsurePackageMaskContains( - chroot_path: Union[Path, str], git_hash: str + chromeos_path: Union[Path, str], git_hash: str ) -> None: """Adds the major version of llvm to package.mask if not already present. Args: - chroot_path: The absolute path to the chroot. + chromeos_path: The absolute path to the chromeos checkout. git_hash: The new git hash. Raises: @@ -660,7 +662,7 @@ def EnsurePackageMaskContains( llvm_major_version = get_llvm_hash.GetLLVMMajorVersion(git_hash) overlay_dir = os.path.join( - chroot_path, "src/third_party/chromiumos-overlay" + chromeos_path, "src/third_party/chromiumos-overlay" ) mask_path = os.path.join( overlay_dir, "profiles/targets/chromeos/package.mask" @@ -675,7 +677,7 @@ def EnsurePackageMaskContains( def UpdatePackagesPatchMetadataFile( - chroot_path: Path, + chromeos_path: Path, svn_version: int, packages: Iterable[str], mode: failure_modes.FailureModes, @@ -683,7 +685,7 @@ def UpdatePackagesPatchMetadataFile( """Updates the packages metadata file. Args: - chroot_path: The absolute path to the chroot. + chromeos_path: The absolute path to the chroot. svn_version: The version to use for patch management. packages: All the packages to update their patch metadata file. mode: The mode for the patch manager to use when an applicable patch @@ -712,7 +714,7 @@ def UpdatePackagesPatchMetadataFile( for cur_package in packages: # Get the absolute path to $FILESDIR of the package. chroot_ebuild_str = subprocess_helpers.ChrootRunCommand( - chroot_path, ["equery", "w", cur_package] + chromeos_path, ["equery", "w", cur_package] ).strip() if not chroot_ebuild_str: raise RuntimeError( @@ -720,7 +722,7 @@ def UpdatePackagesPatchMetadataFile( ) chroot_ebuild_path = Path( chroot.ConvertChrootPathsToAbsolutePaths( - str(chroot_path), [chroot_ebuild_str] + str(chromeos_path), [chroot_ebuild_str] )[0] ) patches_json_fp = ( @@ -835,7 +837,7 @@ def main(): args_output = GetCommandLineArgs() - chroot.VerifyChromeOSRoot(args_output.chroot_path) + chroot.VerifyChromeOSRoot(args_output.chromeos_path) llvm_variant = LLVMVariant.current if args_output.is_llvm_next: @@ -866,7 +868,7 @@ def main(): llvm_variant=llvm_variant, git_hash=git_hash, svn_version=svn_version, - chroot_path=args_output.chroot_path, + chromeos_path=args_output.chromeos_path, mode=patch_update_mode, git_hash_source=git_hash_source, extra_commit_msg_lines=None, @@ -892,7 +894,7 @@ def main(): ) change_list = ChangeRepoManifest( git_hash, - args_output.chroot_path, + args_output.chromeos_path, extra_commit_msg_lines=cq_depend_line, delete_branch=not args_output.no_delete_branch, upload_changes=not args_output.no_upload_changes, diff --git a/llvm_tools/update_chromeos_llvm_hash_unittest.py b/llvm_tools/update_chromeos_llvm_hash_unittest.py index ad0bca75..3ec9cd84 100755 --- a/llvm_tools/update_chromeos_llvm_hash_unittest.py +++ b/llvm_tools/update_chromeos_llvm_hash_unittest.py @@ -249,7 +249,7 @@ class UpdateLLVMHashTest(unittest.TestCase): def testFailedToUprevEbuildToVersionForInvalidSymlink( self, mock_islink, mock_llvm_version ): - symlink_path = "/path/to/chroot/package/package.ebuild" + symlink_path = "/path/to/chromeos/package/package.ebuild" svn_version = 1000 git_hash = "badf00d" mock_llvm_version.return_value = "1234" @@ -270,7 +270,7 @@ class UpdateLLVMHashTest(unittest.TestCase): @mock.patch.object(os.path, "islink", return_value=False) def testFailedToUprevEbuildSymlinkForInvalidSymlink(self, mock_islink): - symlink_path = "/path/to/chroot/package/package.ebuild" + symlink_path = "/path/to/chromeos/package/package.ebuild" # Verify the exception is raised when a invalid symbolic link is # passed in. @@ -291,7 +291,7 @@ class UpdateLLVMHashTest(unittest.TestCase): def testFailedToUprevEbuildToVersion( self, mock_realpath, mock_islink, mock_llvm_version ): - symlink_path = "/path/to/chroot/llvm/llvm_pre123_p.ebuild" + symlink_path = "/path/to/chromeos/llvm/llvm_pre123_p.ebuild" mock_realpath.return_value = "/abs/path/to/llvm/llvm_pre123_p.ebuild" git_hash = "badf00d" mock_llvm_version.return_value = "1234" @@ -312,7 +312,7 @@ class UpdateLLVMHashTest(unittest.TestCase): # Simulate 'os.path.islink' when a symbolic link is passed in. @mock.patch.object(os.path, "islink", return_value=True) def testFailedToUprevEbuildSymlink(self, mock_islink): - symlink_path = "/path/to/chroot/llvm/llvm_pre123_p.ebuild" + symlink_path = "/path/to/chromeos/llvm/llvm_pre123_p.ebuild" # Verify the exception is raised when the symlink does not match the # expected pattern @@ -386,9 +386,9 @@ class UpdateLLVMHashTest(unittest.TestCase): @mock.patch.object(subprocess, "check_output", return_value="") def testManifestUpdate(self, mock_subprocess, mock_ebuild_paths): manifest_packages = ["sys-devel/llvm"] - chroot_path = "/path/to/chroot" + chromeos_path = "/path/to/chromeos" update_chromeos_llvm_hash.UpdatePortageManifests( - manifest_packages, Path(chroot_path) + manifest_packages, Path(chromeos_path) ) args = mock_subprocess.call_args_list[0] @@ -741,7 +741,7 @@ class UpdateLLVMHashTest(unittest.TestCase): llvm_variant=expected_llvm_variant, git_hash=git_hash, svn_version=svn_version, - chroot_path=expected_chroot, + chromeos_path=expected_chroot, mode=failure_modes.FailureModes.FAIL, git_hash_source="google3", extra_commit_msg_lines=None, @@ -785,7 +785,7 @@ class UpdateLLVMHashTest(unittest.TestCase): llvm_variant=expected_llvm_variant, git_hash=git_hash, svn_version=svn_version, - chroot_path=expected_chroot, + chromeos_path=expected_chroot, mode=failure_modes.FailureModes.FAIL, git_hash_source="google3", extra_commit_msg_lines=None, @@ -809,7 +809,7 @@ class UpdateLLVMHashTest(unittest.TestCase): packages_to_update = "test-packages/package1,test-libs/lib1" manifest_packages = "test-libs/lib1,test-libs/lib2" failure_mode = failure_modes.FailureModes.REMOVE_PATCHES - chroot_path = Path("/some/path/to/chroot") + chromeos_path = Path("/some/path/to/chromeos") llvm_ver = 435698 git_hash = "1234abcd" svn_version = 5678 @@ -820,8 +820,8 @@ class UpdateLLVMHashTest(unittest.TestCase): "--llvm_version", str(llvm_ver), "--is_llvm_next", - "--chroot_path", - str(chroot_path), + "--chromeos_path", + str(chromeos_path), "--update_packages", packages_to_update, "--manifest_packages", @@ -844,7 +844,7 @@ class UpdateLLVMHashTest(unittest.TestCase): llvm_variant=expected_llvm_variant, git_hash=git_hash, svn_version=svn_version, - chroot_path=chroot_path, + chromeos_path=chromeos_path, mode=failure_mode, git_hash_source=llvm_ver, extra_commit_msg_lines=None, @@ -859,7 +859,7 @@ class UpdateLLVMHashTest(unittest.TestCase): def testEnsurePackageMaskContainsExisting( self, mock_llvm_version, mock_git_add ): - chroot_path = "absolute/path/to/chroot" + chromeos_path = "absolute/path/to/chromeos" git_hash = "badf00d" mock_llvm_version.return_value = "1234" with mock.patch( @@ -868,14 +868,14 @@ class UpdateLLVMHashTest(unittest.TestCase): create=True, ) as mock_file: update_chromeos_llvm_hash.EnsurePackageMaskContains( - chroot_path, git_hash + chromeos_path, git_hash ) handle = mock_file() handle.write.assert_not_called() mock_llvm_version.assert_called_once_with(git_hash) overlay_dir = ( - "absolute/path/to/chroot/src/third_party/chromiumos-overlay" + "absolute/path/to/chromeos/src/third_party/chromiumos-overlay" ) mask_path = overlay_dir + "/profiles/targets/chromeos/package.mask" mock_git_add.assert_called_once_with( @@ -887,7 +887,7 @@ class UpdateLLVMHashTest(unittest.TestCase): def testEnsurePackageMaskContainsNotExisting( self, mock_llvm_version, mock_git_add ): - chroot_path = "absolute/path/to/chroot" + chromeos_path = "absolute/path/to/chromeos" git_hash = "badf00d" mock_llvm_version.return_value = "1234" with mock.patch( @@ -896,7 +896,7 @@ class UpdateLLVMHashTest(unittest.TestCase): create=True, ) as mock_file: update_chromeos_llvm_hash.EnsurePackageMaskContains( - chroot_path, git_hash + chromeos_path, git_hash ) handle = mock_file() handle.write.assert_called_once_with( @@ -905,7 +905,7 @@ class UpdateLLVMHashTest(unittest.TestCase): mock_llvm_version.assert_called_once_with(git_hash) overlay_dir = ( - "absolute/path/to/chroot/src/third_party/chromiumos-overlay" + "absolute/path/to/chromeos/src/third_party/chromiumos-overlay" ) mask_path = overlay_dir + "/profiles/targets/chromeos/package.mask" mock_git_add.assert_called_once_with( diff --git a/llvm_tools/update_packages_and_run_tests.py b/llvm_tools/update_packages_and_run_tests.py index b0655fe2..3ff5f70a 100755 --- a/llvm_tools/update_packages_and_run_tests.py +++ b/llvm_tools/update_packages_and_run_tests.py @@ -54,9 +54,9 @@ def GetCommandLineArgs() -> argparse.Namespace: # Add argument for a specific chroot path. parser.add_argument( - "--chroot_path", + "--chromeos_path", default=cros_root, - help="the path to the chroot (default: %(default)s)", + help="the path to the ChromeOS tree (default: %(default)s)", ) # Add argument to choose between llvm and llvm-next. @@ -190,17 +190,17 @@ def UnchangedSinceLastRun( def AddReviewers( cl: int, reviewers: Iterable[str], - chroot_path: Union[Path, str], + chromeos_path: Union[Path, str], ) -> None: """Add reviewers for the created CL. Args: cl: The CL number to add reviewers to. reviewers: Email addresses of reviewers to add. - chroot_path: The absolute path to the chroot. + chromeos_path: The absolute path to the chromeos tree. """ - gerrit_abs_path = os.path.join(chroot_path, "chromite/bin/gerrit") + gerrit_abs_path = os.path.join(chromeos_path, "chromite/bin/gerrit") for reviewer in reviewers: cmd = [gerrit_abs_path, "reviewers", str(cl), reviewer] @@ -210,14 +210,14 @@ def AddReviewers( def AddLinksToCL( tests: Iterable[Dict[str, Any]], cl: int, - chroot_path: Union[Path, str], + chromeos_path: Union[Path, str], ) -> None: """Adds the test link(s) to the CL as a comment. Args: tests: Links to the tests. cl: The number of the CL to add the test links to. - chroot_path: Absolute path to the chroot. + chromeos_path: Absolute path to the chromeos tree. """ # NOTE: Invoking `cros_sdk` does not make each tryjob link appear on its @@ -226,7 +226,7 @@ def AddLinksToCL( # # FIXME: Need to figure out why `cros_sdk` does not add each tryjob link as # a newline. - gerrit_abs_path = os.path.join(chroot_path, "chromite/bin/gerrit") + gerrit_abs_path = os.path.join(chromeos_path, "chromite/bin/gerrit") links = ["Started the following tests:"] links.extend(test["link"] for test in tests) @@ -281,7 +281,7 @@ def RunTryJobs( extra_change_lists: List[int], options: List[str], builders: Iterable[str], - chroot_path: Union[Path, str], + chromeos_path: Union[Path, str], ) -> List[Dict]: """Runs a tryjob/tryjobs. @@ -291,7 +291,7 @@ def RunTryJobs( CL that was created by updating the packages ('cl_number'). options: Any options to be passed into the 'tryjob' command. builders: All the builders to run the 'tryjob' with. - chroot_path: The absolute path to the chroot. + chromeos_path: The absolute path to the chromeos tree. Returns: A list that contains stdout contents of each tryjob, where stdout is @@ -311,7 +311,7 @@ def RunTryJobs( for builder in builders: cmd = GetTryJobCommand(cl_number, extra_change_lists, options, builder) - out = subprocess.check_output(cmd, cwd=chroot_path, encoding="utf-8") + out = subprocess.check_output(cmd, cwd=chromeos_path, encoding="utf-8") test_output = json.loads(out) @@ -328,7 +328,7 @@ def RunTryJobs( } ) - AddLinksToCL(tests, cl_number, chroot_path) + AddLinksToCL(tests, cl_number, chromeos_path) return tests @@ -338,7 +338,7 @@ def StartRecipeBuilders( extra_change_lists: List[int], options: List[str], builders: List[str], - chroot_path: Union[Path, str], + chromeos_path: Union[Path, str], ) -> List[Dict]: """Launch recipe builders. @@ -348,7 +348,7 @@ def StartRecipeBuilders( CL that was created by updating the packages ('cl_number'). options: Any options to be passed into the 'tryjob' command. builders: All the builders to run the 'tryjob' with. - chroot_path: The absolute path to the chroot. + chromeos_path: The absolute path to the chromeos tree. Returns: A list that contains stdout contents of each builder, where stdout is @@ -380,7 +380,7 @@ def StartRecipeBuilders( cmd.append(builder) - out = subprocess.check_output(cmd, cwd=chroot_path, encoding="utf-8") + out = subprocess.check_output(cmd, cwd=chromeos_path, encoding="utf-8") test_output = json.loads(out) @@ -395,7 +395,7 @@ def StartRecipeBuilders( } ) - AddLinksToCL(tests, cl_number, chroot_path) + AddLinksToCL(tests, cl_number, chromeos_path) return tests @@ -428,11 +428,11 @@ def GetCQIncludeTrybotsString(trybot: Optional[str]) -> Optional[str]: def StartCQDryRun( cl: int, dependent_cls: List[int], - chroot_path: Union[Path, str], + chromeos_path: Union[Path, str], ) -> None: """Start CQ dry run for the changelist and dependencies.""" - gerrit_abs_path = os.path.join(chroot_path, "chromite/bin/gerrit") + gerrit_abs_path = os.path.join(chromeos_path, "chromite/bin/gerrit") cl_list = [cl] cl_list.extend(dependent_cls) @@ -454,7 +454,7 @@ def main(): args_output = GetCommandLineArgs() - chroot.VerifyChromeOSRoot(args_output.chroot_path) + chroot.VerifyChromeOSRoot(args_output.chromeos_path) svn_option = args_output.llvm_version @@ -469,7 +469,8 @@ def main(): # arguments last time --last_tested is used. if args_output.last_tested: chroot_file_paths = chroot.GetChrootEbuildPaths( - args_output.chroot_path, update_chromeos_llvm_hash.DEFAULT_PACKAGES + args_output.chromeos_path, + update_chromeos_llvm_hash.DEFAULT_PACKAGES, ) arg_dict = { "svn_version": svn_version, @@ -512,14 +513,14 @@ def main(): llvm_variant=llvm_variant, git_hash=git_hash, svn_version=svn_version, - chroot_path=Path(args_output.chroot_path), + chromeos_path=Path(args_output.chromeos_path), mode=failure_modes.FailureModes.DISABLE_PATCHES, git_hash_source=svn_option, extra_commit_msg_lines=extra_commit_msg_lines, ) AddReviewers( - change_list.cl_number, args_output.reviewers, args_output.chroot_path + change_list.cl_number, args_output.reviewers, args_output.chromeos_path ) print("Successfully updated packages to %d" % svn_version) @@ -532,7 +533,7 @@ def main(): args_output.extra_change_lists, args_output.options, args_output.builders, - args_output.chroot_path, + args_output.chromeos_path, ) print("Tests:") for test in tests: @@ -543,7 +544,7 @@ def main(): args_output.extra_change_lists, args_output.options, args_output.builders, - args_output.chroot_path, + args_output.chromeos_path, ) print("Tests:") for test in tests: @@ -553,7 +554,7 @@ def main(): StartCQDryRun( change_list.cl_number, args_output.extra_change_lists, - args_output.chroot_path, + args_output.chromeos_path, ) # If --last_tested is specified, record the arguments used diff --git a/llvm_tools/update_packages_and_run_tests_unittest.py b/llvm_tools/update_packages_and_run_tests_unittest.py index 76482c4e..79f81d7e 100755 --- a/llvm_tools/update_packages_and_run_tests_unittest.py +++ b/llvm_tools/update_packages_and_run_tests_unittest.py @@ -152,14 +152,14 @@ class UpdatePackagesAndRunTryjobsTest(unittest.TestCase): mock_cmd.return_value = json.dumps([{"id": bb_id, "url": url}]) - chroot_path = "/some/path/to/chroot" + chromeos_path = "/some/path/to/chromeos" cl = 900 extra_cls = [1200] options = ["some_option"] builders = ["builder1"] tests = update_packages_and_run_tests.RunTryJobs( - cl, extra_cls, options, builders, chroot_path + cl, extra_cls, options, builders, chromeos_path ) expected_tests = [ @@ -176,7 +176,7 @@ class UpdatePackagesAndRunTryjobsTest(unittest.TestCase): self.assertEqual(tests, expected_tests) mock_cmd.assert_called_once_with( - expected_cmd, cwd=chroot_path, encoding="utf-8" + expected_cmd, cwd=chromeos_path, encoding="utf-8" ) mock_add_links_to_cl.assert_called_once() @@ -205,14 +205,14 @@ class UpdatePackagesAndRunTryjobsTest(unittest.TestCase): {"id": bb_id, "createTime": create_time} ) - chroot_path = "/some/path/to/chroot" + chromeos_path = "/some/path/to/chromeos" cl = 900 extra_cls = [1200] options = ["some_option"] builders = ["builder1"] tests = update_packages_and_run_tests.StartRecipeBuilders( - cl, extra_cls, options, builders, chroot_path + cl, extra_cls, options, builders, chromeos_path ) expected_tests = [ @@ -229,25 +229,25 @@ class UpdatePackagesAndRunTryjobsTest(unittest.TestCase): self.assertEqual(tests, expected_tests) mock_cmd.assert_called_once_with( - expected_cmd, cwd=chroot_path, encoding="utf-8" + expected_cmd, cwd=chromeos_path, encoding="utf-8" ) mock_add_links_to_cl.assert_called_once() @mock.patch.object(subprocess, "check_output", return_value=None) def testSuccessfullyAddedTestLinkToCL(self, mock_exec_cmd): - chroot_path = "/abs/path/to/chroot" + chromeos_path = "/abs/path/to/chromeos" test_cl_number = 1000 tests = [{"link": "https://some_tryjob_link.com"}] update_packages_and_run_tests.AddLinksToCL( - tests, test_cl_number, chroot_path + tests, test_cl_number, chromeos_path ) expected_gerrit_message = [ - "%s/chromite/bin/gerrit" % chroot_path, + "%s/chromite/bin/gerrit" % chromeos_path, "message", str(test_cl_number), "Started the following tests:\n%s" % tests[0]["link"], @@ -403,17 +403,17 @@ class UpdatePackagesAndRunTestCQTest(unittest.TestCase): @mock.patch.object(subprocess, "check_output", return_value=None) def testStartCQDryRunNoDeps(self, mock_exec_cmd): - chroot_path = "/abs/path/to/chroot" + chromeos_path = "/abs/path/to/chromeos" test_cl_number = 1000 # test with no deps cls. extra_cls = [] update_packages_and_run_tests.StartCQDryRun( - test_cl_number, extra_cls, chroot_path + test_cl_number, extra_cls, chromeos_path ) expected_gerrit_message = [ - "%s/chromite/bin/gerrit" % chroot_path, + "%s/chromite/bin/gerrit" % chromeos_path, "label-cq", str(test_cl_number), "1", @@ -425,22 +425,22 @@ class UpdatePackagesAndRunTestCQTest(unittest.TestCase): @mock.patch.object(subprocess, "check_output", return_value=None) # test with a single deps cl. def testStartCQDryRunSingleDep(self, mock_exec_cmd): - chroot_path = "/abs/path/to/chroot" + chromeos_path = "/abs/path/to/chromeos" test_cl_number = 1000 extra_cls = [2000] update_packages_and_run_tests.StartCQDryRun( - test_cl_number, extra_cls, chroot_path + test_cl_number, extra_cls, chromeos_path ) expected_gerrit_cmd_1 = [ - "%s/chromite/bin/gerrit" % chroot_path, + "%s/chromite/bin/gerrit" % chromeos_path, "label-cq", str(test_cl_number), "1", ] expected_gerrit_cmd_2 = [ - "%s/chromite/bin/gerrit" % chroot_path, + "%s/chromite/bin/gerrit" % chromeos_path, "label-cq", str(2000), "1", @@ -457,29 +457,29 @@ class UpdatePackagesAndRunTestCQTest(unittest.TestCase): # Mock ExecCommandAndCaptureOutput for the gerrit command execution. @mock.patch.object(subprocess, "check_output", return_value=None) def testStartCQDryRunMultipleDep(self, mock_exec_cmd): - chroot_path = "/abs/path/to/chroot" + chromeos_path = "/abs/path/to/chromeos" test_cl_number = 1000 # test with multiple deps cls. extra_cls = [3000, 4000] update_packages_and_run_tests.StartCQDryRun( - test_cl_number, extra_cls, chroot_path + test_cl_number, extra_cls, chromeos_path ) expected_gerrit_cmd_1 = [ - "%s/chromite/bin/gerrit" % chroot_path, + "%s/chromite/bin/gerrit" % chromeos_path, "label-cq", str(test_cl_number), "1", ] expected_gerrit_cmd_2 = [ - "%s/chromite/bin/gerrit" % chroot_path, + "%s/chromite/bin/gerrit" % chromeos_path, "label-cq", str(3000), "1", ] expected_gerrit_cmd_3 = [ - "%s/chromite/bin/gerrit" % chroot_path, + "%s/chromite/bin/gerrit" % chromeos_path, "label-cq", str(4000), "1", @@ -500,12 +500,12 @@ class UpdatePackagesAndRunTestCQTest(unittest.TestCase): @mock.patch.object(subprocess, "check_output", return_value=None) # test with no reviewers. def testAddReviewersNone(self, mock_exec_cmd): - chroot_path = "/abs/path/to/chroot" + chromeos_path = "/abs/path/to/chromeos" reviewers = [] test_cl_number = 1000 update_packages_and_run_tests.AddReviewers( - test_cl_number, reviewers, chroot_path + test_cl_number, reviewers, chromeos_path ) self.assertTrue(mock_exec_cmd.not_called) @@ -513,22 +513,22 @@ class UpdatePackagesAndRunTestCQTest(unittest.TestCase): @mock.patch.object(subprocess, "check_output", return_value=None) # test with multiple reviewers. def testAddReviewersMultiple(self, mock_exec_cmd): - chroot_path = "/abs/path/to/chroot" + chromeos_path = "/abs/path/to/chromeos" reviewers = ["none1@chromium.org", "none2@chromium.org"] test_cl_number = 1000 update_packages_and_run_tests.AddReviewers( - test_cl_number, reviewers, chroot_path + test_cl_number, reviewers, chromeos_path ) expected_gerrit_cmd_1 = [ - "%s/chromite/bin/gerrit" % chroot_path, + "%s/chromite/bin/gerrit" % chromeos_path, "reviewers", str(test_cl_number), "none1@chromium.org", ] expected_gerrit_cmd_2 = [ - "%s/chromite/bin/gerrit" % chroot_path, + "%s/chromite/bin/gerrit" % chromeos_path, "reviewers", str(test_cl_number), "none2@chromium.org", -- cgit v1.2.3 From f3de66836cc58a9073cf612072dd8efc47e8e1f7 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 11 Mar 2024 11:14:38 -0600 Subject: update_packages_and_run_tests: add chroot args This allows us to specify a custom chroot to run commands in. This allows for isolated runs, and easier gardening. BUG=b:325884106, b:325895866 TEST=./test_update_llvm_next_google3_cq_recipes.sh on chrotomation Change-Id: I1681f7a96be758dd332f30dd0ec4ca8052705c1f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5362313 Tested-by: George Burgess Commit-Queue: George Burgess Reviewed-by: Jordan Abrahams-Whitehead --- llvm_tools/chroot.py | 18 ++++++-- llvm_tools/modify_a_tryjob.py | 2 +- llvm_tools/subprocess_helpers.py | 15 ++++++- llvm_tools/update_chromeos_llvm_hash.py | 50 ++++++++++++++-------- llvm_tools/update_chromeos_llvm_hash_unittest.py | 10 +++-- llvm_tools/update_packages_and_run_tests.py | 35 ++++++++++++++- .../update_packages_and_run_tests_unittest.py | 2 + 7 files changed, 103 insertions(+), 29 deletions(-) diff --git a/llvm_tools/chroot.py b/llvm_tools/chroot.py index 5edcbf47..23c188c6 100755 --- a/llvm_tools/chroot.py +++ b/llvm_tools/chroot.py @@ -40,15 +40,19 @@ def VerifyChromeOSRoot(chromeos_root: Union[Path, str]) -> None: def GetChrootEbuildPaths( - chromeos_root: Union[Path, str], packages: Iterable[str] + chromeos_root: Union[Path, str], + packages: Iterable[str], + chroot_name: str = "chroot", + out_dir: str = "out", ) -> List[str]: """Gets the chroot path(s) of the package(s). Args: - chromeos_root: The absolute path to the chroot to - use for executing chroot commands. + chromeos_root: The absolute path to the chromeos tree to use. packages: A list of a package/packages to be used to find their chroot path. + chroot_name: name of the chroot to enter. + out_dir: name of the out directory for the chroot. Returns: A list of chroot paths of the packages' ebuild files. @@ -59,10 +63,16 @@ def GetChrootEbuildPaths( chroot_paths = [] + cros_sdk = [ + "cros_sdk", + f"--chroot={chroot_name}", + f"--out-dir={out_dir}", + ] + # Find the chroot path for each package's ebuild. for package in packages: chroot_path = subprocess.check_output( - ["cros_sdk", "--", "equery", "w", package], + cros_sdk + ["--", "equery", "w", package], cwd=chromeos_root, encoding="utf-8", ) diff --git a/llvm_tools/modify_a_tryjob.py b/llvm_tools/modify_a_tryjob.py index a1fd4cbf..40024a96 100755 --- a/llvm_tools/modify_a_tryjob.py +++ b/llvm_tools/modify_a_tryjob.py @@ -139,7 +139,7 @@ def GetCLAfterUpdatingPackages( llvm_variant=update_chromeos_llvm_hash.LLVMVariant.next, git_hash=git_hash, svn_version=svn_version, - chromeos_path=Path(chromeos_path), + chroot_opts=update_chromeos_llvm_hash.ChrootOpts(Path(chromeos_path)), mode=failure_modes.FailureModes.DISABLE_PATCHES, git_hash_source=svn_option, extra_commit_msg_lines=None, diff --git a/llvm_tools/subprocess_helpers.py b/llvm_tools/subprocess_helpers.py index d0c619cb..e1847c00 100644 --- a/llvm_tools/subprocess_helpers.py +++ b/llvm_tools/subprocess_helpers.py @@ -33,10 +33,21 @@ def check_call(cmd, cwd=None): # FIXME: CTRL+C does not work when executing a command inside the chroot via # `cros_sdk`. -def ChrootRunCommand(chroot_path, cmd, verbose=False): +def ChrootRunCommand( + chroot_path, + cmd, + verbose: bool = False, + chroot_name: str = "chroot", + out_name: str = "out", +): """Runs the command inside the chroot.""" - exec_chroot_cmd = ["cros_sdk", "--"] + exec_chroot_cmd = [ + "cros_sdk", + f"--chroot={chroot_name}", + f"--out-dir={out_name}", + "--", + ] exec_chroot_cmd.extend(cmd) return ExecCommandAndCaptureOutput( diff --git a/llvm_tools/update_chromeos_llvm_hash.py b/llvm_tools/update_chromeos_llvm_hash.py index 50e0d6f0..510bfa9c 100755 --- a/llvm_tools/update_chromeos_llvm_hash.py +++ b/llvm_tools/update_chromeos_llvm_hash.py @@ -10,6 +10,7 @@ for review. """ import argparse +import dataclasses import enum import os from pathlib import Path @@ -48,19 +49,28 @@ class LLVMVariant(enum.Enum): next = "LLVM_NEXT_HASH" +@dataclasses.dataclass(frozen=True, eq=True) +class ChrootOpts: + """A class that holds chroot options.""" + + chromeos_root: Path + chroot_name: str = "chroot" + out_name: str = "out" + + class PortagePackage: """Represents a portage package with location info.""" - def __init__(self, chromeos_root: Path, package: str): + def __init__(self, chroot_opts: ChrootOpts, package: str): """Create a new PortagePackage. Args: - chromeos_root: Path to the root of the code checkout. + chroot_opts: options that specify the ChromeOS chroot to use. package: "category/package" string. """ self.package = package potential_ebuild_path = PortagePackage.find_package_ebuild( - chromeos_root, package + chroot_opts, package ) if potential_ebuild_path.is_symlink(): self.uprev_target: Optional[Path] = potential_ebuild_path.absolute() @@ -71,12 +81,14 @@ class PortagePackage: self.ebuild_path = potential_ebuild_path.absolute() @staticmethod - def find_package_ebuild(chromeos_root: Path, package: str) -> Path: + def find_package_ebuild(chroot_opts: ChrootOpts, package: str) -> Path: """Look up the package's ebuild location.""" - chromeos_root_str = str(chromeos_root) + chromeos_root_str = str(chroot_opts.chromeos_root) ebuild_paths = chroot.GetChrootEbuildPaths( chromeos_root_str, [package], + chroot_opts.chroot_name, + chroot_opts.out_name, ) converted = chroot.ConvertChrootPathsToAbsolutePaths( chromeos_root_str, ebuild_paths @@ -552,7 +564,7 @@ def UpdatePackages( llvm_variant: LLVMVariant, git_hash: str, svn_version: int, - chromeos_path: Path, + chroot_opts: ChrootOpts, mode: Optional[failure_modes.FailureModes], git_hash_source: Union[int, str], extra_commit_msg_lines: Optional[Iterable[str]], @@ -570,7 +582,7 @@ def UpdatePackages( llvm_variant: The LLVM hash to update. git_hash: The new git hash. svn_version: The SVN-style revision number of git_hash. - chromeos_path: The absolute path to the chroot. + chroot_opts: options that specify the ChromeOS chroot to use. mode: The mode of the patch manager when handling an applicable patch. If None is passed, the patch manager won't be invoked. that failed to apply. @@ -585,10 +597,9 @@ def UpdatePackages( Returns: If upload_changes is set, a git.CommitContents object. Otherwise None. """ - - portage_packages = (PortagePackage(chromeos_path, pkg) for pkg in packages) + portage_packages = (PortagePackage(chroot_opts, pkg) for pkg in packages) chromiumos_overlay_path = ( - chromeos_path / "src" / "third_party" / "chromiumos-overlay" + chroot_opts.chromeos_root / "src" / "third_party" / "chromiumos-overlay" ) branch_name = "update-" + llvm_variant.value + "-" + git_hash @@ -617,14 +628,14 @@ def UpdatePackages( updated_packages.append(pkg.package) commit_lines.append(pkg.package) if manifest_packages: - UpdatePortageManifests(manifest_packages, chromeos_path) + UpdatePortageManifests(manifest_packages, chroot_opts.chromeos_root) commit_lines.append("Updated manifest for:") commit_lines.extend(manifest_packages) - EnsurePackageMaskContains(chromeos_path, git_hash) + EnsurePackageMaskContains(chroot_opts.chromeos_root, git_hash) # Handle the patches for each package. if mode is not None: package_info_dict = UpdatePackagesPatchMetadataFile( - chromeos_path, svn_version, updated_packages, mode + chroot_opts, svn_version, updated_packages, mode ) # Update the commit message if changes were made to a package's # patches. @@ -677,7 +688,7 @@ def EnsurePackageMaskContains( def UpdatePackagesPatchMetadataFile( - chromeos_path: Path, + chroot_opts: ChrootOpts, svn_version: int, packages: Iterable[str], mode: failure_modes.FailureModes, @@ -685,7 +696,7 @@ def UpdatePackagesPatchMetadataFile( """Updates the packages metadata file. Args: - chromeos_path: The absolute path to the chroot. + chroot_opts: options that specify the ChromeOS chroot to use. svn_version: The version to use for patch management. packages: All the packages to update their patch metadata file. mode: The mode for the patch manager to use when an applicable patch @@ -714,7 +725,10 @@ def UpdatePackagesPatchMetadataFile( for cur_package in packages: # Get the absolute path to $FILESDIR of the package. chroot_ebuild_str = subprocess_helpers.ChrootRunCommand( - chromeos_path, ["equery", "w", cur_package] + chroot_opts.chromeos_root, + ["equery", "w", cur_package], + chroot_name=chroot_opts.chroot_name, + out_name=chroot_opts.out_name, ).strip() if not chroot_ebuild_str: raise RuntimeError( @@ -722,7 +736,7 @@ def UpdatePackagesPatchMetadataFile( ) chroot_ebuild_path = Path( chroot.ConvertChrootPathsToAbsolutePaths( - str(chromeos_path), [chroot_ebuild_str] + str(chroot_opts.chromeos_root), [chroot_ebuild_str] )[0] ) patches_json_fp = ( @@ -868,7 +882,7 @@ def main(): llvm_variant=llvm_variant, git_hash=git_hash, svn_version=svn_version, - chromeos_path=args_output.chromeos_path, + chroot_opts=ChrootOpts(args_output.chromeos_path), mode=patch_update_mode, git_hash_source=git_hash_source, extra_commit_msg_lines=None, diff --git a/llvm_tools/update_chromeos_llvm_hash_unittest.py b/llvm_tools/update_chromeos_llvm_hash_unittest.py index 3ec9cd84..7f9bbbe4 100755 --- a/llvm_tools/update_chromeos_llvm_hash_unittest.py +++ b/llvm_tools/update_chromeos_llvm_hash_unittest.py @@ -395,6 +395,8 @@ class UpdateLLVMHashTest(unittest.TestCase): manifest_cmd = ( [ "cros_sdk", + "--chroot=chroot", + "--out-dir=out", "--", "ebuild", "/chroot/path/test.ebuild", @@ -407,6 +409,8 @@ class UpdateLLVMHashTest(unittest.TestCase): git_add_cmd = ( [ "cros_sdk", + "--chroot=chroot", + "--out-dir=out", "--", "git", "-C", @@ -741,7 +745,7 @@ class UpdateLLVMHashTest(unittest.TestCase): llvm_variant=expected_llvm_variant, git_hash=git_hash, svn_version=svn_version, - chromeos_path=expected_chroot, + chroot_opts=update_chromeos_llvm_hash.ChrootOpts(expected_chroot), mode=failure_modes.FailureModes.FAIL, git_hash_source="google3", extra_commit_msg_lines=None, @@ -785,7 +789,7 @@ class UpdateLLVMHashTest(unittest.TestCase): llvm_variant=expected_llvm_variant, git_hash=git_hash, svn_version=svn_version, - chromeos_path=expected_chroot, + chroot_opts=update_chromeos_llvm_hash.ChrootOpts(expected_chroot), mode=failure_modes.FailureModes.FAIL, git_hash_source="google3", extra_commit_msg_lines=None, @@ -844,7 +848,7 @@ class UpdateLLVMHashTest(unittest.TestCase): llvm_variant=expected_llvm_variant, git_hash=git_hash, svn_version=svn_version, - chromeos_path=chromeos_path, + chroot_opts=update_chromeos_llvm_hash.ChrootOpts(chromeos_path), mode=failure_mode, git_hash_source=llvm_ver, extra_commit_msg_lines=None, diff --git a/llvm_tools/update_packages_and_run_tests.py b/llvm_tools/update_packages_and_run_tests.py index 3ff5f70a..1a0c3ead 100755 --- a/llvm_tools/update_packages_and_run_tests.py +++ b/llvm_tools/update_packages_and_run_tests.py @@ -59,6 +59,25 @@ def GetCommandLineArgs() -> argparse.Namespace: help="the path to the ChromeOS tree (default: %(default)s)", ) + # Add argument for a specific chroot path. + parser.add_argument( + "--chroot_name", + default="chroot", + help=""" + the name of the chroot to use in the CrOS checkout. Defaults to + 'chroot'. + """, + ) + + parser.add_argument( + "--chroot_out", + help=""" + the name of the chroot to use in the CrOS checkout. Defaults to + 'out' if the chroot's name is 'chroot'; otherwise, defaults to + '${chroot_name}_out'. + """, + ) + # Add argument to choose between llvm and llvm-next. parser.add_argument( "--is_llvm_next", @@ -153,6 +172,14 @@ def GetCommandLineArgs() -> argparse.Namespace: if args_output.subparser_name not in subparser_names: parser.error("one of %s must be specified" % subparser_names) + if not args_output.chroot_out: + chroot_name = args_output.chroot_name + if chroot_name == "chroot": + out = "out" + else: + out = f"{chroot_name}_out" + args_output.chroot_out = out + return args_output @@ -471,6 +498,8 @@ def main(): chroot_file_paths = chroot.GetChrootEbuildPaths( args_output.chromeos_path, update_chromeos_llvm_hash.DEFAULT_PACKAGES, + args_output.chroot_name, + args_output.chroot_out, ) arg_dict = { "svn_version": svn_version, @@ -513,7 +542,11 @@ def main(): llvm_variant=llvm_variant, git_hash=git_hash, svn_version=svn_version, - chromeos_path=Path(args_output.chromeos_path), + chroot_opts=update_chromeos_llvm_hash.ChrootOpts( + chromeos_root=Path(args_output.chromeos_path), + chroot_name=args_output.chroot_name, + out_name=args_output.chroot_out, + ), mode=failure_modes.FailureModes.DISABLE_PATCHES, git_hash_source=svn_option, extra_commit_msg_lines=extra_commit_msg_lines, diff --git a/llvm_tools/update_packages_and_run_tests_unittest.py b/llvm_tools/update_packages_and_run_tests_unittest.py index 79f81d7e..9abdc199 100755 --- a/llvm_tools/update_packages_and_run_tests_unittest.py +++ b/llvm_tools/update_packages_and_run_tests_unittest.py @@ -299,6 +299,8 @@ class UpdatePackagesAndRunTryjobsTest(unittest.TestCase): # Call with a changed LLVM svn version args_output = test_helpers.ArgsOutputTest() + args_output.chroot_name = "custom-chroot" + args_output.chroot_out = "custom-chroot_out" args_output.is_llvm_next = True args_output.extra_change_lists = extra_cls args_output.last_tested = last_tested_file -- cgit v1.2.3 From 56b13e96a72867f7de1004afb8826868a5211df1 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 12 Mar 2024 11:29:52 -0600 Subject: afdo_tools: un-add 6.6 kernel version I thought this was enabled, since I saw an AFDO profile specified in the kernel's 6.6 ebuild. Apparently that was added for some other reason, since the USE flags for it have not yet been set, and there are no 6.6 profiles actually available in our gs:// bucket. Back out attempts to roll that accordingly, since they'll all fail. BUG=b:329139584 TEST=None Change-Id: I917f784e8616072e4425088c4df07391dde7ed3a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5367600 Commit-Queue: Ryan Beltran Tested-by: George Burgess Auto-Submit: George Burgess Reviewed-by: Ryan Beltran --- afdo_tools/update_kernel_afdo.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afdo_tools/update_kernel_afdo.cfg b/afdo_tools/update_kernel_afdo.cfg index 9124c345..a69d6f84 100644 --- a/afdo_tools/update_kernel_afdo.cfg +++ b/afdo_tools/update_kernel_afdo.cfg @@ -2,7 +2,7 @@ # All changes here won't affect kernel afdo update in branches. # WARNING: Changes must be submitted to have effect. -AMD_KVERS="5.4 5.10 5.15 6.1 6.6" +AMD_KVERS="5.4 5.10 5.15 6.1" ARM_KVERS="5.15" AMD_METADATA_FILE="afdo_metadata/kernel_afdo.json" ARM_METADATA_FILE="afdo_metadata/kernel_arm_afdo.json" -- cgit v1.2.3 From 1409d51f5c2e00d3ad735e7156813d48be3cdbfe Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 12 Mar 2024 09:26:37 -0600 Subject: auto_delete_nightly_test_data: split abandoning into another script It's unclear if auto_delete_nightly_test_data is needed anymore, other than the CL abandoning part. This code is also not written with current best practices, so take the chance to quickly rewrite the abandoning part. BUG=b:329243828 TEST=./auto_abandon_cls.sh on Chrotomation Change-Id: I53c836839f6c03709e2bec2d05449a3ec3a4e7ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5367060 Tested-by: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: George Burgess --- auto_abandon_cls.py | 82 ++++++++++++++++++++++++++++++++++++++++ auto_delete_nightly_test_data.py | 30 --------------- 2 files changed, 82 insertions(+), 30 deletions(-) create mode 100755 auto_abandon_cls.py diff --git a/auto_abandon_cls.py b/auto_abandon_cls.py new file mode 100755 index 00000000..d210c085 --- /dev/null +++ b/auto_abandon_cls.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Abandons CLs from the current user that haven't been updated recently. + +Note that this needs to be run from inside a ChromeOS tree. Otherwise, the +`gerrit` tool this depends on won't be found. +""" + +import argparse +import logging +import subprocess +import sys +from typing import List + + +def enumerate_old_cls(old_days: int) -> List[int]: + """Returns CL numbers that haven't been updated in `old_days` days.""" + stdout = subprocess.run( + ["gerrit", "--raw", "search", f"owner:me status:open age:{old_days}d"], + check=True, + stdin=subprocess.DEVNULL, + stdout=subprocess.PIPE, + encoding="utf-8", + ).stdout + # Sort for prettier output; it's unclear if Gerrit always sorts, and it's + # cheap. + return sorted(int(x) for x in stdout.splitlines()) + + +def abandon_cls(cls: List[int]) -> None: + subprocess.run( + ["gerrit", "abandon"] + [str(x) for x in cls], + check=True, + stdin=subprocess.DEVNULL, + ) + + +def main(argv: List[str]) -> None: + logging.basicConfig( + format=">> %(asctime)s: %(levelname)s: %(filename)s:%(lineno)d: " + "%(message)s", + level=logging.INFO, + ) + + parser = argparse.ArgumentParser( + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, + ) + parser.add_argument( + "--old-days", + default=14, + type=int, + help=""" + How many days a CL needs to go without modification to be considered + 'old'. + """, + ) + parser.add_argument( + "--dry-run", + action="store_true", + help="Don't actually run the abandon command.", + ) + opts = parser.parse_args(argv) + + old_cls = enumerate_old_cls(opts.old_days) + if not old_cls: + logging.info("No CLs less than %d days old found; quit", opts.old_days) + return + + logging.info("Abandoning CLs: %s", [f"crrev.com/c/{x}" for x in old_cls]) + if opts.dry_run: + logging.info("--dry-run specified; skip the actual abandon part") + return + + abandon_cls(old_cls) + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/auto_delete_nightly_test_data.py b/auto_delete_nightly_test_data.py index 06d02067..372f2995 100755 --- a/auto_delete_nightly_test_data.py +++ b/auto_delete_nightly_test_data.py @@ -18,7 +18,6 @@ import time import traceback from typing import Callable, List -from cros_utils import command_executer from cros_utils import constants @@ -208,32 +207,6 @@ def CleanChromeOsTmpAndImages(days_to_preserve=1, dry_run=False) -> int: return rv -def CleanOldCLs(days_to_preserve: str = "1", dry_run: bool = False) -> int: - """Abandon old CLs created by automation tooling.""" - ce = command_executer.GetCommandExecuter() - chromeos_root = os.path.join(constants.CROSTC_WORKSPACE, "chromeos") - # Find Old CLs. - old_cls_cmd = ( - 'gerrit --raw search "owner:me status:open age:%sd"' % days_to_preserve - ) - _, cls, _ = ce.ChrootRunCommandWOutput( - chromeos_root, old_cls_cmd, print_to_console=False - ) - # Convert any whitespaces to spaces. - cls = " ".join(cls.split()) - if not cls: - return 0 - - abandon_cls_cmd = "gerrit abandon %s" % cls - if dry_run: - print("Going to execute: %s" % abandon_cls_cmd) - return 0 - - return ce.ChrootRunCommand( - chromeos_root, abandon_cls_cmd, print_to_console=False - ) - - def CleanChromeTelemetryTmpFiles(dry_run: bool) -> int: tmp_dir = Path(constants.CROSTC_WORKSPACE) / "chrome" / "src" / "tmp" return RemoveAllSubdirsMatchingPredicate( @@ -253,9 +226,6 @@ def Main(argv: List[str]) -> int: int(options.days_to_preserve), options.dry_run ) - # Clean CLs that are not updated in last 2 weeks. - rv |= CleanOldCLs("14", options.dry_run) - # Clean telemetry temporaries from chrome source tree inside chroot. rv |= CleanChromeTelemetryTmpFiles(options.dry_run) -- cgit v1.2.3 From 9b2e8e11812cd825ea2cc301554e08410fb9263e Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 12 Mar 2024 13:16:46 -0600 Subject: afdo_tools: print arch info when saying 'wrong version' ATM, this script just prints the kernel version that something went wrong on. This is unhelpful when only one of the two arches are failing. BUG=b:322182978 TEST=None Change-Id: I79e72dc9be9fe17a52f6b9ead8abae4f11c2ce8e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5367066 Reviewed-by: Ryan Beltran Commit-Queue: George Burgess Tested-by: George Burgess --- afdo_tools/update_kernel_afdo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afdo_tools/update_kernel_afdo b/afdo_tools/update_kernel_afdo index 26cfff55..3f159cc0 100755 --- a/afdo_tools/update_kernel_afdo +++ b/afdo_tools/update_kernel_afdo @@ -276,8 +276,8 @@ do if [ "${file_time_unix}" -lt "${expected_time}" ] then expected=$(env TZ=UTC date +%Y-%m-%dT%H:%M:%SZ -d @"${expected_time}") - echo "ERROR: Wrong date for ${kver}: ${file_time} is before\ - ${expected}" >&2 + echo "ERROR: Wrong date for ${arch_gsbase[${arch}]}/${kver}:\ + ${file_time} is before\ ${expected}" >&2 errs="${errs} ${kver}" continue fi -- cgit v1.2.3 From 013f7a3e990cee4e673e44b17d53d2dcd593fe84 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 13 Mar 2024 09:18:17 -0600 Subject: toolchain_utils_githooks: add --install_deps_only flag This flag is useful if folks who commit to toolchain-utils set up their chroots in some sort of background process. Saves time on `repo upload` since all deps are already installed. BUG=None TEST=Ran the script with --install_deps_only. Change-Id: I4414b16eec313ee6943fb76e559aa0e9a213bc76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5367609 Reviewed-by: Bob Haarman Commit-Queue: George Burgess Tested-by: George Burgess --- toolchain_utils_githooks/check-presubmit.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/toolchain_utils_githooks/check-presubmit.py b/toolchain_utils_githooks/check-presubmit.py index 2af7569c..561ac6ce 100755 --- a/toolchain_utils_githooks/check-presubmit.py +++ b/toolchain_utils_githooks/check-presubmit.py @@ -897,7 +897,9 @@ def is_in_chroot() -> bool: return os.path.exists("/etc/cros_chroot_version") -def maybe_reexec_inside_chroot(autofix: bool, files: List[str]) -> None: +def maybe_reexec_inside_chroot( + autofix: bool, install_deps_only: bool, files: List[str] +) -> None: if is_in_chroot(): return @@ -944,6 +946,8 @@ def maybe_reexec_inside_chroot(autofix: bool, files: List[str]) -> None: if not autofix: args.append("--no_autofix") + if install_deps_only: + args.append("--install_deps_only") args.extend(rebase_path(x) for x in files) if chdir_to is None: @@ -990,20 +994,39 @@ def main(argv: List[str]) -> int: action="store_false", help="Prevent auto-entering the chroot if we're not already in it.", ) + parser.add_argument( + "--install_deps_only", + action="store_true", + help=""" + Only install dependencies that would be required if presubmits were + being run, and quit. This skips all actual checking. + """, + ) parser.add_argument("files", nargs="*") opts = parser.parse_args(argv) files = opts.files - if not files: + install_deps_only = opts.install_deps_only + if not files and not install_deps_only: return 0 if opts.enter_chroot: - maybe_reexec_inside_chroot(opts.autofix, opts.files) + maybe_reexec_inside_chroot(opts.autofix, install_deps_only, files) # If you ask for --no_enter_chroot, you're on your own for installing these # things. if is_in_chroot(): ensure_pip_deps_installed() + if install_deps_only: + print( + "Dependency installation complete & --install_deps_only " + "passed. Quit." + ) + return 0 + elif install_deps_only: + parser.error( + "--install_deps_only is meaningless if the chroot isn't entered" + ) files = [os.path.abspath(f) for f in files] -- cgit v1.2.3 From 7539fd49c6ac33292f6308b3bc3411e490776e2c Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 13 Mar 2024 09:10:33 -0600 Subject: llvm_tools: support new LLVM_VERSION_MAJOR location BUG=b:325895866 TEST=Unittests Change-Id: Ia57ccf33a3d0ed6ee1071ca19dc5112caf306ba2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5367074 Commit-Queue: George Burgess Tested-by: George Burgess Reviewed-by: Jordan Abrahams-Whitehead --- llvm_tools/get_llvm_hash.py | 49 ++++++++++++------ llvm_tools/get_llvm_hash_unittest.py | 99 +++++++++++++++++++++++++++--------- 2 files changed, 107 insertions(+), 41 deletions(-) diff --git a/llvm_tools/get_llvm_hash.py b/llvm_tools/get_llvm_hash.py index e9a8990f..0922f685 100755 --- a/llvm_tools/get_llvm_hash.py +++ b/llvm_tools/get_llvm_hash.py @@ -81,23 +81,20 @@ def CheckoutBranch(src_dir: Union[Path, str], branch: str) -> None: subprocess_helpers.CheckCommand(["git", "-C", src_dir, "pull"]) -def ParseLLVMMajorVersion(cmakelist: str): +def ParseLLVMMajorVersion(cmakelist: str) -> Optional[str]: """Reads CMakeList.txt file contents for LLVMMajor Version. Args: cmakelist: contents of CMakeList.txt Returns: - The major version number as a string - - Raises: - ValueError: The major version cannot be parsed from cmakelist + The major version number as a string, or None if it couldn't be found. """ match = re.search( r"\n\s+set\(LLVM_VERSION_MAJOR (?P\d+)\)", cmakelist ) if not match: - raise ValueError("Failed to parse CMakeList for llvm major version") + return None return match.group("major") @@ -117,17 +114,37 @@ def GetLLVMMajorVersion(git_hash: Optional[str] = None) -> str: FileExistsError: The src directory doe not contain CMakeList.txt """ src_dir = GetAndUpdateLLVMProjectInLLVMTools() - cmakelists_path = os.path.join(src_dir, "llvm", "CMakeLists.txt") - if git_hash: - subprocess_helpers.CheckCommand( - ["git", "-C", src_dir, "checkout", git_hash] - ) - try: - with open(cmakelists_path, encoding="utf-8") as cmakelists_file: - return ParseLLVMMajorVersion(cmakelists_file.read()) - finally: + + # b/325895866#comment36: the LLVM version number was moved from + # `llvm/CMakeLists.txt` to `cmake/Modules/LLVMVersion.cmake` in upstream + # commit 81e20472a0c5a4a8edc5ec38dc345d580681af81 (r530225). Until we no + # longer care about looking before that, we need to support searching both + # files. + cmakelists_paths = ( + Path(src_dir) / "llvm" / "CMakeLists.txt", + Path(src_dir) / "cmake" / "Modules" / "LLVMVersion.cmake", + ) + + with contextlib.ExitStack() as on_exit: if git_hash: - CheckoutBranch(src_dir, git_llvm_rev.MAIN_BRANCH) + subprocess_helpers.CheckCommand( + ["git", "-C", src_dir, "checkout", git_hash] + ) + on_exit.callback(CheckoutBranch, src_dir, git_llvm_rev.MAIN_BRANCH) + + for path in cmakelists_paths: + try: + file_contents = path.read_text(encoding="utf-8") + except FileNotFoundError: + # If this file DNE (yet), ignore it. + continue + + if version := ParseLLVMMajorVersion(file_contents): + return version + + raise ValueError( + f"Major version could not be parsed from any of {cmakelists_paths}" + ) @contextlib.contextmanager diff --git a/llvm_tools/get_llvm_hash_unittest.py b/llvm_tools/get_llvm_hash_unittest.py index 66685ca1..3fb85861 100755 --- a/llvm_tools/get_llvm_hash_unittest.py +++ b/llvm_tools/get_llvm_hash_unittest.py @@ -6,7 +6,11 @@ """Unit tests for retrieving the LLVM hash.""" import contextlib +from pathlib import Path +import shutil import subprocess +import tempfile +import textwrap import unittest from unittest import mock @@ -28,6 +32,15 @@ def mock_run_results(returncode: int, stderr: bytes) -> mock.MagicMock: class TestGetLLVMHash(unittest.TestCase): """The LLVMHash test class.""" + def make_tempdir(self): + d = Path(tempfile.mkdtemp(prefix="get_llvm_hash_unittest_")) + self.addCleanup(shutil.rmtree, d) + return d + + def setUp(self): + # We mock out quite a bit. Ensure every test is self-contained. + get_llvm_hash.GetLLVMMajorVersion.cache_clear() + @mock.patch.object(subprocess, "run") def testCloneRepoSucceedsWhenGitSucceeds(self, run_mock): run_mock.return_value = mock_run_results(returncode=0, stderr=b"") @@ -121,38 +134,74 @@ class TestGetLLVMHash(unittest.TestCase): def testParseLLVMMajorVersionInvalid(self): invalid_cmakelist = "invalid cmakelist.txt contents" - with self.assertRaises(ValueError): + self.assertIsNone( get_llvm_hash.ParseLLVMMajorVersion(invalid_cmakelist) + ) @mock.patch.object(get_llvm_hash, "GetAndUpdateLLVMProjectInLLVMTools") - @mock.patch.object(get_llvm_hash, "ParseLLVMMajorVersion") @mock.patch.object(subprocess_helpers, "CheckCommand") - @mock.patch.object(get_llvm_hash, "CheckoutBranch") - @mock.patch( - "get_llvm_hash.open", - mock.mock_open(read_data="mock contents"), - create=True, - ) - def testGetLLVMMajorVersion( + def testGetLLVMMajorVersionWithOldPath( self, - mock_checkout_branch, - mock_git_checkout, - mock_major_version, - mock_llvm_project_path, + _mock_check_command, + mock_update_project, ): - mock_llvm_project_path.return_value = "path/to/llvm-project" - mock_major_version.return_value = "1234" - self.assertEqual(get_llvm_hash.GetLLVMMajorVersion("314159265"), "1234") - # Second call should be memoized - self.assertEqual(get_llvm_hash.GetLLVMMajorVersion("314159265"), "1234") - mock_llvm_project_path.assert_called_once() - mock_major_version.assert_called_with("mock contents") - mock_git_checkout.assert_called_once_with( - ["git", "-C", "path/to/llvm-project", "checkout", "314159265"] - ) - mock_checkout_branch.assert_called_once_with( - "path/to/llvm-project", "main" + src_dir = self.make_tempdir() + mock_update_project.return_value = str(src_dir) + + cmakelists = Path(src_dir) / "llvm" / "CMakeLists.txt" + cmakelists.parent.mkdir(parents=True) + cmakelists.write_text( + textwrap.dedent( + """ + if(NOT DEFINED LLVM_VERSION_MAJOR) + set(LLVM_VERSION_MAJOR 12345) + endif() + """ + ), + encoding="utf-8", ) + self.assertEqual(get_llvm_hash.GetLLVMMajorVersion(), "12345") + + @mock.patch.object(get_llvm_hash, "GetAndUpdateLLVMProjectInLLVMTools") + @mock.patch.object(subprocess_helpers, "CheckCommand") + def testGetLLVMMajorVersionWithNewPath( + self, + _mock_check_command, + mock_update_project, + ): + src_dir = self.make_tempdir() + mock_update_project.return_value = str(src_dir) + + old_cmakelists = Path(src_dir) / "llvm" / "CMakeLists.txt" + old_cmakelists.parent.mkdir(parents=True) + old_cmakelists.write_text( + textwrap.dedent( + """ + Some text + that has + nothing to do with + LLVM_VERSION_MAJOR + """ + ), + encoding="utf-8", + ) + + new_cmakelists = ( + Path(src_dir) / "cmake" / "Modules" / "LLVMVersion.cmake" + ) + new_cmakelists.parent.mkdir(parents=True) + new_cmakelists.write_text( + textwrap.dedent( + """ + if(NOT DEFINED LLVM_VERSION_MAJOR) + set(LLVM_VERSION_MAJOR 5432) + endif() + """ + ), + encoding="utf-8", + ) + + self.assertEqual(get_llvm_hash.GetLLVMMajorVersion(), "5432") if __name__ == "__main__": -- cgit v1.2.3 From 7b937beec14db2193752b9b596a29dde062cf4ba Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 11 Mar 2024 14:19:05 -0600 Subject: afdo_tools: skip kernel 5.4 temporarily in upgrades BUG=b:329127926, b:322182978 TEST=Ran the script, only beta failed instead of canary + beta + stable. Change-Id: Ib5a6f745ddf8d30802a0341f15299bafc660a188 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5362321 Reviewed-by: Ryan Beltran Commit-Queue: Ryan Beltran Auto-Submit: George Burgess Tested-by: George Burgess --- afdo_tools/update_kernel_afdo | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/afdo_tools/update_kernel_afdo b/afdo_tools/update_kernel_afdo index 3f159cc0..a8859d9e 100755 --- a/afdo_tools/update_kernel_afdo +++ b/afdo_tools/update_kernel_afdo @@ -62,6 +62,11 @@ declare -A SKIPPED_ARCHKVERS_IN_BRANCHES SKIPPED_ARCHKVERS_IN_BRANCHES["114"]="arm/5.15" SKIPPED_ARCHKVERS_IN_BRANCHES["115"]="arm/5.15" +for branch in 122 123 124 +do + SKIPPED_ARCHKVERS_IN_BRANCHES["${branch}"]="amd/5.4 arm/5.4" +done + script_dir=$(dirname "$0") tc_utils_dir="${script_dir}/.." # Convert toolchain_utils into the absolute path. -- cgit v1.2.3 From e351bbc6fe2df95f401ec1156998cc42d4c4c025 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Thu, 14 Mar 2024 13:53:44 -0600 Subject: afdo_tools: add update_kernel_afdo.py The intent is to replace `update_kernel_afdo` with this. BUG=b:329449239 TEST=Ran the script. Example CL this generated for canary: TEST=crrev.com/c/5372145 Change-Id: If5ca0f9055a60b0e7dedacd1c8b76aadc55561f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5373229 Commit-Queue: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Tested-by: George Burgess --- afdo_tools/update_kernel_afdo.py | 850 ++++++++++++++++++++++++++++ afdo_tools/update_kernel_afdo_test.py | 342 +++++++++++ toolchain_utils_githooks/check-presubmit.py | 1 + 3 files changed, 1193 insertions(+) create mode 100755 afdo_tools/update_kernel_afdo.py create mode 100755 afdo_tools/update_kernel_afdo_test.py diff --git a/afdo_tools/update_kernel_afdo.py b/afdo_tools/update_kernel_afdo.py new file mode 100755 index 00000000..fb0d34be --- /dev/null +++ b/afdo_tools/update_kernel_afdo.py @@ -0,0 +1,850 @@ +#!/usr/bin/env python3 +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""This script updates kernel profiles based on what's available in gs://. + +It supports updating on canary, stable, and beta branches. +""" + +import argparse +import contextlib +import dataclasses +import datetime +import enum +import json +import logging +import os +from pathlib import Path +import re +import shlex +import subprocess +import sys +import tempfile +from typing import Dict, Generator, Iterable, List, Optional, Tuple + + +# Folks who should be on the R-line of any CLs that get uploaded. +# Note that `c-compiler-chrome@` is managed by gwsq - it'll replace +# `R=c-compiler-chrome` with the current detective. +CL_REVIEWERS = ("c-compiler-chrome@google.com",) + +# Folks who should be on the CC-line of any CLs that get uploaded. +CL_CC = ( + "denik@google.com", + "gbiv@google.com", +) + + +class Arch(enum.Enum): + """An enum for CPU architectures.""" + + AMD64 = "amd64" + ARM = "arm" + + @property + def cwp_gs_location(self) -> str: + """Returns the location in gs:// where these profiles live.""" + if self == self.AMD64: + return "gs://chromeos-prebuilt/afdo-job/vetted/kernel/amd64" + if self == self.ARM: + return "gs://chromeos-prebuilt/afdo-job/vetted/kernel/arm" + assert False, f"Uncovered arch -> gs:// mapping for {self}" + + +@dataclasses.dataclass(frozen=True, eq=True, order=True) +class KernelVersion: + """A class representing a version of the kernel.""" + + major: int + minor: int + + def __str__(self): + return f"{self.major}.{self.minor}" + + @classmethod + def parse(cls, val: str) -> "KernelVersion": + m = re.fullmatch(r"(\d+).(\d+)", val) + if not m: + raise ValueError(f"{val!r} is an invalid kernel version") + return cls(major=int(m.group(1)), minor=int(m.group(2))) + + +# Versions that rolling should be skipped on, for one reason or another. +SKIPPED_VERSIONS: Dict[int, Iterable[Tuple[Arch, KernelVersion]]] = { + # Kernel tracing was disabled on ARM in 114, b/275560674 + 114: ((Arch.ARM, KernelVersion(5, 15)),), + 115: ((Arch.ARM, KernelVersion(5, 15)),), +} + + +class Channel(enum.Enum): + """An enum that discusses channels.""" + + # Ordered from closest-to-ToT to farthest-from-ToT + CANARY = "canary" + BETA = "beta" + STABLE = "stable" + + @classmethod + def parse(cls, val: str) -> "Channel": + for x in cls: + if val == x.value: + return x + raise ValueError( + f"No such channel: {val!r}; try one of {[x.value for x in cls]}" + ) + + +@dataclasses.dataclass(frozen=True) +class ProfileSelectionInfo: + """Preferences about profiles to select.""" + + # A consistent timestamp for the program to run with. + now: datetime.datetime + + # Maximum age of a profile that can be selected. + max_profile_age: datetime.timedelta + + +def get_parser(): + """Returns an argument parser for this script.""" + parser = argparse.ArgumentParser( + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, + ) + parser.add_argument( + "--debug", + action="store_true", + help="Enable debug logging.", + ) + parser.add_argument( + "--upload", + action="store_true", + help="Automatically upload all changes that were made.", + ) + parser.add_argument( + "--fetch", + action="store_true", + help="Run `git fetch` in toolchain-utils prior to running.", + ) + parser.add_argument( + "--max-age-days", + type=int, + default=10, + help=""" + The maximum number of days old a kernel profile can be before + it's ignored by this script. Default: %(default)s + """, + ) + parser.add_argument( + "channel", + nargs="*", + type=Channel.parse, + default=list(Channel), + help=f""" + Channel(s) to update. If none are passed, this will update all + channels. Choose from {[x.value for x in Channel]}. + """, + ) + return parser + + +@contextlib.contextmanager +def git_worktree(git_directory: Path) -> Generator[Path, None, None]: + """Creates a temp worktree of `git_directory`, yielding the result.""" + with tempfile.TemporaryDirectory(prefix="update_kernel_afdo_") as t: + tempdir = Path(t) + logging.info( + "Establishing worktree of %s in %s", git_directory, tempdir + ) + subprocess.run( + [ + "git", + "worktree", + "add", + "--detach", + "--force", + tempdir, + ], + cwd=git_directory, + check=True, + stdin=subprocess.DEVNULL, + ) + + try: + yield tempdir + finally: + # Explicitly `git worktree remove` here, so the parent worktree's + # metadata is cleaned up promptly. + subprocess.run( + [ + "git", + "worktree", + "remove", + "--force", + tempdir, + ], + cwd=git_directory, + check=False, + stdin=subprocess.DEVNULL, + ) + + +@dataclasses.dataclass(frozen=True, eq=True, order=True) +class GitBranch: + """Represents a ChromeOS branch.""" + + remote: str + release_number: int + branch_name: str + + +def git_checkout(git_dir: Path, branch: GitBranch) -> None: + subprocess.run( + [ + "git", + "checkout", + "--quiet", + f"{branch.remote}/{branch.branch_name}", + ], + check=True, + cwd=git_dir, + stdin=subprocess.DEVNULL, + ) + + +def git_fetch(git_dir: Path) -> None: + subprocess.run( + ["git", "fetch"], + check=True, + cwd=git_dir, + stdin=subprocess.DEVNULL, + ) + + +def git_rev_parse(git_dir: Path, ref_or_sha: str) -> str: + return subprocess.run( + ["git", "rev-parse", ref_or_sha], + check=True, + cwd=git_dir, + stdin=subprocess.DEVNULL, + stdout=subprocess.PIPE, + encoding="utf-8", + ).stdout.strip() + + +def autodetect_branches(toolchain_utils: Path) -> Dict[Channel, GitBranch]: + """Returns GitBranches for each branch type in toolchain_utils.""" + stdout = subprocess.run( + [ + "git", + "branch", + "-r", + ], + cwd=toolchain_utils, + check=True, + stdin=subprocess.DEVNULL, + stdout=subprocess.PIPE, + encoding="utf-8", + ).stdout + + # Match "${remote}/release-R${branch_number}-${build}.B" + branch_re = re.compile(r"([^/]+)/(release-R(\d+)-\d+\.B)") + branches = [] + for line in stdout.splitlines(): + line = line.strip() + if m := branch_re.fullmatch(line): + remote, branch_name, branch_number = m.groups() + branches.append(GitBranch(remote, int(branch_number), branch_name)) + + branches.sort(key=lambda x: x.release_number) + if len(branches) < 2: + raise ValueError( + f"Expected at least two branches, but only found {len(branches)}" + ) + + stable = branches[-2] + beta = branches[-1] + canary = GitBranch( + remote=beta.remote, + release_number=beta.release_number + 1, + branch_name="main", + ) + return { + Channel.CANARY: canary, + Channel.BETA: beta, + Channel.STABLE: stable, + } + + +@dataclasses.dataclass(frozen=True, eq=True, order=True) +class ArchUpdateConfig: + """The AFDO update config for one architecture.""" + + versions_to_track: List[KernelVersion] + metadata_file: Path + + +def read_update_cfg_file( + toolchain_utils: Path, file_path: Path +) -> Dict[Arch, ArchUpdateConfig]: + """Reads `update_kernel_afdo.cfg`.""" + # These files were originally meant to be `source`d in bash, and are very + # simple. These are read from branches, so we'd need cherry-picks to go + # back and replace them with a singular format. Could be nice to move to + # JSON or something. + + # Parse assignments that look like `FOO="bar"`. No escaping or variable + # expansion is supported. + kv_re = re.compile(r'^([a-zA-Z_0-9]+)="([^"]*)"(?:\s*#.*)?', re.MULTILINE) + kvs = kv_re.findall(file_path.read_text(encoding="utf-8")) + # Subtle: the regex above makes it so `kv_re.findall` returns a series of + # (variable_name, variable_value). + settings = dict(kvs) + + logging.debug("Parsing cfg file gave back settings: %s", settings) + archs = ( + (Arch.AMD64, "AMD"), + (Arch.ARM, "ARM"), + ) + + results = {} + for arch, arch_var_name in archs: + # This is a space-separated list of kernel versions. + kernel_versions = settings[f"{arch_var_name}_KVERS"] + parsed_versions = [ + KernelVersion.parse(x) for x in kernel_versions.split() + ] + + metadata_file = settings[f"{arch_var_name}_METADATA_FILE"] + results[arch] = ArchUpdateConfig( + versions_to_track=parsed_versions, + metadata_file=toolchain_utils / metadata_file, + ) + return results + + +@dataclasses.dataclass(frozen=True, eq=True) +class KernelGsProfile: + """Represents a kernel profile in gs://.""" + + release_number: int + chrome_build: str + cwp_timestamp: int + suffix: str + gs_timestamp: datetime.datetime + + _FILE_NAME_PARSE_RE = re.compile(r"R(\d+)-(\d+\.\d+)-(\d+)(\..+\..+)") + + @property + def file_name_no_suffix(self): + return ( + f"R{self.release_number}-{self.chrome_build}-{self.cwp_timestamp}" + ) + + @property + def file_name(self): + return f"{self.file_name_no_suffix}{self.suffix}" + + @classmethod + def from_file_name( + cls, timestamp: datetime.datetime, file_name: str + ) -> "KernelGsProfile": + m = cls._FILE_NAME_PARSE_RE.fullmatch(file_name) + if not m: + raise ValueError(f"{file_name!r} doesn't parse as a profile name") + release_number, chrome_build, cwp_timestamp, suffix = m.groups() + return cls( + release_number=int(release_number), + chrome_build=chrome_build, + cwp_timestamp=int(cwp_timestamp), + suffix=suffix, + gs_timestamp=timestamp, + ) + + +def datetime_from_gs_time(timestamp_str: str) -> datetime.datetime: + """Parses a datetime from gs.""" + return datetime.datetime.strptime( + timestamp_str, "%Y-%m-%dT%H:%M:%SZ" + ).replace(tzinfo=datetime.timezone.utc) + + +class KernelProfileFetcher: + """Fetches kernel profiles from gs://. Caches results.""" + + def __init__(self): + self._cached_results: Dict[str, List[KernelGsProfile]] = {} + + @staticmethod + def _parse_gs_stdout(stdout: str) -> List[KernelGsProfile]: + line_re = re.compile(r"\s*\d+\s+(\S+T\S+)\s+(gs://.+)") + results = [] + # Ignore the last line, since that's "TOTAL:" + for line in stdout.splitlines()[:-1]: + line = line.strip() + if not line: + continue + m = line_re.fullmatch(line) + if m is None: + raise ValueError(f"Unexpected line from gs: {line!r}") + timestamp_str, gs_url = m.groups() + timestamp = datetime_from_gs_time(timestamp_str) + file_name = os.path.basename(gs_url) + results.append(KernelGsProfile.from_file_name(timestamp, file_name)) + return results + + @classmethod + def _fetch_impl(cls, gs_url: str) -> List[KernelGsProfile]: + result = subprocess.run( + [ + "gsutil", + "ls", + "-l", + gs_url, + ], + check=False, + stdin=subprocess.DEVNULL, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", + ) + + if result.returncode: + # If nothing could be found, gsutil will exit after printing this. + if "One or more URLs matched no objects." in result.stderr: + return [] + logging.error( + "gsutil ls %s failed; stderr:\n%s", gs_url, result.stderr + ) + result.check_returncode() + assert False, "unreachable" + + return cls._parse_gs_stdout(result.stdout) + + def fetch(self, gs_url: str) -> List[KernelGsProfile]: + cached = self._cached_results.get(gs_url) + if cached is None: + logging.info("Fetching profiles from %s...", gs_url) + fetched = self._fetch_impl(gs_url) + logging.info("Found %d profiles in %s", len(fetched), gs_url) + self._cached_results[gs_url] = fetched + cached = fetched + + # Create a copy to keep mutations from causing problems. + # KernelGsProfiles are frozen, at least. + return cached[:] + + +def find_newest_afdo_artifact( + fetcher: KernelProfileFetcher, + arch: Arch, + kernel_version: KernelVersion, + release_number: int, +) -> Optional[KernelGsProfile]: + """Returns info about the latest AFDO artifact for the given parameters.""" + gs_base_location = arch.cwp_gs_location + kernel_profile_dir = os.path.join(gs_base_location, str(kernel_version)) + kernel_profiles = fetcher.fetch(kernel_profile_dir) + if not kernel_profiles: + logging.error( + "Failed to find any kernel profiles in %s", kernel_profile_dir + ) + return None + + valid_profiles = [ + x for x in kernel_profiles if x.release_number == release_number + ] + if not valid_profiles: + logging.error( + "Failed to find any M%d kernel profiles in %s", + release_number, + kernel_profile_dir, + ) + return None + + # We want the most recently uploaded profile, since that should correspond + # with the newest profile. If there're multiple profiles for some reason, + # choose what _should_ be a consistent tie-breaker. + return max( + valid_profiles, + key=lambda x: (x.gs_timestamp, x.cwp_timestamp, x.chrome_build), + ) + + +def read_afdo_descriptor_file(path: Path) -> Dict[KernelVersion, str]: + """Reads the AFDO descriptor file. + + "AFDO descriptor file" is jargon to refer to the actual JSON file that PUpr + monitors. + """ + try: + with path.open(encoding="utf-8") as f: + raw_contents = json.load(f) + except FileNotFoundError: + return {} + + # The format of this is: + # { + # "chromeos-kernel-${major}_${minor}": { + # "name": "${profile_gs_name}", + # } + # } + key_re = re.compile(r"^chromeos-kernel-(\d)+_(\d+)$") + result = {} + for kernel_key, val in raw_contents.items(): + m = key_re.fullmatch(kernel_key) + if not m: + raise ValueError(f"Invalid key in JSON: {kernel_key}") + major, minor = m.groups() + version = KernelVersion(major=int(major), minor=int(minor)) + result[version] = val["name"] + return result + + +def write_afdo_descriptor_file( + path: Path, contents: Dict[KernelVersion, str] +) -> bool: + """Writes the file at path with the given contents. + + Returns: + True if the file was written due to changes, False otherwise. + """ + contents_dict = { + f"chromeos-kernel-{k.major}_{k.minor}": {"name": gs_name} + for k, gs_name in contents.items() + } + + contents_json = json.dumps(contents_dict, indent=4, sort_keys=True) + try: + existing_contents = path.read_text(encoding="utf-8") + except FileNotFoundError: + existing_contents = "" + + # Compare the _textual representation_ of each of these, since things like + # formatting changes should be propagated eagerly. + if contents_json == existing_contents: + return False + + tmp_path = path.with_suffix(".json.tmp") + tmp_path.write_text(contents_json, encoding="utf-8") + tmp_path.rename(path) + return True + + +@dataclasses.dataclass +class UpdateResult: + """Result of `update_afdo_for_channel`.""" + + # True if changes were made to the AFDO files that map kernel versions to + # AFDO profiles. + made_changes: bool + + # Whether issues were had updating one or more profiles. If this is True, + # you may expect that there will be logs about the issues already. + had_failures: bool + + +def fetch_and_validate_newest_afdo_artifact( + fetcher: KernelProfileFetcher, + selection_info: ProfileSelectionInfo, + arch: Arch, + kernel_version: KernelVersion, + branch: GitBranch, + channel: Channel, +) -> Optional[str]: + """Tries to update one AFDO profile on a branch. + + Returns: + The newest artifact name if all went well. None if something failed + along the way, and the update couldn't be completed. + """ + newest_artifact = find_newest_afdo_artifact( + fetcher, arch, kernel_version, branch.release_number + ) + # Try an older branch if we're not on stable. We should fail harder if we + # only have old profiles on stable, though. + if newest_artifact is None and channel != Channel.STABLE: + newest_artifact = find_newest_afdo_artifact( + fetcher, arch, kernel_version, branch.release_number - 1 + ) + + if newest_artifact is None: + logging.error( + "No new profile found for %s/%s on M%d; not updating entry", + arch, + kernel_version, + branch.release_number, + ) + return None + + logging.info( + "Newest profile is %s for %s/%s on M%d", + newest_artifact.file_name, + arch, + kernel_version, + branch.release_number, + ) + age = selection_info.now - newest_artifact.gs_timestamp + if age > selection_info.max_profile_age: + logging.error( + "Profile %s is %s old. Skipping it, since the configured limit " + "is %s.", + newest_artifact.file_name, + age, + selection_info.max_profile_age, + ) + return None + return newest_artifact.file_name_no_suffix + + +def update_afdo_for_channel( + fetcher: KernelProfileFetcher, + toolchain_utils: Path, + selection_info: ProfileSelectionInfo, + channel: Channel, + branch: GitBranch, + skipped_versions: Dict[int, Iterable[Tuple[Arch, KernelVersion]]], +) -> UpdateResult: + """Updates AFDO on the given channel.""" + git_checkout(toolchain_utils, branch) + update_cfgs = read_update_cfg_file( + toolchain_utils, + toolchain_utils / "afdo_tools" / "update_kernel_afdo.cfg", + ) + + to_skip = skipped_versions.get(branch.release_number) + made_changes = False + had_failures = False + for arch, cfg in update_cfgs.items(): + afdo_mappings = read_afdo_descriptor_file(cfg.metadata_file) + for kernel_version in cfg.versions_to_track: + if to_skip and (arch, kernel_version) in to_skip: + logging.info( + "%s/%s on M%d is in the skip list; ignoring it.", + arch, + kernel_version, + branch.release_number, + ) + continue + + newest_name = fetch_and_validate_newest_afdo_artifact( + fetcher, + selection_info, + arch, + kernel_version, + branch, + channel, + ) + if newest_name is None: + # Assume that the problem was already logged. + had_failures = True + else: + afdo_mappings[kernel_version] = newest_name + + if write_afdo_descriptor_file(cfg.metadata_file, afdo_mappings): + made_changes = True + logging.info( + "Wrote new AFDO mappings for arch %s on M%d", + arch, + branch.release_number, + ) + else: + logging.info( + "No changes to write for arch %s on M%d", + arch, + branch.release_number, + ) + return UpdateResult( + made_changes=made_changes, + had_failures=had_failures, + ) + + +def commit_new_profiles( + toolchain_utils: Path, channel: Channel, had_failures: bool +): + """Runs `git commit -a` with an appropriate message.""" + commit_message_lines = [ + "afdo_metadata: Publish the new kernel profiles", + "", + ] + + if had_failures: + commit_message_lines += ( + "This brings some profiles to their newest versions. The CrOS", + "toolchain detective has been notified about the failures that", + "occurred in this update.", + ) + else: + commit_message_lines.append( + "This brings all profiles to their newest versions." + ) + + if channel != Channel.CANARY: + commit_message_lines += ( + "", + "Have PM pre-approval because this shouldn't break the release", + "branch.", + ) + + commit_message_lines += ( + "", + "BUG=None", + "TEST=Verified in kernel-release-afdo-verify-orchestrator", + ) + + commit_msg = "\n".join(commit_message_lines) + subprocess.run( + [ + "git", + "commit", + "--quiet", + "-a", + "-m", + commit_msg, + ], + cwd=toolchain_utils, + check=True, + stdin=subprocess.DEVNULL, + ) + + +def parse_cl_from_upload_output(upload_output: str) -> str: + """Returns the CL number in the given upload output.""" + id_regex = re.compile( + r"^remote:\s+https://chromium-review\S+/\+/(\d+)\s", re.MULTILINE + ) + + results = id_regex.findall(upload_output) + if len(results) != 1: + raise ValueError( + f"Wanted exactly one match for {id_regex} in {upload_output!r}; " + f"found {len(results)}" + ) + return results[0] + + +def upload_head_to_gerrit( + toolchain_utils: Path, + branch: GitBranch, +): + """Uploads HEAD to gerrit as a CL, and sets reviewers/CCs.""" + reviewers = ",".join(CL_REVIEWERS) + cc = ",".join(CL_CC) + run_result = subprocess.run( + [ + "git", + "push", + branch.remote, + # https://gerrit-review.googlesource.com/Documentation/user-upload.html#reviewers + # for more info on the `%` params. + f"HEAD:refs/for/{branch.branch_name}%r={reviewers},cc={cc}", + ], + cwd=toolchain_utils, + check=False, + stdin=subprocess.DEVNULL, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + encoding="utf-8", + ) + + logging.info( + "`git push`ing to %s had this output:\n%s", + branch.branch_name, + run_result.stdout, + ) + run_result.check_returncode() + + cl_id = parse_cl_from_upload_output(run_result.stdout) + logging.info("Uploaded CL http://crrev.com/c/%s successfully.", cl_id) + + # To make the life of the reviewers marginally easier, click buttons + # automatically. + gerrit_commands = ( + ["gerrit", "label-as", cl_id, "1"], + ["gerrit", "label-cq", cl_id, "1"], + ["gerrit", "label-v", cl_id, "1"], + ) + for cmd in gerrit_commands: + # Run the gerrit commands inside of toolchain_utils, since `gerrit` + # needs to be run inside of a ChromeOS tree to work. While + # `toolchain-utils` can be checked out on its own, that's not how this + # script is expeted to be used. + return_code = subprocess.run( + cmd, + check=False, + stdin=subprocess.DEVNULL, + ).returncode + if return_code: + logging.warning( + "Failed to run gerrit command %s. Ignoring.", + shlex.join(cmd), + ) + + +def main(argv: List[str]) -> None: + my_dir = Path(__file__).resolve().parent + toolchain_utils = my_dir.parent + + opts = get_parser().parse_args(argv) + logging.basicConfig( + format=">> %(asctime)s: %(levelname)s: %(filename)s:%(lineno)d: " + "%(message)s", + level=logging.DEBUG if opts.debug else logging.INFO, + ) + + if opts.fetch: + logging.info("Fetching in %s...", toolchain_utils) + git_fetch(toolchain_utils) + + selection_info = ProfileSelectionInfo( + now=datetime.datetime.now(datetime.timezone.utc), + max_profile_age=datetime.timedelta(days=opts.max_age_days), + ) + + branches = autodetect_branches(toolchain_utils) + logging.debug("Current branches: %s", branches) + + assert all(x in branches for x in Channel), "branches are missing channels?" + + fetcher = KernelProfileFetcher() + had_failures = False + with git_worktree(toolchain_utils) as worktree: + for channel in opts.channel: + branch = branches[channel] + result = update_afdo_for_channel( + fetcher, + worktree, + selection_info, + channel, + branch, + SKIPPED_VERSIONS, + ) + had_failures = had_failures or result.had_failures + if not result.made_changes: + logging.info("No new updates to post on %s", channel) + continue + + commit_new_profiles(worktree, channel, result.had_failures) + if opts.upload: + logging.info("New profiles were committed. Uploading...") + upload_head_to_gerrit(worktree, branch) + else: + logging.info( + "--upload not specified. Leaving commit for %s at %s", + channel, + git_rev_parse(worktree, "HEAD"), + ) + + if had_failures: + sys.exit( + "At least one failure was encountered running this script; see " + "above logs." + ) + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/afdo_tools/update_kernel_afdo_test.py b/afdo_tools/update_kernel_afdo_test.py new file mode 100755 index 00000000..60f52138 --- /dev/null +++ b/afdo_tools/update_kernel_afdo_test.py @@ -0,0 +1,342 @@ +#!/usr/bin/env python3 +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Tests for update_kernel_afdo.""" + +import datetime +from pathlib import Path +import shutil +import subprocess +import tempfile +import textwrap +import unittest +from unittest import mock + +import update_kernel_afdo + + +GERRIT_OUTPUT_WITH_ONE_CL = """ +Enumerating objects: 4, done. +Counting objects: 100% (4/4), done. +Delta compression using up to 128 threads +Compressing objects: 100% (2/2), done. +Writing objects: 100% (3/3), 320 bytes | 106.00 KiB/s, done. +Total 3 (delta 1), reused 1 (delta 0), pack-reused 0 (from 0) +remote: Resolving deltas: 100% (1/1) +remote: Processing changes: refs: 1, new: 1, done +remote: +remote: SUCCESS +remote: +remote: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5375204 DO NOT COMMIT [WIP] [NEW] +remote: +To https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils + * [new reference] HEAD -> refs/for/main +""" + +GERRIT_OUTPUT_WITH_TWO_CLS = """ +Enumerating objects: 4, done. +Counting objects: 100% (4/4), done. +Delta compression using up to 128 threads +Compressing objects: 100% (2/2), done. +Writing objects: 100% (3/3), 320 bytes | 106.00 KiB/s, done. +Total 3 (delta 1), reused 1 (delta 0), pack-reused 0 (from 0) +remote: Resolving deltas: 100% (1/1) +remote: Processing changes: refs: 1, new: 1, done +remote: +remote: SUCCESS +remote: +remote: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5375204 DO NOT COMMIT [WIP] [NEW] +remote: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5375205 DO NOT COMMIT [WIP] [NEW] +remote: +To https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils + * [new reference] HEAD -> refs/for/main +""" + + +class Test(unittest.TestCase): + """Tests for update_kernel_afdo.""" + + def make_tempdir(self) -> Path: + x = Path(tempfile.mkdtemp(prefix="update_kernel_afdo_test_")) + self.addCleanup(shutil.rmtree, x) + return x + + def test_kernel_version_parsing(self): + self.assertEqual( + update_kernel_afdo.KernelVersion.parse("5.10"), + update_kernel_afdo.KernelVersion(major=5, minor=10), + ) + + with self.assertRaisesRegex(ValueError, ".*invalid kernel version.*"): + update_kernel_afdo.KernelVersion.parse("5") + + def test_kernel_version_formatting(self): + self.assertEqual( + str(update_kernel_afdo.KernelVersion(major=5, minor=10)), "5.10" + ) + + def test_channel_parsing(self): + with self.assertRaisesRegex(ValueError, "No such channel.*"): + update_kernel_afdo.Channel.parse("not a channel") + + # Ensure these round-trip. + for channel in update_kernel_afdo.Channel: + self.assertEqual( + channel, update_kernel_afdo.Channel.parse(channel.value) + ) + + @mock.patch.object(subprocess, "run") + def test_branch_autodetection(self, subprocess_run): + subprocess_run.return_value = subprocess.CompletedProcess( + args=[], + returncode=0, + stdout=textwrap.dedent( + """ + cros/not-a-release-branch + cros/release-R121-15699.B + cros/release-R122-15753.B + cros/release-R123-15786.B + cros/also-not-a-release-branch + m/main + """ + ), + ) + + branch_dict = update_kernel_afdo.autodetect_branches( + toolchain_utils=self.make_tempdir() + ) + + self.assertEqual( + branch_dict, + { + update_kernel_afdo.Channel.CANARY: update_kernel_afdo.GitBranch( + remote="cros", + release_number=124, + branch_name="main", + ), + update_kernel_afdo.Channel.BETA: update_kernel_afdo.GitBranch( + remote="cros", + release_number=123, + branch_name="release-R123-15786.B", + ), + update_kernel_afdo.Channel.STABLE: update_kernel_afdo.GitBranch( + remote="cros", + release_number=122, + branch_name="release-R122-15753.B", + ), + }, + ) + + def test_read_update_cfg_file(self): + valid_contents = textwrap.dedent( + """ + # some comment + # wow + AMD_KVERS="1.0 1.1" + ARM_KVERS="1.2" + AMD_METADATA_FILE="amd/file/path.json" # comment + ARM_METADATA_FILE="arm/file/path.json" + """ + ) + tmpdir = self.make_tempdir() + cfg_path = tmpdir / "test.cfg" + cfg_path.write_text(valid_contents, encoding="utf-8") + cfg = update_kernel_afdo.read_update_cfg_file(tmpdir, cfg_path) + expected_amd64 = update_kernel_afdo.ArchUpdateConfig( + versions_to_track=[ + update_kernel_afdo.KernelVersion(1, 0), + update_kernel_afdo.KernelVersion(1, 1), + ], + metadata_file=tmpdir / "amd/file/path.json", + ) + expected_arm = update_kernel_afdo.ArchUpdateConfig( + versions_to_track=[ + update_kernel_afdo.KernelVersion(1, 2), + ], + metadata_file=tmpdir / "arm/file/path.json", + ) + + self.assertEqual( + cfg, + { + update_kernel_afdo.Arch.AMD64: expected_amd64, + update_kernel_afdo.Arch.ARM: expected_arm, + }, + ) + + def test_parse_kernel_gs_profile(self): + timestamp = datetime.datetime.fromtimestamp(1234, datetime.timezone.utc) + profile = update_kernel_afdo.KernelGsProfile.from_file_name( + timestamp, + "R124-15808.0-1710149961.gcov.xz", + ) + self.assertEqual( + profile, + update_kernel_afdo.KernelGsProfile( + release_number=124, + chrome_build="15808.0", + cwp_timestamp=1710149961, + suffix=".gcov.xz", + gs_timestamp=timestamp, + ), + ) + + def test_kernel_gs_profile_file_name(self): + timestamp = datetime.datetime.fromtimestamp(1234, datetime.timezone.utc) + profile = update_kernel_afdo.KernelGsProfile.from_file_name( + timestamp, + "R124-15808.0-1710149961.gcov.xz", + ) + self.assertEqual(profile.file_name_no_suffix, "R124-15808.0-1710149961") + self.assertEqual(profile.file_name, "R124-15808.0-1710149961.gcov.xz") + + def test_gs_time_parsing(self): + self.assertEqual( + update_kernel_afdo.datetime_from_gs_time("2024-03-04T10:38:50Z"), + datetime.datetime( + year=2024, + month=3, + day=4, + hour=10, + minute=38, + second=50, + tzinfo=datetime.timezone.utc, + ), + ) + + @mock.patch.object(subprocess, "run") + def test_kernel_profile_fetcher_works(self, subprocess_run): + subprocess_run.return_value = subprocess.CompletedProcess( + args=[], + returncode=0, + # Don't use textwrap.dedent; linter complains about the line being + # too long in that case. + stdout=""" +753112 2024-03-04T10:38:50Z gs://here/5.4/R124-15786.10-1709548729.gcov.xz +TOTAL: 2 objects, 1234 bytes (1.1KiB) +""", + ) + + fetcher = update_kernel_afdo.KernelProfileFetcher() + results = fetcher.fetch("gs://here/5.4") + + expected_results = [ + update_kernel_afdo.KernelGsProfile.from_file_name( + update_kernel_afdo.datetime_from_gs_time( + "2024-03-04T10:38:50Z" + ), + "R124-15786.10-1709548729.gcov.xz", + ), + ] + self.assertEqual(results, expected_results) + + @mock.patch.object(subprocess, "run") + def test_kernel_profile_fetcher_handles_no_profiles(self, subprocess_run): + subprocess_run.return_value = subprocess.CompletedProcess( + args=[], + returncode=1, + stderr="\nCommandException: One or more URLs matched no objects.\n", + ) + + fetcher = update_kernel_afdo.KernelProfileFetcher() + results = fetcher.fetch("gs://here/5.4") + self.assertEqual(results, []) + + @mock.patch.object(subprocess, "run") + def test_kernel_profile_fetcher_caches_urls(self, subprocess_run): + subprocess_run.return_value = subprocess.CompletedProcess( + args=[], + returncode=0, + # Don't use textwrap.dedent; linter complains about the line being + # too long in that case. + stdout=""" +753112 2024-03-04T10:38:50Z gs://here/5.4/R124-15786.10-1709548729.gcov.xz +TOTAL: 2 objects, 1234 bytes (1.1KiB) +""", + ) + + fetcher = update_kernel_afdo.KernelProfileFetcher() + # Fetch these twice, and assert both that: + # - Only one fetch is performed. + # - Mutating the first list won't impact the later fetch. + result = fetcher.fetch("gs://here/5.4") + self.assertEqual(len(result), 1) + del result[:] + result = fetcher.fetch("gs://here/5.4") + self.assertEqual(len(result), 1) + subprocess_run.assert_called_once() + + @mock.patch.object(update_kernel_afdo.KernelProfileFetcher, "fetch") + def test_newest_afdo_artifact_finding_works(self, fetch): + late = update_kernel_afdo.KernelGsProfile.from_file_name( + datetime.datetime.fromtimestamp(1236, datetime.timezone.utc), + "R124-15786.10-1709548729.gcov.xz", + ) + early = update_kernel_afdo.KernelGsProfile.from_file_name( + datetime.datetime.fromtimestamp(1234, datetime.timezone.utc), + "R124-99999.99-9999999999.gcov.xz", + ) + fetch.return_value = [early, late] + + self.assertEqual( + update_kernel_afdo.find_newest_afdo_artifact( + update_kernel_afdo.KernelProfileFetcher(), + update_kernel_afdo.Arch.AMD64, + update_kernel_afdo.KernelVersion(5, 4), + release_number=124, + ), + late, + ) + + def test_afdo_descriptor_file_round_trips(self): + tmpdir = self.make_tempdir() + file_path = tmpdir / "desc-file.json" + + contents = { + update_kernel_afdo.KernelVersion(5, 10): "file1", + update_kernel_afdo.KernelVersion(5, 15): "file2", + } + self.assertTrue( + update_kernel_afdo.write_afdo_descriptor_file(file_path, contents) + ) + self.assertEqual( + update_kernel_afdo.read_afdo_descriptor_file(file_path), + contents, + ) + + def test_afdo_descriptor_file_refuses_to_rewrite_identical_contents(self): + tmpdir = self.make_tempdir() + file_path = tmpdir / "desc-file.json" + + contents = { + update_kernel_afdo.KernelVersion(5, 10): "file1", + update_kernel_afdo.KernelVersion(5, 15): "file2", + } + self.assertTrue( + update_kernel_afdo.write_afdo_descriptor_file(file_path, contents) + ) + self.assertFalse( + update_kernel_afdo.write_afdo_descriptor_file(file_path, contents) + ) + + def test_cl_parsing_from_gerrit_output(self): + self.assertEqual( + update_kernel_afdo.parse_cl_from_upload_output( + GERRIT_OUTPUT_WITH_ONE_CL + ), + "5375204", + ) + + with self.assertRaisesRegex(ValueError, ".*; found 0"): + update_kernel_afdo.parse_cl_from_upload_output("") + + with self.assertRaisesRegex(ValueError, ".*; found 2"): + update_kernel_afdo.parse_cl_from_upload_output( + GERRIT_OUTPUT_WITH_TWO_CLS + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/toolchain_utils_githooks/check-presubmit.py b/toolchain_utils_githooks/check-presubmit.py index 561ac6ce..995773a2 100755 --- a/toolchain_utils_githooks/check-presubmit.py +++ b/toolchain_utils_githooks/check-presubmit.py @@ -72,6 +72,7 @@ CheckResults = Union[List[Tuple[str, CheckResult]], CheckResult] # The files and directories on which we run the mypy typechecker. The paths are # relative to the root of the toolchain-utils repository. MYPY_CHECKED_PATHS = ( + "afdo_tools/update_kernel_afdo.py", "check_portable_toolchains.py", "cros_utils/bugs.py", "cros_utils/bugs_test.py", -- cgit v1.2.3 From 83ca115aa7fcdf116fa9b95d842678becf86625a Mon Sep 17 00:00:00 2001 From: mobiletc-prebuild Date: Mon, 18 Mar 2024 07:21:22 -0700 Subject: afdo_metadata: Publish the new kernel profiles This brings some profiles to their newest versions. The CrOS toolchain detective has been notified about the failures that occurred in this update. BUG=None TEST=Verified in kernel-release-afdo-verify-orchestrator Change-Id: I6219402eee7471e7c1168f9b5fdbf27ab2f17d95 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5378060 Reviewed-by: George Burgess Commit-Queue: George Burgess Tested-by: George Burgess --- afdo_metadata/kernel_afdo.json | 15 +++++++++------ afdo_metadata/kernel_arm_afdo.json | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/afdo_metadata/kernel_afdo.json b/afdo_metadata/kernel_afdo.json index d752cadd..7700c0cd 100644 --- a/afdo_metadata/kernel_afdo.json +++ b/afdo_metadata/kernel_afdo.json @@ -1,11 +1,14 @@ { - "chromeos-kernel-5_4": { - "name": "R121-15699.29-1705314853" - }, "chromeos-kernel-5_10": { - "name": "R122-15699.25-1704709934" + "name": "R124-15810.0-1710149511" }, "chromeos-kernel-5_15": { - "name": "R122-15699.25-1704709973" + "name": "R124-15810.0-1710149698" + }, + "chromeos-kernel-5_4": { + "name": "R124-15808.0-1710149961" + }, + "chromeos-kernel-6_1": { + "name": "R124-15810.0-1710149738" } -} +} \ No newline at end of file diff --git a/afdo_metadata/kernel_arm_afdo.json b/afdo_metadata/kernel_arm_afdo.json index cbe71c51..d7dec9d5 100644 --- a/afdo_metadata/kernel_arm_afdo.json +++ b/afdo_metadata/kernel_arm_afdo.json @@ -2,4 +2,4 @@ "chromeos-kernel-5_15": { "name": "R122-15699.25-1704710142" } -} +} \ No newline at end of file -- cgit v1.2.3 From 112b4b64349ff15a53b78b1f8d06b2e3ddd50610 Mon Sep 17 00:00:00 2001 From: mobiletc-prebuild Date: Mon, 18 Mar 2024 08:00:31 -0700 Subject: compiler_wrapper: automatic sync This CL automatically brings toolchain-utils' compiler_wrapper/ directory in sync with chromiumos-overlay's. Please see go/crostc-repo/+/main:sync_compiler_wrapper_within_cros.sh for more info on this process. BUG=None TEST=None Change-Id: Ibbbfbf6006d19546b43edd8805013cd3a0abdf98 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5375898 Auto-Submit: mobiletc-prebuild Role Account Reviewed-by: George Burgess Tested-by: mobiletc-prebuild Role Account Commit-Queue: George Burgess --- compiler_wrapper/config.go | 6 ------ compiler_wrapper/disable_werror_flag.go | 12 ++++++++---- compiler_wrapper/disable_werror_flag_test.go | 1 - compiler_wrapper/testutil_test.go | 5 ----- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/compiler_wrapper/config.go b/compiler_wrapper/config.go index 5bfc8009..44d9d68f 100644 --- a/compiler_wrapper/config.go +++ b/compiler_wrapper/config.go @@ -28,8 +28,6 @@ type config struct { // Toolchain root path relative to the wrapper binary. clangRootRelPath string gccRootRelPath string - // Directory to store errors that were prevented with -Wno-error. - newWarningsDir string // Version. Only exposed via -print-config. version string } @@ -165,7 +163,6 @@ var crosHardenedConfig = config{ "-ftrivial-auto-var-init=zero", ), clangPostFlags: crosCommonClangPostFlags(), - newWarningsDir: "fatal_clang_warnings", } // Flags to be added to non-hardened toolchain. @@ -185,7 +182,6 @@ var crosNonHardenedConfig = config{ "-Wno-section", ), clangPostFlags: crosCommonClangPostFlags(), - newWarningsDir: "fatal_clang_warnings", } // Flags to be added to host toolchain. @@ -212,7 +208,6 @@ var crosHostConfig = config{ ), // Temporarily disable Wdeprecated-copy. b/191479033 clangPostFlags: crosCommonClangPostFlags(), - newWarningsDir: "fatal_clang_warnings", } var androidConfig = config{ @@ -224,5 +219,4 @@ var androidConfig = config{ gccFlags: []string{}, clangFlags: []string{}, clangPostFlags: []string{}, - newWarningsDir: "", } diff --git a/compiler_wrapper/disable_werror_flag.go b/compiler_wrapper/disable_werror_flag.go index b6dd844f..45e818fa 100644 --- a/compiler_wrapper/disable_werror_flag.go +++ b/compiler_wrapper/disable_werror_flag.go @@ -20,7 +20,7 @@ import ( const numWErrorEstimate = 30 func getForceDisableWerrorDir(env env, cfg *config) string { - return path.Join(getCompilerArtifactsDir(env), cfg.newWarningsDir) + return path.Join(getCompilerArtifactsDir(env), "toolchain/fatal_clang_warnings") } type forceDisableWerrorConfig struct { @@ -49,9 +49,13 @@ func processForceDisableWerrorFlag(env env, cfg *config, builder *commandBuilder // `-D_CROSTC_FORCE_DISABLE_WERROR=/path/to/directory`. This flag will be removed from the // command before the compiler is invoked. If multiple of these are passed, the last one // wins, but all are removed from the build command. - // 2 (deprecated). An environment variable, FORCE_DISABLE_WERROR, set to any nonempty value. - // In this case, the wrapper will write to either somewhere under - // ${CROS_ARTIFACTS_TMP_DIR}, or to /tmp. + // 2 (dispreferred, but supported). An environment variable, FORCE_DISABLE_WERROR, set to + // any nonempty value. In this case, the wrapper will write to either + // ${CROS_ARTIFACTS_TMP_DIR}/toolchain/fatal_clang_warnings, or to + // /tmp/toolchain/fatal_clang_warnings. + // + // Two modes are supported because some ebuilds filter the env, while others will filter + // CFLAGS. Vanishingly few (none?) filter both, though. const cflagPrefix = "-D_CROSTC_FORCE_DISABLE_WERROR=" argDir := "" diff --git a/compiler_wrapper/disable_werror_flag_test.go b/compiler_wrapper/disable_werror_flag_test.go index 639d404a..dce0b29e 100644 --- a/compiler_wrapper/disable_werror_flag_test.go +++ b/compiler_wrapper/disable_werror_flag_test.go @@ -377,7 +377,6 @@ func withForceDisableWErrorTestContext(t *testing.T, work func(ctx *testContext) withTestContext(t, func(ctx *testContext) { ctx.NoteTestWritesToUmask() - ctx.cfg.newWarningsDir = "new_warnings" ctx.env = []string{ "FORCE_DISABLE_WERROR=1", artifactsTmpDirEnvName + "=" + path.Join(ctx.tempDir, "artifacts"), diff --git a/compiler_wrapper/testutil_test.go b/compiler_wrapper/testutil_test.go index 7b50d4bb..6c5f1da8 100644 --- a/compiler_wrapper/testutil_test.go +++ b/compiler_wrapper/testutil_test.go @@ -196,11 +196,6 @@ func (ctx *testContext) mustFail(exitCode int) string { func (ctx *testContext) updateConfig(cfg *config) { *ctx.cfg = *cfg - ctx.cfg.newWarningsDir = filepath.Join(ctx.tempDir, "fatal_clang_warnings") - - // Ensure this is always empty, so any test that depends on it will see no output unless - // it's properly set up. - ctx.cfg.newWarningsDir = "" } func (ctx *testContext) newCommand(path string, args ...string) *command { -- cgit v1.2.3 From 23453f961a3fb7017cf5c2a83f65902b7e127e7e Mon Sep 17 00:00:00 2001 From: Ryan Beltran Date: Wed, 13 Dec 2023 18:40:59 +0000 Subject: llvm_tools: add llvm_simple_bisect.py Normally for bisecting llvm we use llvm_local_bisection script with modifications for the steps we are running and the tests we want to perform, which works fine but requires some setup and it's easy to make mistakes. This tool may be a little less versatile than that one, but it simplifies the majority of usecases including: * Bisecting a command such as "emerge my_package" that fails with a specific message for some versions of LLVM * Bisecting a failure in building LLVM itself The test command can be replaced with a script if desired to test complicated things such as correctness, build times, etc. What's not supported by this tool as of yet and therefore justifies having the old one as well still is full customization of the llvm build command, including hooks that run before building llvm. Some aspects of the LLVM build are configurable including certain USE flags. BUG=b:316209470 TEST=Used to bisect a failure in chromeos-base/ml Change-Id: I93b51cff186bcc2379b1a73b98a5d518ef4f3f92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5120397 Auto-Submit: Ryan Beltran Commit-Queue: George Burgess Tested-by: Ryan Beltran Reviewed-by: George Burgess --- llvm_tools/chroot.py | 10 ++ llvm_tools/llvm_simple_bisect.py | 351 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 361 insertions(+) create mode 100755 llvm_tools/llvm_simple_bisect.py diff --git a/llvm_tools/chroot.py b/llvm_tools/chroot.py index 23c188c6..1dcf8e66 100755 --- a/llvm_tools/chroot.py +++ b/llvm_tools/chroot.py @@ -16,6 +16,16 @@ def InChroot() -> bool: return "CROS_WORKON_SRCROOT" in os.environ +def VerifyInsideChroot() -> None: + """Checks whether the script invoked was executed in the chroot. + + Raises: + AssertionError: The script was run outside the chroot. + """ + + assert InChroot(), "Script should be run inside the chroot." + + def VerifyOutsideChroot() -> None: """Checks whether the script invoked was executed in the chroot. diff --git a/llvm_tools/llvm_simple_bisect.py b/llvm_tools/llvm_simple_bisect.py new file mode 100755 index 00000000..433fec77 --- /dev/null +++ b/llvm_tools/llvm_simple_bisect.py @@ -0,0 +1,351 @@ +#!/usr/bin/env python3 +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Simple LLVM Bisection Script for use with the llvm-9999 ebuild. + +Example usage with `git bisect`: + + cd path/to/llvm-project + git bisect good + git bisect bad + git bisect run \ + path/to/llvm_tools/llvm_simple_bisect.py --reset-llvm \ + --test "emerge-atlas package" \ + --search-error "some error that I care about" +""" + +import argparse +import dataclasses +import logging +import os +from pathlib import Path +import subprocess +import sys +from typing import Optional, Text + +import chroot + + +# Git Bisection exit codes +EXIT_GOOD = 0 +EXIT_BAD = 1 +EXIT_SKIP = 125 +EXIT_ABORT = 255 + + +class AbortingException(Exception): + """A nonrecoverable error occurred which should not depend on the LLVM Hash. + + In this case we will abort bisection unless --never-abort is set. + """ + + +@dataclasses.dataclass(frozen=True) +class CommandResult: + """Results a command""" + + return_code: int + output: Text + + def success(self) -> bool: + """Checks if command exited successfully.""" + return self.return_code == 0 + + def search(self, error_string: Text) -> bool: + """Checks if command has error_string in output.""" + return error_string in self.output + + def exit_assert( + self, + error_string: Text, + llvm_hash: Text, + log_dir: Optional[Path] = None, + ): + """Exit program with error code based on result.""" + if self.success(): + decision, decision_str = EXIT_GOOD, "GOOD" + elif self.search(error_string): + if error_string: + logging.info("Found failure and output contained error_string") + decision, decision_str = EXIT_BAD, "BAD" + else: + if error_string: + logging.info( + "Found failure but error_string was not found in results." + ) + decision, decision_str = EXIT_SKIP, "SKIP" + + logging.info("Completed bisection stage with: %s", decision_str) + if log_dir: + self.log_result(log_dir, llvm_hash, decision_str) + sys.exit(decision) + + def log_result(self, log_dir: Path, llvm_hash: Text, decision: Text): + """Log command's output to `{log_dir}/{llvm_hash}.{decision}`. + + Args: + log_dir: Path to the directory to use for log files + llvm_hash: LLVM Hash being tested + decision: GOOD, BAD, or SKIP decision returned for `git bisect` + """ + log_dir = Path(log_dir) + log_dir.mkdir(parents=True, exist_ok=True) + + log_file = log_dir / f"{llvm_hash}.{decision}" + log_file.touch() + + logging.info("Writing output logs to %s", log_file) + + log_file.write_text(self.output, encoding="utf-8") + + # Fix permissions since sometimes this script gets called with sudo + log_dir.chmod(0o666) + log_file.chmod(0o666) + + +class LLVMRepo: + """LLVM Repository git and workon information.""" + + REPO_PATH = Path("/mnt/host/source/src/third_party/llvm-project") + + def __init__(self): + self.workon: Optional[bool] = None + + def get_current_hash(self) -> Text: + try: + output = subprocess.check_output( + ["git", "rev-parse", "HEAD"], + cwd=self.REPO_PATH, + encoding="utf-8", + ) + output = output.strip() + except subprocess.CalledProcessError as e: + output = e.output + logging.error("Could not get current llvm hash") + raise AbortingException + return output + + def set_workon(self, workon: bool): + """Toggle llvm-9999 mode on or off.""" + if self.workon == workon: + return + subcommand = "start" if workon else "stop" + try: + subprocess.check_call( + ["cros_workon", "--host", subcommand, "sys-devel/llvm"] + ) + except subprocess.CalledProcessError: + logging.exception("cros_workon could not be toggled for LLVM.") + raise AbortingException + self.workon = workon + + def reset(self): + """Reset installed LLVM version.""" + logging.info("Reseting llvm to downloaded binary.") + self.set_workon(False) + files_to_rm = Path("/var/lib/portage/pkgs").glob("sys-*/*") + try: + subprocess.check_call( + ["sudo", "rm", "-f"] + [str(f) for f in files_to_rm] + ) + subprocess.check_call(["emerge", "-C", "llvm"]) + subprocess.check_call(["emerge", "-G", "llvm"]) + except subprocess.CalledProcessError: + logging.exception("LLVM could not be reset.") + raise AbortingException + + def build(self, use_flags: Text) -> CommandResult: + """Build selected LLVM version.""" + logging.info( + "Building llvm with candidate hash. Use flags will be %s", use_flags + ) + self.set_workon(True) + try: + output = subprocess.check_output( + ["sudo", "emerge", "llvm"], + env={"USE": use_flags, **os.environ}, + encoding="utf-8", + stderr=subprocess.STDOUT, + ) + return_code = 0 + except subprocess.CalledProcessError as e: + return_code = e.returncode + output = e.output + return CommandResult(return_code, output) + + +def run_test(command: Text) -> CommandResult: + """Run test command and get a CommandResult.""" + logging.info("Running test command: %s", command) + result = subprocess.run( + command, + check=False, + encoding="utf-8", + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + ) + logging.info("Test command returned with: %d", result.returncode) + return CommandResult(result.returncode, result.stdout) + + +def get_use_flags( + use_debug: bool, use_lto: bool, error_on_patch_failure: bool +) -> str: + """Get the USE flags for building LLVM.""" + use_flags = [] + if use_debug: + use_flags.append("debug") + if not use_lto: + use_flags.append("-thinlto") + use_flags.append("-llvm_pgo_use") + if not error_on_patch_failure: + use_flags.append("continue-on-patch-failure") + return " ".join(use_flags) + + +def abort(never_abort: bool): + """Exit with EXIT_ABORT or else EXIT_SKIP if never_abort is set.""" + if never_abort: + logging.info( + "Would have aborted but --never-abort was set. " + "Completed bisection stage with: SKIP" + ) + sys.exit(EXIT_SKIP) + else: + logging.info("Completed bisection stage with: ABORT") + sys.exit(EXIT_ABORT) + + +def get_args() -> argparse.Namespace: + parser = argparse.ArgumentParser( + description="Simple LLVM Bisection Script for use with llvm-9999." + ) + + parser.add_argument( + "--never-abort", + action="store_true", + help=( + "Return SKIP (125) for unrecoverable hash-independent errors " + "instead of ABORT (255)." + ), + ) + parser.add_argument( + "--reset-llvm", + action="store_true", + help="Reset llvm with downloaded prebuilds before rebuilding", + ) + parser.add_argument( + "--skip-build", + action="store_true", + help="Don't build or reset llvm, even if --reset-llvm is set.", + ) + parser.add_argument( + "--use-debug", + action="store_true", + help="Build llvm with assertions enabled", + ) + parser.add_argument( + "--use-lto", + action="store_true", + help="Build llvm with thinlto and PGO. This will increase build times.", + ) + parser.add_argument( + "--error-on-patch-failure", + action="store_true", + help="Don't add continue-on-patch-failure to LLVM use flags.", + ) + + test_group = parser.add_mutually_exclusive_group(required=True) + test_group.add_argument( + "--test-llvm-build", + action="store_true", + help="Bisect the llvm build instead of a test command/script.", + ) + test_group.add_argument( + "--test", help="Command to test (exp. 'emerge-atlas grpc')" + ) + + parser.add_argument( + "--search-error", + default="", + help=( + "Search for an error string from test if test has nonzero exit " + "code. If test has a non-zero exit code but search string is not " + "found, git bisect SKIP will be used." + ), + ) + parser.add_argument( + "--log-dir", + help=( + "Save a log of each output to a directory. " + "Logs will be written to `{log_dir}/{llvm_hash}.{decision}`" + ), + ) + + return parser.parse_args() + + +def run(opts: argparse.Namespace): + # Validate path to Log dir. + log_dir = opts.log_dir + if log_dir: + log_dir = Path(log_dir) + if log_dir.exists() and not log_dir.is_dir(): + logging.error("argument --log-dir: Given path is not a directory!") + raise AbortingException() + + # Get LLVM repo + llvm_repo = LLVMRepo() + llvm_hash = llvm_repo.get_current_hash() + logging.info("Testing LLVM Hash: %s", llvm_hash) + + # Build LLVM + if not opts.skip_build: + + # Get llvm USE flags. + use_flags = get_use_flags( + opts.use_debug, opts.use_lto, opts.error_on_patch_failure + ) + + # Reset LLVM if needed. + if opts.reset_llvm: + llvm_repo.reset() + + # Build new LLVM-9999. + build_result = llvm_repo.build(use_flags) + + # Check LLVM-9999 build. + if opts.test_llvm_build: + logging.info("Checking result of build....") + build_result.exit_assert(opts.search_error, llvm_hash, opts.log_dir) + elif build_result.success(): + logging.info("LLVM candidate built successfully.") + else: + logging.error("LLVM could not be built.") + logging.info("Completed bisection stage with: SKIP.") + sys.exit(EXIT_SKIP) + + # Run Test Command. + test_result = run_test(opts.test) + logging.info("Checking result of test command....") + test_result.exit_assert(opts.search_error, llvm_hash, log_dir) + + +def main(): + logging.basicConfig(level=logging.INFO) + chroot.VerifyInsideChroot() + opts = get_args() + try: + run(opts) + except AbortingException: + abort(opts.never_abort) + except Exception: + logging.exception("Uncaught Exception in main") + abort(opts.never_abort) + + +if __name__ == "__main__": + main() -- cgit v1.2.3 From 12edaa8d10cfc8f7588873c2ad3e95bcc27ffc71 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 18 Mar 2024 08:16:00 -0600 Subject: afdo_tools: fix `git` invocation in update_kernel_afdo.py Now that I look at this code, `cc=foo,bar,r=baz` pretty obviously doesn't work. Oops. :) BUG=b:329449239 TEST=Ran on Chrotomation Change-Id: I556e6bd1a7057eed6b4a27134c147bd114aa323e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5377047 Commit-Queue: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Tested-by: George Burgess --- afdo_tools/update_kernel_afdo.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/afdo_tools/update_kernel_afdo.py b/afdo_tools/update_kernel_afdo.py index fb0d34be..76e336e4 100755 --- a/afdo_tools/update_kernel_afdo.py +++ b/afdo_tools/update_kernel_afdo.py @@ -732,8 +732,9 @@ def upload_head_to_gerrit( branch: GitBranch, ): """Uploads HEAD to gerrit as a CL, and sets reviewers/CCs.""" - reviewers = ",".join(CL_REVIEWERS) - cc = ",".join(CL_CC) + option_list = [f"r={x}" for x in CL_REVIEWERS] + option_list += (f"cc={x}" for x in CL_CC) + options = ",".join(option_list) run_result = subprocess.run( [ "git", @@ -741,7 +742,7 @@ def upload_head_to_gerrit( branch.remote, # https://gerrit-review.googlesource.com/Documentation/user-upload.html#reviewers # for more info on the `%` params. - f"HEAD:refs/for/{branch.branch_name}%r={reviewers},cc={cc}", + f"HEAD:refs/for/{branch.branch_name}%{options}", ], cwd=toolchain_utils, check=False, -- cgit v1.2.3 From b824cf76355be8b595cd91c5b1fda28432128d4c Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 18 Mar 2024 08:33:09 -0600 Subject: afdo_tools: add chromeos-tree flag to update_kernel_afdo.py ...While this tool doesn't need the `repo` command, `gerrit` needs to be invoked from within a ChromeOS tree. Allow that to be specified (or autodetected, as necessary). BUG=b:329449239 TEST=Ran locally. Change-Id: Icfc2fd19d99c07ea30d7ef8c7ac11770a790a867 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5377048 Reviewed-by: Jordan Abrahams-Whitehead Tested-by: George Burgess Commit-Queue: George Burgess --- afdo_tools/update_kernel_afdo.py | 33 ++++++++++++++++++++++++++++++++- afdo_tools/update_kernel_afdo_test.py | 16 ++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/afdo_tools/update_kernel_afdo.py b/afdo_tools/update_kernel_afdo.py index 76e336e4..d91bd391 100755 --- a/afdo_tools/update_kernel_afdo.py +++ b/afdo_tools/update_kernel_afdo.py @@ -138,6 +138,15 @@ def get_parser(): it's ignored by this script. Default: %(default)s """, ) + parser.add_argument( + "--chromeos-tree", + type=Path, + help=""" + Root of a ChromeOS tree. This is optional to pass in, but doing so + unlocks extra convenience features on `--upload`. This script will try + to autodetect a tree if this isn't specified. + """, + ) parser.add_argument( "channel", nargs="*", @@ -729,6 +738,7 @@ def parse_cl_from_upload_output(upload_output: str) -> str: def upload_head_to_gerrit( toolchain_utils: Path, + chromeos_tree: Optional[Path], branch: GitBranch, ): """Uploads HEAD to gerrit as a CL, and sets reviewers/CCs.""" @@ -762,6 +772,13 @@ def upload_head_to_gerrit( cl_id = parse_cl_from_upload_output(run_result.stdout) logging.info("Uploaded CL http://crrev.com/c/%s successfully.", cl_id) + if chromeos_tree is None: + logging.info( + "Skipping gerrit convenience commands, since no CrOS tree was " + "specified." + ) + return + # To make the life of the reviewers marginally easier, click buttons # automatically. gerrit_commands = ( @@ -776,6 +793,7 @@ def upload_head_to_gerrit( # script is expeted to be used. return_code = subprocess.run( cmd, + cwd=chromeos_tree, check=False, stdin=subprocess.DEVNULL, ).returncode @@ -786,6 +804,13 @@ def upload_head_to_gerrit( ) +def find_chromeos_tree_root(a_dir: Path) -> Optional[Path]: + for parent in a_dir.parents: + if (parent / ".repo").is_dir(): + return parent + return None + + def main(argv: List[str]) -> None: my_dir = Path(__file__).resolve().parent toolchain_utils = my_dir.parent @@ -797,6 +822,12 @@ def main(argv: List[str]) -> None: level=logging.DEBUG if opts.debug else logging.INFO, ) + chromeos_tree = opts.chromeos_tree + if not chromeos_tree: + chromeos_tree = find_chromeos_tree_root(my_dir) + if chromeos_tree: + logging.info("Autodetected ChromeOS tree root at %s", chromeos_tree) + if opts.fetch: logging.info("Fetching in %s...", toolchain_utils) git_fetch(toolchain_utils) @@ -832,7 +863,7 @@ def main(argv: List[str]) -> None: commit_new_profiles(worktree, channel, result.had_failures) if opts.upload: logging.info("New profiles were committed. Uploading...") - upload_head_to_gerrit(worktree, branch) + upload_head_to_gerrit(worktree, chromeos_tree, branch) else: logging.info( "--upload not specified. Leaving commit for %s at %s", diff --git a/afdo_tools/update_kernel_afdo_test.py b/afdo_tools/update_kernel_afdo_test.py index 60f52138..79ed9d1c 100755 --- a/afdo_tools/update_kernel_afdo_test.py +++ b/afdo_tools/update_kernel_afdo_test.py @@ -337,6 +337,22 @@ TOTAL: 2 objects, 1234 bytes (1.1KiB) GERRIT_OUTPUT_WITH_TWO_CLS ) + def test_repo_autodetects_nothing_if_no_repo_dir(self): + self.assertIsNone( + update_kernel_afdo.find_chromeos_tree_root( + Path("/does/not/exist/nor/is/under/a/repo") + ) + ) + + def test_repo_autodetects_repo_dir_correctly(self): + tmpdir = self.make_tempdir() + test_subdir = tmpdir / "a/directory/and/another/one" + test_subdir.mkdir(parents=True) + (tmpdir / ".repo").mkdir() + self.assertEqual( + tmpdir, update_kernel_afdo.find_chromeos_tree_root(test_subdir) + ) + if __name__ == "__main__": unittest.main() -- cgit v1.2.3 From 14fc4f03e1a4e592578737ef196c1ef7fd320526 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 18 Mar 2024 10:06:58 -0600 Subject: afdo_tools: update profiles even if they're old While we want the detective to be aware of (and probably look into) old kernel profiles, we should still _roll_ to these profiles if they're newer than what's already available to us. BUG=b:329449239 TEST=Ran locally; ARM/5.15 rolls were written to JSON files, but the TEST=script still errored out as it should. Change-Id: I259be7d70d7f4ad7d0d527a07af41d0eb47ace41 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5377049 Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: George Burgess Tested-by: George Burgess --- afdo_tools/update_kernel_afdo.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/afdo_tools/update_kernel_afdo.py b/afdo_tools/update_kernel_afdo.py index d91bd391..81f15afa 100755 --- a/afdo_tools/update_kernel_afdo.py +++ b/afdo_tools/update_kernel_afdo.py @@ -563,12 +563,13 @@ def fetch_and_validate_newest_afdo_artifact( kernel_version: KernelVersion, branch: GitBranch, channel: Channel, -) -> Optional[str]: +) -> Optional[Tuple[str, bool]]: """Tries to update one AFDO profile on a branch. Returns: - The newest artifact name if all went well. None if something failed - along the way, and the update couldn't be completed. + None if something failed, and the update couldn't be completed. + Otherwise, this returns a tuple of (profile_name, is_old). If `is_old` + is True, this function logs an error. """ newest_artifact = find_newest_afdo_artifact( fetcher, arch, kernel_version, branch.release_number @@ -597,16 +598,16 @@ def fetch_and_validate_newest_afdo_artifact( branch.release_number, ) age = selection_info.now - newest_artifact.gs_timestamp + is_old = False if age > selection_info.max_profile_age: + is_old = True logging.error( - "Profile %s is %s old. Skipping it, since the configured limit " - "is %s.", + "Profile %s is %s old. The configured limit is %s.", newest_artifact.file_name, age, selection_info.max_profile_age, ) - return None - return newest_artifact.file_name_no_suffix + return newest_artifact.file_name_no_suffix, is_old def update_afdo_for_channel( @@ -639,7 +640,7 @@ def update_afdo_for_channel( ) continue - newest_name = fetch_and_validate_newest_afdo_artifact( + artifact_info = fetch_and_validate_newest_afdo_artifact( fetcher, selection_info, arch, @@ -647,11 +648,18 @@ def update_afdo_for_channel( branch, channel, ) - if newest_name is None: + if artifact_info is None: # Assume that the problem was already logged. had_failures = True - else: - afdo_mappings[kernel_version] = newest_name + continue + + newest_name, is_old = artifact_info + if is_old: + # Assume that the problem was already logged, but continue to + # land this in case it makes a difference. + had_failures = True + + afdo_mappings[kernel_version] = newest_name if write_afdo_descriptor_file(cfg.metadata_file, afdo_mappings): made_changes = True -- cgit v1.2.3 From 3b0d75a2975fdaa0f37541cc57245b54d39a4332 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Fri, 15 Mar 2024 12:42:08 -0600 Subject: afdo_tools: remove update_kernel_afdo Everything should be migrated from this by now. BUG=b:329449239 TEST=None Change-Id: I739505e59aaa476ed3c96d256eec9802ec70322f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5375215 Commit-Queue: Jordan Abrahams-Whitehead Reviewed-by: Jordan Abrahams-Whitehead Auto-Submit: George Burgess Tested-by: George Burgess --- afdo_tools/update_kernel_afdo | 435 ------------------------------------------ 1 file changed, 435 deletions(-) delete mode 100755 afdo_tools/update_kernel_afdo diff --git a/afdo_tools/update_kernel_afdo b/afdo_tools/update_kernel_afdo deleted file mode 100755 index a8859d9e..00000000 --- a/afdo_tools/update_kernel_afdo +++ /dev/null @@ -1,435 +0,0 @@ -#!/bin/bash -# Copyright 2020 The ChromiumOS Authors -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Due to crbug.com/1081332, we need to update AFDO metadata -# manually. This script performs a few checks and generates a -# new kernel_afdo.json file, which can then be submitted. -# - -USAGE=" -Usage: $(basename "$0") [--help] [--(no)upload] [--nointeractive] - [main|beta|stable|all] - -Description: - The script takes one optional argument which is the channel where we want -to update the kernel afdo and creates a commit (or commits with \"all\" -channels) in the corresponding branch. - No arguments defaults to \"all\". - Follow the prompt to upload the changes with --noupload. Otherwise - the script will automatically create CL and send to the detective - for review. - NO CLEAN-UP NEEDED. The script ignores any local changes and keeps -the current branch unchanged. - - Args: - --help Show this help. - --upload Upload CLs when the update succeeded (default). - --noupload Do not upload CLs. Instead, print the upload commands. - --nointeractive Runs the script without user interaction. - main|beta|stable Update metadata only on the specified channel. -" - -set -eu -set -o pipefail - -# Branch independent constants. -# Changes here will affect kernel afdo update in cros branches. -# ------------------- -ARCHS="amd arm" -AMD_GS_BASE=gs://chromeos-prebuilt/afdo-job/vetted/kernel/amd64 -ARM_GS_BASE=gs://chromeos-prebuilt/afdo-job/vetted/kernel/arm -UPDATE_CONFIG_FILE="afdo_tools/update_kernel_afdo.cfg" -# CL reviewers and cc. -REVIEWERS="c-compiler-chrome@google.com" -CC="denik@google.com,gbiv@google.com" -# Add skipped chrome branches in ascending order here. -SKIPPED_BRANCHES="95" -# NOTE: We enable/disable kernel AFDO starting from a particular branch. -# For example if we want to enable kernel AFDO in 5.15, first, we do it -# in main. In this case we want to disable it in beta and stable branches. -# The second scenario is when we want to disable kernel AFDO (when all devices -# move to kernelnext and there are no new profiles from the field). In this -# case we disable AFDO in main but still keep it live in beta and stable. -declare -A SKIPPED_ARCHKVERS_IN_BRANCHES -# In SKIPPED_ARCHKVERS_IN_BRANCHES -# - key is a branch number string; -# - value is the list of arch/kver separated by space. -# Example: SKIPPED_ARCHKVERS_IN_BRANCHES["105"]="amd/4.4 arm/5.15" -# ------------------- -# Kernel tracing was disabled on arm in 114, b/275560674. -SKIPPED_ARCHKVERS_IN_BRANCHES["114"]="arm/5.15" -SKIPPED_ARCHKVERS_IN_BRANCHES["115"]="arm/5.15" - -for branch in 122 123 124 -do - SKIPPED_ARCHKVERS_IN_BRANCHES["${branch}"]="amd/5.4 arm/5.4" -done - -script_dir=$(dirname "$0") -tc_utils_dir="${script_dir}/.." -# Convert toolchain_utils into the absolute path. -abs_tc_utils_dir="$(realpath "${tc_utils_dir}")" - -# Check profiles uploaded within the last week. -expected_time=$(date +%s -d "week ago") -# Upload CLs on success. -upload_cl=true -# Interactive mode. -interactive=true -# Without arguments the script updates all branches. -channels="" -failed_channels="" - -declare -A arch_gsbase arch_kvers arch_outfile -declare -A branch branch_number commit -remote_repo=$(git -C "${tc_utils_dir}" remote) -canary_ref="refs/heads/main" -# Read the last two release-Rxx from remote branches -# and assign them to stable_ref and beta_ref. -# sort -V is the version sort which puts R100 after R99. -# We need `echo` to convert newlines into spaces for read. -read -r stable_ref beta_ref <<< "$(git -C "${tc_utils_dir}" ls-remote -h \ - "${remote_repo}" release-R\* | cut -f2 | sort -V | tail -n 2 | paste -s)" -# Branch names which start from release-R. -branch["beta"]=${beta_ref##*/} -branch["stable"]=${stable_ref##*/} -branch["canary"]=${canary_ref##*/} - -# Get current branch numbers (number which goes after R). -branch_number["stable"]=$(echo "${branch["stable"]}" | \ - sed -n -e "s/^release-R\([0-9][0-9]*\).*$/\1/p") -branch_number["beta"]=$(echo "${branch["beta"]}" | \ - sed -n -e "s/^release-R\([0-9][0-9]*\).*$/\1/p") -branch_number["canary"]="$((branch_number[beta] + 1))" -for skipped_branch in ${SKIPPED_BRANCHES} ; do - if [[ ${branch_number["canary"]} == "${skipped_branch}" ]] ; then - ((branch_number[canary]++)) - fi -done -config_file="$(realpath --relative-to="${tc_utils_dir}" \ - "${tc_utils_dir}/${UPDATE_CONFIG_FILE}")" - -for arg in "$@" -do - case "${arg}" in - stable | canary | beta ) - channels="${channels} ${arg}" - ;; - main ) - channels="${channels} canary" - ;; - all ) - channels="canary beta stable" - ;; - --noupload | --no-upload) - upload_cl=false - ;; - --upload) - upload_cl=true - ;; - --nointeractive) - interactive=false - ;; - --help | help | -h ) - echo "${USAGE}" - exit 0 - ;; - -*) - echo "ERROR: Option \"${arg}\" is not supported." >&2 - echo "${USAGE}" - exit 1 - ;; - *) - echo "Channel \"${arg}\" is not supported. -Must be main (or canary), beta, stable or all." >&2 - echo "${USAGE}" - exit 1 - esac -done - -if [[ -z "${channels}" ]] -then - channels="canary beta stable" -fi - -# Fetch latest branches. -git -C "${tc_utils_dir}" fetch "${remote_repo}" - -worktree_dir=$(mktemp -d) -echo "-> Working in ${worktree_dir}" -# Create a worktree and make changes there. -# This way we don't need to clean-up and sync toolchain_utils before the -# change. Neither we should care about clean-up after the submit. -git -C "${tc_utils_dir}" worktree add --detach "${worktree_dir}" -trap 'git -C "${abs_tc_utils_dir}" worktree remove -f "${worktree_dir}" \ - && git -C "${abs_tc_utils_dir}" branch -D ${channels}' EXIT -pushd "${worktree_dir}" - -for channel in ${channels} -do - set +u - if [[ -n "${commit[${channel}]}" ]] - then - echo "Skipping channel ${channel} which already has commit\ - ${commit[${channel}]}." - continue - fi - set -u - - errs="" - successes=0 - curr_branch_number=${branch_number[${channel}]} - curr_branch=${branch[${channel}]} - echo - echo "Checking \"${channel}\" channel..." - echo "branch_number=${curr_branch_number} branch=${curr_branch}" - - git reset --hard HEAD - git checkout -b "${channel}" "${remote_repo}/${curr_branch}" - - # Read branch-dependent constants from $remote_repo. - # shellcheck source=afdo_tools/update_kernel_afdo.cfg - if [[ -e "${config_file}" ]] - then - # Branch dependent constants were moved to config_file. - # IMPORTANT: Starting from M-113 update_kernel_afdo reads branch-dependent - # constants from config_file from remote refs. - source "${config_file}" - else - # DON'T UPDATE THESE CONSTANTS HERE! - # Update ${config_file} instead. - AMD_KVERS="4.14 4.19 5.4 5.10" - ARM_KVERS="5.15" - AMD_METADATA_FILE="afdo_metadata/kernel_afdo.json" - ARM_METADATA_FILE="afdo_metadata/kernel_arm_afdo.json" - fi - - amd_outfile="$(realpath --relative-to="${tc_utils_dir}" \ - "${tc_utils_dir}/${AMD_METADATA_FILE}")" - arm_outfile="$(realpath --relative-to="${tc_utils_dir}" \ - "${tc_utils_dir}/${ARM_METADATA_FILE}")" - arch_gsbase["amd"]="${AMD_GS_BASE}" - arch_gsbase["arm"]="${ARM_GS_BASE}" - arch_kvers["amd"]="${AMD_KVERS}" - arch_kvers["arm"]="${ARM_KVERS}" - arch_outfile["amd"]="${amd_outfile}" - arch_outfile["arm"]="${arm_outfile}" - - new_changes=false - for arch in ${ARCHS} - do - json="{" - sep="" - for kver in ${arch_kvers[${arch}]} - do - # Skip kernels disabled in this branch. - skipped=false - for skipped_branch in "${!SKIPPED_ARCHKVERS_IN_BRANCHES[@]}" - do - if [[ ${curr_branch_number} == "${skipped_branch}" ]] - then - # Current branch is in the keys of SKIPPED_ARCHKVERS_IN_BRANCHES. - # Now lets check if $arch/$kver is in the list. - for skipped_archkver in \ - ${SKIPPED_ARCHKVERS_IN_BRANCHES[${skipped_branch}]} - do - if [[ "${arch}/${kver}" == "${skipped_archkver}" ]] - then - skipped=true - break - fi - done - fi - done - if ${skipped} - then - echo "${arch}/${kver} is skipped in branch ${curr_branch_number}." - continue - fi - # Sort the gs output by timestamp, default ordering is by name. So - # R86-13310.3-1594633089.gcov.xz goes after - # R86-13310.18-1595237847.gcov.xz. - latest=$(gsutil.py ls -l "${arch_gsbase[${arch}]}/${kver}/" | sort -k2 | \ - grep "R${curr_branch_number}" | tail -1 || true) - prev_branch=$((curr_branch_number - 1)) - if [[ -z "${latest}" && "${channel}" != "stable" ]] - then - # if no profiles exist for the current branch, try the previous branch - latest=$(gsutil.py ls -l "${arch_gsbase[${arch}]}/${kver}/" | \ - sort -k2 | grep "R${prev_branch}" | tail -1 || true) - fi - if [[ -z "${latest}" ]] - then - if [[ "${channel}" == "stable" ]] - then - echo "ERROR: No M${curr_branch_number} profiles in\ - ${arch_gsbase[${arch}]}/${kver}/" >&2 - else - echo "ERROR: No M${curr_branch_number}, M${prev_branch} profiles in\ - ${arch_gsbase[${arch}]}/${kver}/" >&2 - fi - echo "Skipping ${arch}/${kver}" >&2 - errs="${errs} ${kver}" - continue - fi - - # Verify that the file has the expected date. - file_time=$(echo "${latest}" | awk '{print $2}') - file_time_unix=$(date +%s -d "${file_time}") - if [ "${file_time_unix}" -lt "${expected_time}" ] - then - expected=$(env TZ=UTC date +%Y-%m-%dT%H:%M:%SZ -d @"${expected_time}") - echo "ERROR: Wrong date for ${arch_gsbase[${arch}]}/${kver}:\ - ${file_time} is before\ ${expected}" >&2 - errs="${errs} ${kver}" - continue - fi - - # Generate JSON. - json_kver=$(echo "${kver}" | tr . _) - # b/147370213 (migrating profiles from gcov format) may result in the - # pattern below no longer doing the right thing. - name="$(basename "${latest%.gcov.*}")" - # Skip kernels with no AFDO support in the current channel. - if [[ "${name}" == "" ]] - then - continue - fi - json=$(cat <&2 - failed_channels="${failed_channels} ${channel}" - continue - fi - - # Write new JSON file. - # Don't use `echo` since `json` might have esc characters in it. - printf "%s\n}\n" "${json}" > "${arch_outfile[${arch}]}" - - # If no changes were made, say so. - outdir=$(dirname "${arch_outfile[${arch}]}") - shortstat=$(cd "${outdir}" &&\ - git status --short "$(basename "${arch_outfile[${arch}]}")") - [ -z "${shortstat}" ] &&\ - echo "$(basename "${arch_outfile[${arch}]}") is up to date." \ - && continue - - # If we had any errors, warn about them. - if [[ -n "${errs}" ]] - then - echo "WARNING: failed to update ${errs} in ${channel}" >&2 - failed_channels="${failed_channels} ${channel}" - continue - fi - - git add "${arch_outfile[${arch}]}" - new_changes=true - done # ARCHS loop - - if ! ${new_changes} - then - echo "Skipping \"${channel}\" - all profiles are up to date" - continue - fi - - case "${channel}" in - canary ) - commit_contents=$'afdo_metadata: Publish the new kernel profiles\n\n' - for arch in ${ARCHS} ; do - for kver in ${arch_kvers[${arch}]} ; do - commit_contents="${commit_contents}Update ${arch} profile on\ - chromeos-kernel-${kver}"$'\n' - done - done - commit_contents="${commit_contents} - -BUG=None -TEST=Verified in kernel-release-afdo-verify-orchestrator" - ;; - beta | stable ) - commit_contents="afdo_metadata: Publish the new kernel profiles\ - in ${curr_branch} - -Have PM pre-approval because this shouldn't break the release branch. - -BUG=None -TEST=Verified in kernel-release-afdo-verify-orchestrator" - ;; - * ) - echo "Internal error: unhandled channel \"${channel}\"" >&2 - exit 2 - esac - - if ${interactive} - then - git commit -v -e -m "${commit_contents}" - else - git commit -m "${commit_contents}" - fi - - commit[${channel}]=$(git -C "${worktree_dir}" rev-parse HEAD) -done - -popd -echo -# Array size check doesn't play well with the unbound variable option. -set +u -if [[ ${#commit[@]} -gt 0 ]] -then - set -u - echo "The change is applied in ${!commit[*]}." - if ${upload_cl} - then - for channel in "${!commit[@]}" - do - if ${interactive} - then - (cd "${tc_utils_dir}" && \ - repo upload --br="${channel}" --re="${REVIEWERS}" --cc="${CC}" .) - else - (cd "${tc_utils_dir}" && \ - repo upload --br="${channel}" --no-verify -y --re="${REVIEWERS}" \ - --cc="${CC}" .) - fi - done - else - echo "Run these commands to upload the change:" - echo - for channel in "${!commit[@]}" - do - echo -e "\tgit -C ${tc_utils_dir} push ${remote_repo} \ - ${commit[${channel}]}:refs/for/${branch[${channel}]}" - done - fi - - # Report failed channels. - if [[ -n "${failed_channels}" ]] - then - echo - echo "ERROR: failed to update kernel afdo in ${failed_channels}" >&2 - exit 3 - fi -else - # No commits. Check if it is due to failures. - if [[ -z "${failed_channels}" ]] - then - echo "No changes are applied. It looks like AFDO versions are up to date." - else - echo "ERROR: update in ${failed_channels} failed" >&2 - exit 3 - fi -fi -- cgit v1.2.3 From 3c03d5728d120a5e9be9ee6fe8f6e436ecc7aac6 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 19 Mar 2024 16:52:09 -0600 Subject: delete `auto_delete_nightly_test_data.py` This is no longer run automatically on Chrotomation, and after a week of not running it on Chrotomation, there was nothing new for it to delete. BUG=b:329243828 TEST=None Change-Id: I8b7261c43c6449197d1920de4824f70ffda1396f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5381719 Commit-Queue: Bob Haarman Tested-by: George Burgess Auto-Submit: George Burgess Reviewed-by: Bob Haarman --- auto_delete_nightly_test_data.py | 236 --------------------------------------- 1 file changed, 236 deletions(-) delete mode 100755 auto_delete_nightly_test_data.py diff --git a/auto_delete_nightly_test_data.py b/auto_delete_nightly_test_data.py deleted file mode 100755 index 372f2995..00000000 --- a/auto_delete_nightly_test_data.py +++ /dev/null @@ -1,236 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2019 The ChromiumOS Authors -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""A crontab script to delete night test data.""" - -__author__ = "shenhan@google.com (Han Shen)" - -import argparse -import os -from pathlib import Path -import shutil -import stat -import sys -import time -import traceback -from typing import Callable, List - -from cros_utils import constants - - -def ProcessArguments(argv): - """Process arguments.""" - parser = argparse.ArgumentParser( - description="Automatically delete nightly test data directories.", - usage="auto_delete_nightly_test_data.py options", - ) - parser.add_argument( - "-d", - "--dry_run", - dest="dry_run", - default=False, - action="store_true", - help="Only print command line, do not execute anything.", - ) - parser.add_argument( - "--days_to_preserve", - dest="days_to_preserve", - default=3, - help=( - "Specify the number of days (not including today)," - " test data generated on these days will *NOT* be " - "deleted. Defaults to 3." - ), - ) - options = parser.parse_args(argv) - return options - - -def RemoveAllSubdirsMatchingPredicate( - base_dir: Path, - days_to_preserve: int, - dry_run: bool, - is_name_removal_worthy: Callable[[str], bool], -) -> int: - """Removes all subdirs of base_dir that match the given predicate.""" - secs_to_preserve = 60 * 60 * 24 * days_to_preserve - now = time.time() - remove_older_than_time = now - secs_to_preserve - - try: - dir_entries = list(base_dir.iterdir()) - except FileNotFoundError as e: - # We get this if the directory itself doesn't exist. Since we're - # cleaning tempdirs, that's as good as a success. Further, the prior - # approach here was using the `find` binary, which exits successfully - # if nothing is found. - print(f"Error enumerating {base_dir}'s contents; skipping removal: {e}") - return 0 - - had_errors = False - for file in dir_entries: - if not is_name_removal_worthy(file.name): - continue - - try: - # Take the stat here and use that later, so we only need to check - # for a nonexistent file once. - st = file.stat() - except FileNotFoundError: - # This was deleted while were checking; ignore it. - continue - - if not stat.S_ISDIR(st.st_mode): - continue - - if secs_to_preserve and st.st_atime >= remove_older_than_time: - continue - - if dry_run: - print(f"Would remove {file}") - continue - - this_iteration_had_errors = False - - def OnError(_func, path_name, excinfo): - nonlocal this_iteration_had_errors - this_iteration_had_errors = True - print(f"Failed removing path at {path_name}; traceback:") - traceback.print_exception(*excinfo) - - shutil.rmtree(file, onerror=OnError) - - # Some errors can be other processes racing with us to delete things. - # Don't count those as an error which we complain loudly about. - if this_iteration_had_errors: - if file.exists(): - had_errors = True - else: - print( - f"Discarding removal errors for {file}; dir was still " - "removed." - ) - - return 1 if had_errors else 0 - - -def IsChromeOsTmpDeletionCandidate(file_name: str): - """Returns whether the given basename can be deleted from chroot's /tmp.""" - name_prefixes = ( - "test_that_", - "cros-update", - "CrAU_temp_data", - # This might seem a bit broad, but after using custom heuristics for a - # while, `/tmp` was observed to have >75K files that matched all sorts - # of different `tmp.*` name patterns. Just remove them all. - "tmp", - ) - return any(file_name.startswith(x) for x in name_prefixes) - - -def CleanChromeOsTmpFiles( - chroot_tmp: str, days_to_preserve: int, dry_run: bool -) -> int: - # Clean chroot/tmp/test_that_* and chroot/tmp/tmpxxxxxx, that were last - # accessed more than specified time ago. - return RemoveAllSubdirsMatchingPredicate( - Path(chroot_tmp), - days_to_preserve, - dry_run, - IsChromeOsTmpDeletionCandidate, - ) - - -def CleanChromeOsImageFiles( - chroot_tmp, subdir_suffix, days_to_preserve, dry_run -): - # Clean files that were last accessed more than the specified time. - seconds_delta = days_to_preserve * 24 * 3600 - now = time.time() - errors = 0 - - for tmp_dir in os.listdir(chroot_tmp): - # Directory under /tmp - tmp_dir = os.path.join(chroot_tmp, tmp_dir) - if tmp_dir.endswith(subdir_suffix): - # Tmp directory which ends with subdir_suffix. - for subdir in os.listdir(tmp_dir): - # Subdirectories targeted for deletion. - subdir_path = os.path.join(tmp_dir, subdir) - if now - os.path.getatime(subdir_path) > seconds_delta: - if dry_run: - print(f"Will run:\nshutil.rmtree({subdir_path!r})") - else: - try: - shutil.rmtree(subdir_path) - print( - "Successfully cleaned chromeos image autotest " - f"directories from {subdir_path!r}." - ) - except OSError: - print( - "Some image autotest directories were not " - f'"removed from {subdir_path}".' - ) - errors += 1 - - return errors - - -def CleanChromeOsTmpAndImages(days_to_preserve=1, dry_run=False) -> int: - """Delete temporaries, images under crostc/chromeos.""" - chromeos_chroot_tmp = os.path.join( - constants.CROSTC_WORKSPACE, "chromeos", "out", "tmp" - ) - # Clean files in tmp directory - rv = CleanChromeOsTmpFiles(chromeos_chroot_tmp, days_to_preserve, dry_run) - # Clean image files in *-tryjob directories - rv |= CleanChromeOsImageFiles( - chromeos_chroot_tmp, "-tryjob", days_to_preserve, dry_run - ) - # Clean image files in *-release directories - rv |= CleanChromeOsImageFiles( - chromeos_chroot_tmp, "-release", days_to_preserve, dry_run - ) - # Clean image files in *-pfq directories - rv |= CleanChromeOsImageFiles( - chromeos_chroot_tmp, "-pfq", days_to_preserve, dry_run - ) - # Clean image files in *-llvm-next-nightly directories - rv |= CleanChromeOsImageFiles( - chromeos_chroot_tmp, "-llvm-next-nightly", days_to_preserve, dry_run - ) - - return rv - - -def CleanChromeTelemetryTmpFiles(dry_run: bool) -> int: - tmp_dir = Path(constants.CROSTC_WORKSPACE) / "chrome" / "src" / "tmp" - return RemoveAllSubdirsMatchingPredicate( - tmp_dir, - days_to_preserve=0, - dry_run=dry_run, - is_name_removal_worthy=lambda x: x.startswith("tmp") - and x.endswith("telemetry_Crosperf"), - ) - - -def Main(argv: List[str]) -> int: - """Delete nightly test data directories, tmps and test images.""" - options = ProcessArguments(argv) - ## Clean temporaries, images under crostc/chromeos - rv = CleanChromeOsTmpAndImages( - int(options.days_to_preserve), options.dry_run - ) - - # Clean telemetry temporaries from chrome source tree inside chroot. - rv |= CleanChromeTelemetryTmpFiles(options.dry_run) - - return 1 if rv else 0 - - -if __name__ == "__main__": - sys.exit(Main(sys.argv[1:])) -- cgit v1.2.3 From b8a26ea2988fee3391119fc198a87594cda8f6fc Mon Sep 17 00:00:00 2001 From: mobiletc-prebuild Date: Wed, 20 Mar 2024 08:05:47 -0700 Subject: afdo_metadata: Publish the new kernel profiles This brings some profiles to their newest versions. The CrOS toolchain detective has been notified about the failures that occurred in this update. BUG=None TEST=Verified in kernel-release-afdo-verify-orchestrator Change-Id: I8b4887b0d074968df0c3d278dbbb2b9c20cc1509 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5383546 Tested-by: mobiletc-prebuild Role Account Commit-Queue: mobiletc-prebuild Role Account Commit-Queue: George Burgess Auto-Submit: mobiletc-prebuild Role Account Reviewed-by: George Burgess --- afdo_metadata/kernel_afdo.json | 8 ++++---- afdo_metadata/kernel_arm_afdo.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/afdo_metadata/kernel_afdo.json b/afdo_metadata/kernel_afdo.json index 7700c0cd..e6cbb992 100644 --- a/afdo_metadata/kernel_afdo.json +++ b/afdo_metadata/kernel_afdo.json @@ -1,14 +1,14 @@ { "chromeos-kernel-5_10": { - "name": "R124-15810.0-1710149511" + "name": "R124-15810.0-1710754320" }, "chromeos-kernel-5_15": { - "name": "R124-15810.0-1710149698" + "name": "R124-15810.0-1710754504" }, "chromeos-kernel-5_4": { - "name": "R124-15808.0-1710149961" + "name": "R124-15813.0-1710754662" }, "chromeos-kernel-6_1": { - "name": "R124-15810.0-1710149738" + "name": "R124-15810.0-1710754561" } } \ No newline at end of file diff --git a/afdo_metadata/kernel_arm_afdo.json b/afdo_metadata/kernel_arm_afdo.json index d7dec9d5..f2c02097 100644 --- a/afdo_metadata/kernel_arm_afdo.json +++ b/afdo_metadata/kernel_arm_afdo.json @@ -1,5 +1,5 @@ { "chromeos-kernel-5_15": { - "name": "R122-15699.25-1704710142" + "name": "R124-15786.10-1709548825" } } \ No newline at end of file -- cgit v1.2.3 From a692f08cecb43c1027e9277c7a8408a9a68f0aa8 Mon Sep 17 00:00:00 2001 From: Ryan Beltran Date: Thu, 14 Mar 2024 21:15:30 +0000 Subject: llvm_tools: update repo manifest by default for llvm upgrades We need to make manifest changes to apply llvm upgrades now. The update_chromeos_llvm_hash script already supports this but by putting it behind a flag it is easy to miss (especially since it wasn't necessary until relatively recently). This CL makes it automatic for non-llvm_next updates. BUG=None TEST=llvm_tools/update_chromeos_llvm_hash_unittest.py Change-Id: I78ea436ea7e1f52bac00ede55b46705ae13dd03e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5373412 Reviewed-by: George Burgess Commit-Queue: Ryan Beltran Tested-by: Ryan Beltran --- llvm_tools/update_chromeos_llvm_hash.py | 9 +++++---- llvm_tools/update_chromeos_llvm_hash_unittest.py | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/llvm_tools/update_chromeos_llvm_hash.py b/llvm_tools/update_chromeos_llvm_hash.py index 510bfa9c..7e6b89c2 100755 --- a/llvm_tools/update_chromeos_llvm_hash.py +++ b/llvm_tools/update_chromeos_llvm_hash.py @@ -237,9 +237,10 @@ def GetCommandLineArgs(): "metadata if applicable (default: PATCHES.json inside $FILESDIR)", ) parser.add_argument( - "--repo_manifest", - action="store_true", - help="Updates the llvm-project revision attribute" + "--no_repo_manifest", + dest="repo_manifest", + action="store_false", + help="Skip updating the llvm-project revision attribute" " in the internal manifest.", ) parser.add_argument( @@ -896,7 +897,7 @@ def main(): else: print("--no-upload passed, did not create a change list") - if args_output.repo_manifest: + if args_output.repo_manifest and not args_output.is_llvm_next: print( f"Updating internal manifest to {git_hash} ({svn_version})...", end="", diff --git a/llvm_tools/update_chromeos_llvm_hash_unittest.py b/llvm_tools/update_chromeos_llvm_hash_unittest.py index 7f9bbbe4..dcf6944e 100755 --- a/llvm_tools/update_chromeos_llvm_hash_unittest.py +++ b/llvm_tools/update_chromeos_llvm_hash_unittest.py @@ -726,6 +726,7 @@ class UpdateLLVMHashTest(unittest.TestCase): mock_gethash.return_value = (git_hash, svn_version) argv = [ "./update_chromeos_llvm_hash_unittest.py", + "--no_repo_manifest", "--llvm_version", "google3", ] @@ -834,6 +835,7 @@ class UpdateLLVMHashTest(unittest.TestCase): failure_mode.value, "--patch_metadata_file", "META.json", + "--no_repo_manifest", ] with mock.patch.object(sys, "argv", argv) as mock.argv: -- cgit v1.2.3 From f49627a52228f26adc349ec24f06a6d6dbcc6578 Mon Sep 17 00:00:00 2001 From: mobiletc-prebuild Date: Mon, 25 Mar 2024 08:00:30 -0700 Subject: compiler_wrapper: automatic sync This CL automatically brings toolchain-utils' compiler_wrapper/ directory in sync with chromiumos-overlay's. Please see go/crostc-repo/+/main:sync_compiler_wrapper_within_cros.sh for more info on this process. BUG=None TEST=None Change-Id: I52b37cae6c0c5e5bd656cc9140ebe3ed0a256a7c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5391642 Reviewed-by: George Burgess Tested-by: mobiletc-prebuild Role Account Commit-Queue: George Burgess Auto-Submit: mobiletc-prebuild Role Account Commit-Queue: mobiletc-prebuild Role Account --- compiler_wrapper/config.go | 2 -- .../testdata/cros_clang_host_golden/bisect.json | 6 ------ .../clang_ftrapv_maincc_target_specific.json | 18 ---------------- .../cros_clang_host_golden/clang_host_wrapper.json | 2 -- .../clang_maincc_target_specific.json | 18 ---------------- .../cros_clang_host_golden/clang_path.json | 24 ---------------------- .../clang_sanitizer_args.json | 16 --------------- .../clang_specific_args.json | 8 -------- .../testdata/cros_clang_host_golden/clangtidy.json | 16 --------------- .../force_disable_werror.json | 10 --------- .../testdata/cros_hardened_golden/bisect.json | 6 ------ .../clang_ftrapv_maincc_target_specific.json | 18 ---------------- .../clang_maincc_target_specific.json | 18 ---------------- .../testdata/cros_hardened_golden/clang_path.json | 24 ---------------------- .../cros_hardened_golden/clang_sanitizer_args.json | 16 --------------- .../cros_hardened_golden/clang_specific_args.json | 8 -------- .../clang_sysroot_wrapper_common.json | 12 ----------- .../testdata/cros_hardened_golden/clangtidy.json | 16 --------------- .../cros_hardened_golden/force_disable_werror.json | 10 --------- .../cros_hardened_golden/gcc_clang_syntax.json | 8 -------- .../cros_hardened_llvmnext_golden/bisect.json | 6 ------ .../cros_hardened_llvmnext_golden/clang_path.json | 24 ---------------------- .../cros_hardened_llvmnext_golden/clangtidy.json | 16 --------------- .../force_disable_werror.json | 10 --------- .../gcc_clang_syntax.json | 8 -------- .../cros_hardened_noccache_golden/bisect.json | 6 ------ .../cros_hardened_noccache_golden/clang_path.json | 24 ---------------------- .../cros_hardened_noccache_golden/clangtidy.json | 16 --------------- .../force_disable_werror.json | 10 --------- .../gcc_clang_syntax.json | 8 -------- .../testdata/cros_nonhardened_golden/bisect.json | 6 ------ .../clang_ftrapv_maincc_target_specific.json | 18 ---------------- .../clang_maincc_target_specific.json | 18 ---------------- .../cros_nonhardened_golden/clang_path.json | 24 ---------------------- .../clang_sanitizer_args.json | 16 --------------- .../clang_specific_args.json | 8 -------- .../clang_sysroot_wrapper_common.json | 12 ----------- .../cros_nonhardened_golden/clangtidy.json | 16 --------------- .../force_disable_werror.json | 10 --------- .../cros_nonhardened_golden/gcc_clang_syntax.json | 8 -------- 40 files changed, 520 deletions(-) diff --git a/compiler_wrapper/config.go b/compiler_wrapper/config.go index 44d9d68f..041164ab 100644 --- a/compiler_wrapper/config.go +++ b/compiler_wrapper/config.go @@ -106,8 +106,6 @@ func crosCommonClangFlags() []string { return []string{ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json b/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json index a8717e09..b6864c6d 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json @@ -12,8 +12,6 @@ "/tmp/stable/clang", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -67,8 +65,6 @@ "/tmp/stable/clang", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -123,8 +119,6 @@ "/tmp/stable/clang", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json index 843ae17c..db661269 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json @@ -6,8 +6,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -49,8 +47,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -92,8 +88,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -135,8 +129,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -178,8 +170,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -221,8 +211,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -264,8 +252,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -307,8 +293,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -350,8 +334,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json index 383e41c7..5ee58565 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json @@ -6,8 +6,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json index ffa53079..7b2ef1f9 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json @@ -6,8 +6,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -48,8 +46,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -90,8 +86,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -132,8 +126,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -174,8 +166,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -216,8 +206,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -258,8 +246,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -300,8 +286,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -342,8 +326,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json index 1993f10f..fe9c46d8 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json @@ -6,8 +6,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -48,8 +46,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -96,8 +92,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -138,8 +132,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -192,8 +184,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -247,8 +237,6 @@ "/somedir/clang", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -304,8 +292,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -355,8 +341,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -397,8 +381,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -439,8 +421,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -481,8 +461,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -523,8 +501,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json index d843aa1d..644e3d9c 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json @@ -6,8 +6,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -51,8 +49,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -96,8 +92,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -141,8 +135,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -186,8 +178,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -230,8 +220,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -276,8 +264,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -320,8 +306,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json index d5567230..233890a0 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json @@ -6,8 +6,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -66,8 +64,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -110,8 +106,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -154,8 +148,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json b/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json index 07fd941d..cfa40882 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json @@ -19,8 +19,6 @@ "-resource-dir=someResourceDir", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -48,8 +46,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -106,8 +102,6 @@ "-resource-dir=someResourceDir", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -136,8 +130,6 @@ "/tmp/stable/clang", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -195,8 +187,6 @@ "-resource-dir=someResourceDir", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -228,8 +218,6 @@ "/tmp/stable/clang", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -289,8 +277,6 @@ "-resource-dir=someResourceDir", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -319,8 +305,6 @@ "/tmp/stable/clang", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json index 40049689..39175043 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json @@ -6,8 +6,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -51,8 +49,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -82,8 +78,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -130,8 +124,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -161,8 +153,6 @@ "args": [ "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/bisect.json b/compiler_wrapper/testdata/cros_hardened_golden/bisect.json index e13331c2..91788bed 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/bisect.json @@ -14,8 +14,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -86,8 +84,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -159,8 +155,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json index 2e0fcaa5..11b3c9ec 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -71,8 +69,6 @@ "--sysroot=/usr/x86_64-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -134,8 +130,6 @@ "--sysroot=/usr/x86_64-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -197,8 +191,6 @@ "--sysroot=/usr/armv7m-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -259,8 +251,6 @@ "--sysroot=/usr/armv7m-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -321,8 +311,6 @@ "--sysroot=/usr/armv7m-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -383,8 +371,6 @@ "--sysroot=/usr/armv8m-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -445,8 +431,6 @@ "--sysroot=/usr/armv8m-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -507,8 +491,6 @@ "--sysroot=/usr/armv8m-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json index 739fe183..0b893156 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -69,8 +67,6 @@ "--sysroot=/usr/x86_64-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -130,8 +126,6 @@ "--sysroot=/usr/x86_64-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -191,8 +185,6 @@ "--sysroot=/usr/armv7m-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -251,8 +243,6 @@ "--sysroot=/usr/armv7m-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -311,8 +301,6 @@ "--sysroot=/usr/armv7m-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -371,8 +359,6 @@ "--sysroot=/usr/armv8m-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -431,8 +417,6 @@ "--sysroot=/usr/armv8m-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -491,8 +475,6 @@ "--sysroot=/usr/armv8m-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json index fe64e2da..0e74e0e9 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -69,8 +67,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -136,8 +132,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -197,8 +191,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -270,8 +262,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -343,8 +333,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -414,8 +402,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -484,8 +470,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -545,8 +529,6 @@ "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -606,8 +588,6 @@ "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -667,8 +647,6 @@ "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -728,8 +706,6 @@ "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json index 25eabd19..47c7dec1 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -71,8 +69,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -134,8 +130,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -197,8 +191,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -260,8 +252,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -322,8 +312,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -386,8 +374,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -448,8 +434,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json index f5c11299..15a42434 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -87,8 +85,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -150,8 +146,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -213,8 +207,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json index 7136b3f4..7f715c3e 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json @@ -41,8 +41,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -105,8 +103,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -164,8 +160,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -227,8 +221,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -290,8 +282,6 @@ "--sysroot=/usr/armv7a-cros-linux-gnueabihf", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -351,8 +341,6 @@ "../../usr/bin/clang", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json b/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json index 04ba8442..f01711a1 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json @@ -20,8 +20,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -62,8 +60,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -133,8 +129,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -176,8 +170,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -248,8 +240,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -294,8 +284,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -368,8 +356,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -411,8 +397,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json index ebff9f99..914a5121 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -72,8 +70,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -122,8 +118,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -189,8 +183,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -239,8 +231,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json index 21f154db..925d965e 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json @@ -7,8 +7,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -90,8 +88,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -171,8 +167,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -235,8 +229,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json index e13331c2..91788bed 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json @@ -14,8 +14,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -86,8 +84,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -159,8 +155,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json index fe64e2da..0e74e0e9 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -69,8 +67,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -136,8 +132,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -197,8 +191,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -270,8 +262,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -343,8 +333,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -414,8 +402,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -484,8 +470,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -545,8 +529,6 @@ "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -606,8 +588,6 @@ "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -667,8 +647,6 @@ "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -728,8 +706,6 @@ "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json index 04ba8442..f01711a1 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json @@ -20,8 +20,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -62,8 +60,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -133,8 +129,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -176,8 +170,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -248,8 +240,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -294,8 +284,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -368,8 +356,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -411,8 +397,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json index ebff9f99..914a5121 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -72,8 +70,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -122,8 +118,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -189,8 +183,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -239,8 +231,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json index 21f154db..925d965e 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json @@ -7,8 +7,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -90,8 +88,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -171,8 +167,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -235,8 +229,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json index b1e3f291..a31df4f0 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json @@ -13,8 +13,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -81,8 +79,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -150,8 +146,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json index c4d2517e..f6e9f099 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json @@ -7,8 +7,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -62,8 +60,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -123,8 +119,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -178,8 +172,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -245,8 +237,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -313,8 +303,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -383,8 +371,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -447,8 +433,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -502,8 +486,6 @@ "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -557,8 +539,6 @@ "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -612,8 +592,6 @@ "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -667,8 +645,6 @@ "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json index 04ba8442..f01711a1 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json @@ -20,8 +20,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -62,8 +60,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -133,8 +129,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -176,8 +170,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -248,8 +240,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -294,8 +284,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -368,8 +356,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -411,8 +397,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json index 77485f0f..ffddcd7f 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json @@ -7,8 +7,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -65,8 +63,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -109,8 +105,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -170,8 +164,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -214,8 +206,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json index c3402a44..a1f9b5ce 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json @@ -7,8 +7,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -85,8 +83,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -166,8 +162,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -230,8 +224,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json b/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json index c72cc990..1dd6484b 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json @@ -14,8 +14,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -79,8 +77,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -145,8 +141,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json index 7932c23b..7886eaf0 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -64,8 +62,6 @@ "--sysroot=/usr/x86_64-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -120,8 +116,6 @@ "--sysroot=/usr/x86_64-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -176,8 +170,6 @@ "--sysroot=/usr/armv7m-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -232,8 +224,6 @@ "--sysroot=/usr/armv7m-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -287,8 +277,6 @@ "--sysroot=/usr/armv7m-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -343,8 +331,6 @@ "--sysroot=/usr/armv8m-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -399,8 +385,6 @@ "--sysroot=/usr/armv8m-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -454,8 +438,6 @@ "--sysroot=/usr/armv8m-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json index 534526f1..96545c5b 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -62,8 +60,6 @@ "--sysroot=/usr/x86_64-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -116,8 +112,6 @@ "--sysroot=/usr/x86_64-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -170,8 +164,6 @@ "--sysroot=/usr/armv7m-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -224,8 +216,6 @@ "--sysroot=/usr/armv7m-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -277,8 +267,6 @@ "--sysroot=/usr/armv7m-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -331,8 +319,6 @@ "--sysroot=/usr/armv8m-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -385,8 +371,6 @@ "--sysroot=/usr/armv8m-cros-eabi", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -438,8 +422,6 @@ "--sysroot=/usr/armv8m-cros-win-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json index 2fb92c6e..3c1dfbd1 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -62,8 +60,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -122,8 +118,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -176,8 +170,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -242,8 +234,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -308,8 +298,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -372,8 +360,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -435,8 +421,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -489,8 +473,6 @@ "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -543,8 +525,6 @@ "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -597,8 +577,6 @@ "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -651,8 +629,6 @@ "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json index ed208391..39450d65 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -65,8 +63,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -122,8 +118,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -179,8 +173,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -236,8 +228,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -292,8 +282,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -350,8 +338,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -406,8 +392,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json index 1d8d32c1..85cf01d9 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -80,8 +78,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -136,8 +132,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -192,8 +186,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json index 00202da3..a9c96d82 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json @@ -38,8 +38,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -95,8 +93,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -147,8 +143,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -203,8 +197,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -260,8 +252,6 @@ "--sysroot=/usr/armv7a-cros-linux-gnueabihf", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -316,8 +306,6 @@ "../../usr/bin/clang", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json index 0111275e..7b99aa31 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json @@ -20,8 +20,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -55,8 +53,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -119,8 +115,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -155,8 +149,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -220,8 +212,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -259,8 +249,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -326,8 +314,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -362,8 +348,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json index 0bc33451..c7fe5592 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json @@ -8,8 +8,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -65,8 +63,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -108,8 +104,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -168,8 +162,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -211,8 +203,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json index ef1d1cbe..492215af 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json @@ -7,8 +7,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -80,8 +78,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -151,8 +147,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", @@ -208,8 +202,6 @@ "--sysroot=/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-Werror=poison-system-directories", - "-Wno-compound-token-split-by-macro", - "-Wno-deprecated-builtins", "-Wno-deprecated-declarations", "-Wno-enum-constexpr-conversion", "-Wno-error=implicit-function-declaration", -- cgit v1.2.3 From 08f5f2adb6efa5d9a5ac923f1d938d81d4538d7d Mon Sep 17 00:00:00 2001 From: mobiletc-prebuild Date: Wed, 27 Mar 2024 08:05:14 -0700 Subject: afdo_metadata: Publish the new kernel profiles This brings some profiles to their newest versions. The CrOS toolchain detective has been notified about the failures that occurred in this update. BUG=None TEST=Verified in kernel-release-afdo-verify-orchestrator Change-Id: Id210e6efb61f7831680a3b6a0f07623960692970 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5402392 Reviewed-by: George Burgess Commit-Queue: George Burgess Auto-Submit: mobiletc-prebuild Role Account Tested-by: mobiletc-prebuild Role Account Commit-Queue: mobiletc-prebuild Role Account --- afdo_metadata/kernel_afdo.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/afdo_metadata/kernel_afdo.json b/afdo_metadata/kernel_afdo.json index e6cbb992..e8844019 100644 --- a/afdo_metadata/kernel_afdo.json +++ b/afdo_metadata/kernel_afdo.json @@ -1,14 +1,14 @@ { "chromeos-kernel-5_10": { - "name": "R124-15810.0-1710754320" + "name": "R125-15823.2-1711359513" }, "chromeos-kernel-5_15": { - "name": "R124-15810.0-1710754504" + "name": "R125-15823.6-1711359159" }, "chromeos-kernel-5_4": { - "name": "R124-15813.0-1710754662" + "name": "R125-15823.2-1711359366" }, "chromeos-kernel-6_1": { - "name": "R124-15810.0-1710754561" + "name": "R125-15810.0-1711359278" } } \ No newline at end of file -- cgit v1.2.3 From ad01c999a362ee57476e1f69097b0d0080a062d4 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 20 Mar 2024 09:32:55 -0600 Subject: update_kernel_afdo: clarify logging slightly - Just `warn` if profiles can't be found for a branch, since this happens between branch time & profiles being regenerated - Highlight that folks should look for `ERROR` logs, since logs can reach O(hundreds) of lines with Git output. BUG=b:322182978 TEST=Ran the script Change-Id: Id01ee7a2ffd7b00fc6a08ab384db4ab8b96e2231 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5382122 Tested-by: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: Jordan Abrahams-Whitehead Auto-Submit: George Burgess --- afdo_tools/update_kernel_afdo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/afdo_tools/update_kernel_afdo.py b/afdo_tools/update_kernel_afdo.py index 81f15afa..274703f1 100755 --- a/afdo_tools/update_kernel_afdo.py +++ b/afdo_tools/update_kernel_afdo.py @@ -467,7 +467,7 @@ def find_newest_afdo_artifact( x for x in kernel_profiles if x.release_number == release_number ] if not valid_profiles: - logging.error( + logging.warning( "Failed to find any M%d kernel profiles in %s", release_number, kernel_profile_dir, @@ -882,7 +882,8 @@ def main(argv: List[str]) -> None: if had_failures: sys.exit( "At least one failure was encountered running this script; see " - "above logs." + "above logs. Most likely the things you're looking for are logged " + "at the ERROR level." ) -- cgit v1.2.3 From 44fc9bbb4a14aece874c35feaabf8a3475e3e1c0 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 27 Mar 2024 09:36:20 -0600 Subject: update_packages_and_run_tests: set wip on uploaded changes BUG=b:331607705 TEST=repo upload Change-Id: If7bbd445f89663a71d922021745a94f856b18758 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5402395 Reviewed-by: Ryan Beltran Tested-by: George Burgess Commit-Queue: George Burgess --- llvm_tools/update_chromeos_llvm_hash.py | 7 ++++++- llvm_tools/update_packages_and_run_tests.py | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/llvm_tools/update_chromeos_llvm_hash.py b/llvm_tools/update_chromeos_llvm_hash.py index 7e6b89c2..002fe5fd 100755 --- a/llvm_tools/update_chromeos_llvm_hash.py +++ b/llvm_tools/update_chromeos_llvm_hash.py @@ -571,6 +571,7 @@ def UpdatePackages( extra_commit_msg_lines: Optional[Iterable[str]], delete_branch: bool = True, upload_changes: bool = True, + wip: bool = False, ) -> Optional[git.CommitContents]: """Updates an LLVM hash and uprevs the ebuild of the packages. @@ -594,6 +595,8 @@ def UpdatePackages( Newlines are added automatically. delete_branch: Delete the git branch as a final step. upload_changes: Upload the commit to gerrit as a CL. + wip: if True, any changes uploaded will be uploaded as + work-in-progress. Returns: If upload_changes is set, a git.CommitContents object. Otherwise None. @@ -648,7 +651,9 @@ def UpdatePackages( git.CommitChanges(chromiumos_overlay_path, commit_lines) if upload_changes: change_list = git.UploadChanges( - chromiumos_overlay_path, branch_name + chromiumos_overlay_path, + branch_name, + wip=wip, ) finally: if delete_branch: diff --git a/llvm_tools/update_packages_and_run_tests.py b/llvm_tools/update_packages_and_run_tests.py index 1a0c3ead..34837630 100755 --- a/llvm_tools/update_packages_and_run_tests.py +++ b/llvm_tools/update_packages_and_run_tests.py @@ -550,6 +550,9 @@ def main(): mode=failure_modes.FailureModes.DISABLE_PATCHES, git_hash_source=svn_option, extra_commit_msg_lines=extra_commit_msg_lines, + # b/331607705: set WIP on these changes, so the code-review-nudger bot + # doesn't ping them. + wip=True, ) AddReviewers( -- cgit v1.2.3 From 67fd41ab7625dc74702f8f6d6e287faea895a16b Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 1 Apr 2024 17:52:08 -0600 Subject: replace shlex.quote with shlex.join shlex.join(list_of_strs) is new in py3.8. It's also a decent bit cleaner than `" ".join(shlex.quote(x) for x in l)`. BUG=None TEST=repo upload Change-Id: Id1f6170bd3364adb6e229bc001ab9c0a182c2123 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5410944 Tested-by: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: Jordan Abrahams-Whitehead Auto-Submit: George Burgess Commit-Queue: George Burgess --- pgo_tools/benchmark_pgo_profiles.py | 6 ++-- .../create_chroot_and_generate_pgo_profile.py | 4 +-- pgo_tools/pgo_tools.py | 2 +- toolchain_utils_githooks/check-presubmit.py | 33 ++++++++-------------- 4 files changed, 17 insertions(+), 28 deletions(-) diff --git a/pgo_tools/benchmark_pgo_profiles.py b/pgo_tools/benchmark_pgo_profiles.py index d6fb4945..121fb774 100755 --- a/pgo_tools/benchmark_pgo_profiles.py +++ b/pgo_tools/benchmark_pgo_profiles.py @@ -118,8 +118,8 @@ def construct_hyperfine_cmd( else: raise ValueError(f"Unknown profile type: {type(profile)}") - quickpkg_restore = " ".join( - shlex.quote(str(x)) + quickpkg_restore = shlex.join( + str(x) for x in pgo_tools.generate_quickpkg_restoration_command(llvm_binpkg) ) @@ -231,7 +231,7 @@ def run_benchmark( logging.info( "Profile %r: Running %s", str(profile), - " ".join(shlex.quote(str(x)) for x in cmd), + shlex.join(str(x) for x in cmd), ) pgo_tools.run(cmd) diff --git a/pgo_tools/create_chroot_and_generate_pgo_profile.py b/pgo_tools/create_chroot_and_generate_pgo_profile.py index b9e4c62c..c09cb4d8 100755 --- a/pgo_tools/create_chroot_and_generate_pgo_profile.py +++ b/pgo_tools/create_chroot_and_generate_pgo_profile.py @@ -231,9 +231,7 @@ def main(argv: List[str]): if opts.upload: pgo_tools.run(upload_command) else: - friendly_upload_command = " ".join( - shlex.quote(str(x)) for x in upload_command - ) + friendly_upload_command = shlex.join(str(x) for x in upload_command) logging.info( "To upload the profile, run %r in %r", friendly_upload_command, diff --git a/pgo_tools/pgo_tools.py b/pgo_tools/pgo_tools.py index 577fa376..2702d605 100644 --- a/pgo_tools/pgo_tools.py +++ b/pgo_tools/pgo_tools.py @@ -35,7 +35,7 @@ def run( env = None if logging.getLogger().isEnabledFor(logging.DEBUG): - c = " ".join(shlex.quote(str(x)) for x in command) + c = shlex.join(str(x) for x in command) dir_extra = f" in {cwd}" if cwd is not None else "" logging.debug("Running `%s`%s", c, dir_extra) diff --git a/toolchain_utils_githooks/check-presubmit.py b/toolchain_utils_githooks/check-presubmit.py index 995773a2..12d278a8 100755 --- a/toolchain_utils_githooks/check-presubmit.py +++ b/toolchain_utils_githooks/check-presubmit.py @@ -110,15 +110,6 @@ def has_executable_on_path(exe: str) -> bool: return shutil.which(exe) is not None -def escape_command(command: Iterable[str]) -> str: - """Returns a human-readable and copy-pastable shell command. - - Only intended for use in output to users. shell=True is strongly - discouraged. - """ - return " ".join(shlex.quote(x) for x in command) - - def remove_deleted_files(files: Iterable[str]) -> List[str]: return [f for f in files if os.path.exists(f)] @@ -279,8 +270,8 @@ def check_isort( if not bad_files: return CheckResult( ok=False, - output="`%s` failed; stdout/stderr:\n%s" - % (escape_command(command), stdout_and_stderr), + output=f"`{shlex.join(command)}` failed; stdout/stderr:\n" + f"{stdout_and_stderr}", autofix_commands=[], ) @@ -711,8 +702,7 @@ def check_go_format(toolchain_utils_root, _thread_pool, files): if exit_code: return CheckResult( ok=False, - output="%s failed; stdout/stderr:\n%s" - % (escape_command(command), output), + output=f"{shlex.join(command)} failed; stdout/stderr:\n{output}", autofix_commands=[], ) @@ -800,9 +790,10 @@ def process_check_result( if isinstance(check_results, CheckResult): ok, output, autofix_commands = check_results if not ok and autofix_commands: - recommendation = "Recommended command(s) to fix this: %s" % [ - escape_command(x) for x in autofix_commands - ] + recommendation = ( + "Recommended command(s) to fix this: " + f"{[shlex.join(x) for x in autofix_commands]}" + ) if output: output += "\n" + recommendation else: @@ -818,8 +809,8 @@ def process_check_result( if not ok and autofix: message.append( indent_block( - "Recommended command(s) to fix this: %s" - % [escape_command(x) for x in autofix] + "Recommended command(s) to fix this: " + "{[shlex.join(x) for x in autofix]}" ) ) @@ -870,12 +861,12 @@ def try_autofix( if exit_code: print( - "*** Autofix command `%s` exited with code %d; stdout/stderr:" - % (escape_command(command), exit_code) + f"*** Autofix command `{shlex.join(command)}` exited with " + f"code {exit_code}; stdout/stderr:" ) print(output) else: - print("*** Autofix `%s` succeeded" % escape_command(command)) + print(f"*** Autofix `{shlex.join(command)}` succeeded") anything_succeeded = True if anything_succeeded: -- cgit v1.2.3 From baceb2f16a781a596854c92e882ec8c65275d914 Mon Sep 17 00:00:00 2001 From: Jordan R Abrahams-Whitehead Date: Mon, 1 Apr 2024 23:23:57 +0000 Subject: afdo_tools: Replace gsutil with gsutil.py gsutil.py is provided by depot_tools, and gsutil is provided by gcloud cli. They are technically different versions at times, but we should always be using the one provided in depot_tools while it exists, to prevent unneeded host package dependencies. BUG=b:328291076 TEST=run_tests_for.py afdo_tools/ Change-Id: I9f3008c41dc95c527a782ae3ddf941b1cf212088 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5410943 Tested-by: Jordan Abrahams-Whitehead Reviewed-by: George Burgess Commit-Queue: Jordan Abrahams-Whitehead --- afdo_tools/update_kernel_afdo.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/afdo_tools/update_kernel_afdo.py b/afdo_tools/update_kernel_afdo.py index 274703f1..fd7ae16c 100755 --- a/afdo_tools/update_kernel_afdo.py +++ b/afdo_tools/update_kernel_afdo.py @@ -36,6 +36,13 @@ CL_CC = ( "gbiv@google.com", ) +# Determine which gsutil to use. +# 'gsutil.py' is provided by depot_tools, whereas 'gsutil' +# is provided by either https://cloud.google.com/sdk/docs/install, or +# the 'google-cloud-cli' package. Since we need depot_tools to even +# use 'repo', 'gsutil.py' is guaranteed to exist. +GSUTIL = "gsutil.py" + class Arch(enum.Enum): """An enum for CPU architectures.""" @@ -407,13 +414,14 @@ class KernelProfileFetcher: @classmethod def _fetch_impl(cls, gs_url: str) -> List[KernelGsProfile]: + cmd = [ + GSUTIL, + "ls", + "-l", + gs_url, + ] result = subprocess.run( - [ - "gsutil", - "ls", - "-l", - gs_url, - ], + cmd, check=False, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, @@ -426,7 +434,7 @@ class KernelProfileFetcher: if "One or more URLs matched no objects." in result.stderr: return [] logging.error( - "gsutil ls %s failed; stderr:\n%s", gs_url, result.stderr + "%s failed; stderr:\n%s", shlex.join(cmd), result.stderr ) result.check_returncode() assert False, "unreachable" -- cgit v1.2.3 From 443429f4802cd23b5d06291c1df3a4cc521c2996 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 2 Apr 2024 17:39:18 -0600 Subject: check-presubmit: add missing f Oops. BUG=b:332589934 TEST=repo upload complained while actually giving me autofix commands Change-Id: Ie4cecccaeb13c325928e6185a1c3be59bef4f787 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5417085 Auto-Submit: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: George Burgess Tested-by: George Burgess Commit-Queue: Jordan Abrahams-Whitehead --- toolchain_utils_githooks/check-presubmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain_utils_githooks/check-presubmit.py b/toolchain_utils_githooks/check-presubmit.py index 12d278a8..127726ad 100755 --- a/toolchain_utils_githooks/check-presubmit.py +++ b/toolchain_utils_githooks/check-presubmit.py @@ -810,7 +810,7 @@ def process_check_result( message.append( indent_block( "Recommended command(s) to fix this: " - "{[shlex.join(x) for x in autofix]}" + f"{[shlex.join(x) for x in autofix]}" ) ) -- cgit v1.2.3 From feab5cecd71dcee4d0dd8e8b973defcdcdbc9b00 Mon Sep 17 00:00:00 2001 From: mobiletc-prebuild Date: Wed, 3 Apr 2024 08:05:24 -0700 Subject: afdo_metadata: Publish the new kernel profiles This brings some profiles to their newest versions. The CrOS toolchain detective has been notified about the failures that occurred in this update. BUG=None TEST=Verified in kernel-release-afdo-verify-orchestrator Change-Id: Ic39eba5fc67bb22f7e7ad98962ca2ef1e8004ccb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5420768 Tested-by: mobiletc-prebuild Role Account Commit-Queue: George Burgess Commit-Queue: mobiletc-prebuild Role Account Reviewed-by: George Burgess Auto-Submit: mobiletc-prebuild Role Account --- afdo_metadata/kernel_afdo.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/afdo_metadata/kernel_afdo.json b/afdo_metadata/kernel_afdo.json index e8844019..8a1f080c 100644 --- a/afdo_metadata/kernel_afdo.json +++ b/afdo_metadata/kernel_afdo.json @@ -1,14 +1,14 @@ { "chromeos-kernel-5_10": { - "name": "R125-15823.2-1711359513" + "name": "R125-15823.11-1711964216" }, "chromeos-kernel-5_15": { - "name": "R125-15823.6-1711359159" + "name": "R125-15823.11-1711964130" }, "chromeos-kernel-5_4": { - "name": "R125-15823.2-1711359366" + "name": "R125-15823.5-1711964299" }, "chromeos-kernel-6_1": { - "name": "R125-15810.0-1711359278" + "name": "R125-15823.11-1711964186" } } \ No newline at end of file -- cgit v1.2.3 From 226bf89b8994bcaf17f7dd48b667d3c2e8e054f3 Mon Sep 17 00:00:00 2001 From: mobiletc-prebuild Date: Thu, 4 Apr 2024 08:00:27 -0700 Subject: compiler_wrapper: automatic sync This CL automatically brings toolchain-utils' compiler_wrapper/ directory in sync with chromiumos-overlay's. Please see go/crostc-repo/+/main:sync_compiler_wrapper_within_cros.sh for more info on this process. BUG=None TEST=None Change-Id: I2c37328293a6f91a0f8f3bdbbc72b1e2123a7f31 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5425512 Commit-Queue: George Burgess Tested-by: mobiletc-prebuild Role Account Auto-Submit: mobiletc-prebuild Role Account Reviewed-by: George Burgess --- compiler_wrapper/config.go | 2 ++ compiler_wrapper/testdata/cros_clang_host_golden/bisect.json | 3 +++ .../clang_ftrapv_maincc_target_specific.json | 9 +++++++++ .../testdata/cros_clang_host_golden/clang_host_wrapper.json | 1 + .../cros_clang_host_golden/clang_maincc_target_specific.json | 9 +++++++++ .../testdata/cros_clang_host_golden/clang_path.json | 12 ++++++++++++ .../cros_clang_host_golden/clang_sanitizer_args.json | 8 ++++++++ .../testdata/cros_clang_host_golden/clang_specific_args.json | 4 ++++ .../testdata/cros_clang_host_golden/clangtidy.json | 8 ++++++++ .../cros_clang_host_golden/force_disable_werror.json | 5 +++++ compiler_wrapper/testdata/cros_hardened_golden/bisect.json | 3 +++ .../clang_ftrapv_maincc_target_specific.json | 9 +++++++++ .../cros_hardened_golden/clang_maincc_target_specific.json | 9 +++++++++ .../testdata/cros_hardened_golden/clang_path.json | 12 ++++++++++++ .../testdata/cros_hardened_golden/clang_sanitizer_args.json | 8 ++++++++ .../testdata/cros_hardened_golden/clang_specific_args.json | 4 ++++ .../cros_hardened_golden/clang_sysroot_wrapper_common.json | 6 ++++++ .../testdata/cros_hardened_golden/clangtidy.json | 8 ++++++++ .../testdata/cros_hardened_golden/force_disable_werror.json | 5 +++++ .../testdata/cros_hardened_golden/gcc_clang_syntax.json | 4 ++++ .../testdata/cros_hardened_llvmnext_golden/bisect.json | 3 +++ .../testdata/cros_hardened_llvmnext_golden/clang_path.json | 12 ++++++++++++ .../testdata/cros_hardened_llvmnext_golden/clangtidy.json | 8 ++++++++ .../cros_hardened_llvmnext_golden/force_disable_werror.json | 5 +++++ .../cros_hardened_llvmnext_golden/gcc_clang_syntax.json | 4 ++++ .../testdata/cros_hardened_noccache_golden/bisect.json | 3 +++ .../testdata/cros_hardened_noccache_golden/clang_path.json | 12 ++++++++++++ .../testdata/cros_hardened_noccache_golden/clangtidy.json | 8 ++++++++ .../cros_hardened_noccache_golden/force_disable_werror.json | 5 +++++ .../cros_hardened_noccache_golden/gcc_clang_syntax.json | 4 ++++ .../testdata/cros_nonhardened_golden/bisect.json | 3 +++ .../clang_ftrapv_maincc_target_specific.json | 9 +++++++++ .../clang_maincc_target_specific.json | 9 +++++++++ .../testdata/cros_nonhardened_golden/clang_path.json | 12 ++++++++++++ .../cros_nonhardened_golden/clang_sanitizer_args.json | 8 ++++++++ .../cros_nonhardened_golden/clang_specific_args.json | 4 ++++ .../clang_sysroot_wrapper_common.json | 6 ++++++ .../testdata/cros_nonhardened_golden/clangtidy.json | 8 ++++++++ .../cros_nonhardened_golden/force_disable_werror.json | 5 +++++ .../testdata/cros_nonhardened_golden/gcc_clang_syntax.json | 4 ++++ 40 files changed, 261 insertions(+) diff --git a/compiler_wrapper/config.go b/compiler_wrapper/config.go index 041164ab..b445ce95 100644 --- a/compiler_wrapper/config.go +++ b/compiler_wrapper/config.go @@ -118,6 +118,8 @@ func crosCommonClangFlags() []string { "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + // TODO(b/316021385): Temporarily disables warnings for variable length arrays. + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", // TODO(b/315504245): Temporarily prevents new mangling rules from taking effect. "-fclang-abi-compat=17", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json b/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json index b6864c6d..7526162a 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json @@ -24,6 +24,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -77,6 +78,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -131,6 +133,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json index db661269..e60ff52b 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json @@ -18,6 +18,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -59,6 +60,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -100,6 +102,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -141,6 +144,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -182,6 +186,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -223,6 +228,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -264,6 +270,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -305,6 +312,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -346,6 +354,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json index 5ee58565..5bd833fa 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json @@ -18,6 +18,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json index 7b2ef1f9..f0b6b976 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json @@ -18,6 +18,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -58,6 +59,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -98,6 +100,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -138,6 +141,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -178,6 +182,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -218,6 +223,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -258,6 +264,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -298,6 +305,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -338,6 +346,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json index fe9c46d8..f44863b1 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json @@ -18,6 +18,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -58,6 +59,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -104,6 +106,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -144,6 +147,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -196,6 +200,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -249,6 +254,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -304,6 +310,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -353,6 +360,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -393,6 +401,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -433,6 +442,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -473,6 +483,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -513,6 +524,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json index 644e3d9c..707915c8 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json @@ -18,6 +18,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -61,6 +62,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -104,6 +106,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -147,6 +150,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -190,6 +194,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -232,6 +237,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -276,6 +282,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -318,6 +325,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json index 233890a0..9e236bd5 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json @@ -18,6 +18,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -76,6 +77,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -118,6 +120,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -160,6 +163,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json b/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json index cfa40882..cc3269ce 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json @@ -31,6 +31,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -58,6 +59,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -114,6 +116,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -142,6 +145,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -199,6 +203,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -230,6 +235,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -289,6 +295,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -317,6 +324,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json index 39175043..9851d54d 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json @@ -18,6 +18,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -61,6 +62,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -90,6 +92,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -136,6 +139,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", @@ -165,6 +169,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-unused-local-typedefs", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/bisect.json b/compiler_wrapper/testdata/cros_hardened_golden/bisect.json index 91788bed..fac6fd4f 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/bisect.json @@ -26,6 +26,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -96,6 +97,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -167,6 +169,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json index 11b3c9ec..cd188ba5 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -81,6 +82,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -142,6 +144,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -203,6 +206,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -263,6 +267,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -323,6 +328,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -383,6 +389,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -443,6 +450,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -503,6 +511,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json index 0b893156..09b3dbf3 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -79,6 +80,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -138,6 +140,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -197,6 +200,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -255,6 +259,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -313,6 +318,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -371,6 +377,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -429,6 +436,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -487,6 +495,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json index 0e74e0e9..88e62ba6 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -79,6 +80,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -144,6 +146,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -203,6 +206,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -274,6 +278,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -345,6 +350,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -414,6 +420,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -482,6 +489,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -541,6 +549,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -600,6 +609,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -659,6 +669,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -718,6 +729,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json index 47c7dec1..b9573920 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -81,6 +82,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -142,6 +144,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -203,6 +206,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -264,6 +268,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -324,6 +329,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -386,6 +392,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -446,6 +453,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json index 15a42434..65733360 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -97,6 +98,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -158,6 +160,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -219,6 +222,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json index 7f715c3e..e2bd5d2f 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json @@ -53,6 +53,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -115,6 +116,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -172,6 +174,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -233,6 +236,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -294,6 +298,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -353,6 +358,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json b/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json index f01711a1..dcad603d 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json @@ -32,6 +32,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -72,6 +73,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -141,6 +143,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -182,6 +185,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -252,6 +256,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -296,6 +301,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -368,6 +374,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -409,6 +416,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json index 914a5121..ab17a915 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -82,6 +83,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -130,6 +132,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -195,6 +198,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -243,6 +247,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json index 925d965e..719261f7 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json @@ -19,6 +19,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -100,6 +101,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -179,6 +181,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -241,6 +244,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json index 91788bed..fac6fd4f 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json @@ -26,6 +26,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -96,6 +97,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -167,6 +169,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json index 0e74e0e9..88e62ba6 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -79,6 +80,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -144,6 +146,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -203,6 +206,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -274,6 +278,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -345,6 +350,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -414,6 +420,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -482,6 +489,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -541,6 +549,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -600,6 +609,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -659,6 +669,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -718,6 +729,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json index f01711a1..dcad603d 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json @@ -32,6 +32,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -72,6 +73,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -141,6 +143,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -182,6 +185,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -252,6 +256,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -296,6 +301,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -368,6 +374,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -409,6 +416,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json index 914a5121..ab17a915 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -82,6 +83,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -130,6 +132,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -195,6 +198,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -243,6 +247,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json index 925d965e..719261f7 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json @@ -19,6 +19,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -100,6 +101,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -179,6 +181,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -241,6 +244,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json index a31df4f0..783d8650 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json @@ -25,6 +25,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -91,6 +92,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -158,6 +160,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json index f6e9f099..95c1e482 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json @@ -19,6 +19,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -72,6 +73,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -131,6 +133,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -184,6 +187,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -249,6 +253,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -315,6 +320,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -383,6 +389,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -445,6 +452,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -498,6 +506,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -551,6 +560,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -604,6 +614,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -657,6 +668,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json index f01711a1..dcad603d 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json @@ -32,6 +32,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -72,6 +73,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -141,6 +143,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -182,6 +185,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -252,6 +256,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -296,6 +301,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -368,6 +374,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -409,6 +416,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json index ffddcd7f..7fef9a1d 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json @@ -19,6 +19,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -75,6 +76,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -117,6 +119,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -176,6 +179,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -218,6 +222,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json index a1f9b5ce..f0469d47 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json @@ -19,6 +19,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -95,6 +96,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -174,6 +176,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", @@ -236,6 +239,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "--unwindlib=libunwind", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json b/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json index 1dd6484b..8c25b715 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json @@ -26,6 +26,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -89,6 +90,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -153,6 +155,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json index 7886eaf0..f81d88c6 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -74,6 +75,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -128,6 +130,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -182,6 +185,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -236,6 +240,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -289,6 +294,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -343,6 +349,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -397,6 +404,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -450,6 +458,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json index 96545c5b..5d8f5bea 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -72,6 +73,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -124,6 +126,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -176,6 +179,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -228,6 +232,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -279,6 +284,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -331,6 +337,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -383,6 +390,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -434,6 +442,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json index 3c1dfbd1..768f2b28 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -72,6 +73,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -130,6 +132,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -182,6 +185,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -246,6 +250,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -310,6 +315,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -372,6 +378,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -433,6 +440,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -485,6 +493,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -537,6 +546,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -589,6 +599,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -641,6 +652,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json index 39450d65..10329a58 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -75,6 +76,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -130,6 +132,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -185,6 +188,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -240,6 +244,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -294,6 +299,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -350,6 +356,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -404,6 +411,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json index 85cf01d9..be4f57a5 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -90,6 +91,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -144,6 +146,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -198,6 +201,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json index a9c96d82..4f2bddb6 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json @@ -50,6 +50,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -105,6 +106,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -155,6 +157,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -209,6 +212,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -264,6 +268,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -318,6 +323,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json index 7b99aa31..e85c065f 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json @@ -32,6 +32,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -65,6 +66,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -127,6 +129,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -161,6 +164,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -224,6 +228,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -261,6 +266,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -326,6 +332,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -360,6 +367,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json index c7fe5592..7e4b4d6f 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json @@ -20,6 +20,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -75,6 +76,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -116,6 +118,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -174,6 +177,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -215,6 +219,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json index 492215af..daa023fc 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json @@ -19,6 +19,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -90,6 +91,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -159,6 +161,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", @@ -214,6 +217,7 @@ "-fdebug-default-version=5", "-Wno-int-conversion", "-Wno-incompatible-function-pointer-types", + "-Wno-error=vla-cxx-extension", "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES", "-fclang-abi-compat=17", "-Wno-section", -- cgit v1.2.3 From f710649ffb8b4fd514cc990169e875db8424f22c Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 2 Apr 2024 17:35:47 -0600 Subject: afdo_tools: move git utilities into cros_utils These will be useful soon for an llvm patch cleanup script I'm working on. Factor them out to reduce maintenance. BUG=b:332589934 TEST=Unittests & new script Change-Id: I69114cc8df0a94a8edc9525571d1a7d45d04d369 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5417086 Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: George Burgess Tested-by: George Burgess --- afdo_tools/update_kernel_afdo.py | 79 +++++-------------------- afdo_tools/update_kernel_afdo_test.py | 54 ----------------- cros_utils/git_utils.py | 107 ++++++++++++++++++++++++++++++++++ cros_utils/git_utils_test.py | 73 +++++++++++++++++++++++ 4 files changed, 193 insertions(+), 120 deletions(-) create mode 100644 cros_utils/git_utils.py create mode 100755 cros_utils/git_utils_test.py diff --git a/afdo_tools/update_kernel_afdo.py b/afdo_tools/update_kernel_afdo.py index fd7ae16c..a7e40763 100755 --- a/afdo_tools/update_kernel_afdo.py +++ b/afdo_tools/update_kernel_afdo.py @@ -24,11 +24,11 @@ import sys import tempfile from typing import Dict, Generator, Iterable, List, Optional, Tuple +from cros_utils import git_utils + # Folks who should be on the R-line of any CLs that get uploaded. -# Note that `c-compiler-chrome@` is managed by gwsq - it'll replace -# `R=c-compiler-chrome` with the current detective. -CL_REVIEWERS = ("c-compiler-chrome@google.com",) +CL_REVIEWERS = (git_utils.REVIEWER_DETECTIVE,) # Folks who should be on the CC-line of any CLs that get uploaded. CL_CC = ( @@ -737,55 +737,24 @@ def commit_new_profiles( ) -def parse_cl_from_upload_output(upload_output: str) -> str: - """Returns the CL number in the given upload output.""" - id_regex = re.compile( - r"^remote:\s+https://chromium-review\S+/\+/(\d+)\s", re.MULTILINE - ) - - results = id_regex.findall(upload_output) - if len(results) != 1: - raise ValueError( - f"Wanted exactly one match for {id_regex} in {upload_output!r}; " - f"found {len(results)}" - ) - return results[0] - - def upload_head_to_gerrit( toolchain_utils: Path, chromeos_tree: Optional[Path], branch: GitBranch, ): """Uploads HEAD to gerrit as a CL, and sets reviewers/CCs.""" - option_list = [f"r={x}" for x in CL_REVIEWERS] - option_list += (f"cc={x}" for x in CL_CC) - options = ",".join(option_list) - run_result = subprocess.run( - [ - "git", - "push", - branch.remote, - # https://gerrit-review.googlesource.com/Documentation/user-upload.html#reviewers - # for more info on the `%` params. - f"HEAD:refs/for/{branch.branch_name}%{options}", - ], - cwd=toolchain_utils, - check=False, - stdin=subprocess.DEVNULL, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - encoding="utf-8", - ) - - logging.info( - "`git push`ing to %s had this output:\n%s", + cl_ids = git_utils.upload_to_gerrit( + toolchain_utils, + branch.remote, branch.branch_name, - run_result.stdout, + CL_REVIEWERS, + CL_CC, ) - run_result.check_returncode() - cl_id = parse_cl_from_upload_output(run_result.stdout) + if len(cl_ids) > 1: + raise ValueError(f"Unexpected: wanted just one CL upload; got {cl_ids}") + + cl_id = cl_ids[0] logging.info("Uploaded CL http://crrev.com/c/%s successfully.", cl_id) if chromeos_tree is None: @@ -795,29 +764,7 @@ def upload_head_to_gerrit( ) return - # To make the life of the reviewers marginally easier, click buttons - # automatically. - gerrit_commands = ( - ["gerrit", "label-as", cl_id, "1"], - ["gerrit", "label-cq", cl_id, "1"], - ["gerrit", "label-v", cl_id, "1"], - ) - for cmd in gerrit_commands: - # Run the gerrit commands inside of toolchain_utils, since `gerrit` - # needs to be run inside of a ChromeOS tree to work. While - # `toolchain-utils` can be checked out on its own, that's not how this - # script is expeted to be used. - return_code = subprocess.run( - cmd, - cwd=chromeos_tree, - check=False, - stdin=subprocess.DEVNULL, - ).returncode - if return_code: - logging.warning( - "Failed to run gerrit command %s. Ignoring.", - shlex.join(cmd), - ) + git_utils.try_set_autosubmit_labels(chromeos_tree, cl_id) def find_chromeos_tree_root(a_dir: Path) -> Optional[Path]: diff --git a/afdo_tools/update_kernel_afdo_test.py b/afdo_tools/update_kernel_afdo_test.py index 79ed9d1c..1f365959 100755 --- a/afdo_tools/update_kernel_afdo_test.py +++ b/afdo_tools/update_kernel_afdo_test.py @@ -17,44 +17,6 @@ from unittest import mock import update_kernel_afdo -GERRIT_OUTPUT_WITH_ONE_CL = """ -Enumerating objects: 4, done. -Counting objects: 100% (4/4), done. -Delta compression using up to 128 threads -Compressing objects: 100% (2/2), done. -Writing objects: 100% (3/3), 320 bytes | 106.00 KiB/s, done. -Total 3 (delta 1), reused 1 (delta 0), pack-reused 0 (from 0) -remote: Resolving deltas: 100% (1/1) -remote: Processing changes: refs: 1, new: 1, done -remote: -remote: SUCCESS -remote: -remote: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5375204 DO NOT COMMIT [WIP] [NEW] -remote: -To https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils - * [new reference] HEAD -> refs/for/main -""" - -GERRIT_OUTPUT_WITH_TWO_CLS = """ -Enumerating objects: 4, done. -Counting objects: 100% (4/4), done. -Delta compression using up to 128 threads -Compressing objects: 100% (2/2), done. -Writing objects: 100% (3/3), 320 bytes | 106.00 KiB/s, done. -Total 3 (delta 1), reused 1 (delta 0), pack-reused 0 (from 0) -remote: Resolving deltas: 100% (1/1) -remote: Processing changes: refs: 1, new: 1, done -remote: -remote: SUCCESS -remote: -remote: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5375204 DO NOT COMMIT [WIP] [NEW] -remote: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5375205 DO NOT COMMIT [WIP] [NEW] -remote: -To https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils - * [new reference] HEAD -> refs/for/main -""" - - class Test(unittest.TestCase): """Tests for update_kernel_afdo.""" @@ -321,22 +283,6 @@ TOTAL: 2 objects, 1234 bytes (1.1KiB) update_kernel_afdo.write_afdo_descriptor_file(file_path, contents) ) - def test_cl_parsing_from_gerrit_output(self): - self.assertEqual( - update_kernel_afdo.parse_cl_from_upload_output( - GERRIT_OUTPUT_WITH_ONE_CL - ), - "5375204", - ) - - with self.assertRaisesRegex(ValueError, ".*; found 0"): - update_kernel_afdo.parse_cl_from_upload_output("") - - with self.assertRaisesRegex(ValueError, ".*; found 2"): - update_kernel_afdo.parse_cl_from_upload_output( - GERRIT_OUTPUT_WITH_TWO_CLS - ) - def test_repo_autodetects_nothing_if_no_repo_dir(self): self.assertIsNone( update_kernel_afdo.find_chromeos_tree_root( diff --git a/cros_utils/git_utils.py b/cros_utils/git_utils.py new file mode 100644 index 00000000..1ae02ae0 --- /dev/null +++ b/cros_utils/git_utils.py @@ -0,0 +1,107 @@ +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Shared utilities for working with git.""" + +import logging +from pathlib import Path +import re +import shlex +import subprocess +from typing import Iterable, List + + +# Email address used to tag the detective as a reviewer. +REVIEWER_DETECTIVE = "c-compiler-chrome@google.com" + + +def _parse_cls_from_upload_output(upload_output: str) -> List[int]: + """Returns the CL number in the given upload output.""" + id_regex = re.compile( + r"^remote:\s+https://chromium-review\S+/\+/(\d+)\s", re.MULTILINE + ) + + results = id_regex.findall(upload_output) + if not results: + raise ValueError( + f"Wanted at least one match for {id_regex} in {upload_output!r}; " + "found 0" + ) + return [int(x) for x in results] + + +def upload_to_gerrit( + git_repo: Path, + remote: str, + branch: str, + reviewers: Iterable[str] = (), + cc: Iterable[str] = (), + ref: str = "HEAD", +) -> List[int]: + """Uploads `ref` to gerrit, optionally adding reviewers/CCs.""" + # https://gerrit-review.googlesource.com/Documentation/user-upload.html#reviewers + # for more info on the `%` params. + option_list = [f"r={x}" for x in reviewers] + option_list += (f"cc={x}" for x in cc) + if option_list: + trailing_options = "%" + ",".join(option_list) + else: + trailing_options = "" + + run_result = subprocess.run( + [ + "git", + "push", + remote, + # https://gerrit-review.googlesource.com/Documentation/user-upload.html#reviewers + # for more info on the `%` params. + f"{ref}:refs/for/{branch}{trailing_options}", + ], + cwd=git_repo, + check=False, + stdin=subprocess.DEVNULL, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + encoding="utf-8", + ) + + logging.info( + "`git push`ing %s to %s/%s had this output:\n%s", + ref, + remote, + branch, + run_result.stdout, + ) + run_result.check_returncode() + return _parse_cls_from_upload_output(run_result.stdout) + + +def try_set_autosubmit_labels(chromeos_tree: Path, cl_id: int) -> None: + """Sets autosubmit on a CL. Logs - not raises - on failure. + + This sets a series of convenience labels on the given cl_number, so landing + it (e.g., for the detective) is as easy as possible. + """ + gerrit_cl_id = str(cl_id) + gerrit_commands = ( + ["gerrit", "label-as", gerrit_cl_id, "1"], + ["gerrit", "label-cq", gerrit_cl_id, "1"], + ["gerrit", "label-v", gerrit_cl_id, "1"], + ) + for cmd in gerrit_commands: + # Run the gerrit commands inside of toolchain_utils, since `gerrit` + # needs to be run inside of a ChromeOS tree to work. While + # `toolchain-utils` can be checked out on its own, that's not how this + # script is expeted to be used. + return_code = subprocess.run( + cmd, + cwd=chromeos_tree, + check=False, + stdin=subprocess.DEVNULL, + ).returncode + if return_code: + logging.warning( + "Failed to run gerrit command %s. Ignoring.", + shlex.join(cmd), + ) diff --git a/cros_utils/git_utils_test.py b/cros_utils/git_utils_test.py new file mode 100755 index 00000000..2edf1591 --- /dev/null +++ b/cros_utils/git_utils_test.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +"""Tests for git_utils.""" + +import unittest + +from cros_utils import git_utils + + +# pylint: disable=protected-access + +GERRIT_OUTPUT_WITH_ONE_CL = """ +Enumerating objects: 4, done. +Counting objects: 100% (4/4), done. +Delta compression using up to 128 threads +Compressing objects: 100% (2/2), done. +Writing objects: 100% (3/3), 320 bytes | 106.00 KiB/s, done. +Total 3 (delta 1), reused 1 (delta 0), pack-reused 0 (from 0) +remote: Resolving deltas: 100% (1/1) +remote: Processing changes: refs: 1, new: 1, done +remote: +remote: SUCCESS +remote: +remote: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5375204 DO NOT COMMIT [WIP] [NEW] +remote: +To https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils + * [new reference] HEAD -> refs/for/main +""" + +GERRIT_OUTPUT_WITH_TWO_CLS = """ +Enumerating objects: 4, done. +Counting objects: 100% (4/4), done. +Delta compression using up to 128 threads +Compressing objects: 100% (2/2), done. +Writing objects: 100% (3/3), 320 bytes | 106.00 KiB/s, done. +Total 3 (delta 1), reused 1 (delta 0), pack-reused 0 (from 0) +remote: Resolving deltas: 100% (1/1) +remote: Processing changes: refs: 1, new: 1, done +remote: +remote: SUCCESS +remote: +remote: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5375204 DO NOT COMMIT [WIP] [NEW] +remote: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5375205 DO NOT COMMIT [WIP] [NEW] +remote: +To https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils + * [new reference] HEAD -> refs/for/main +""" + + +class Test(unittest.TestCase): + """Tests for git_utils.""" + + def test_cl_parsing_complains_if_no_output(self): + with self.assertRaisesRegex(ValueError, ".*; found 0"): + git_utils._parse_cls_from_upload_output("") + + def test_cl_parsing_works_with_one_cl(self): + self.assertEqual( + git_utils._parse_cls_from_upload_output(GERRIT_OUTPUT_WITH_ONE_CL), + [5375204], + ) + + def test_cl_parsing_works_with_two_cls(self): + self.assertEqual( + git_utils._parse_cls_from_upload_output(GERRIT_OUTPUT_WITH_TWO_CLS), + [5375204, 5375205], + ) + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3 From 0fc9b4d6e3b1d3817ba8ed5213a66800b89ad2c9 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 3 Apr 2024 09:44:12 -0600 Subject: llvm_tools: remove REMOVE_PATCHES failure mode This failure mode seems completely unused, and the concept of removing all patches before a certain rev (but only if any patches fail) is kind of odd. Instead, we should just have a cronjob that ensures this is done regularly. BUG=b:332589934 TEST=repo upload Change-Id: Idc25ad61031f70ceb717b8a35219b521a820b6c8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5420772 Reviewed-by: Jordan Abrahams-Whitehead Tested-by: George Burgess Commit-Queue: George Burgess --- llvm_tools/README.md | 10 ---------- llvm_tools/failure_modes.py | 1 - llvm_tools/patch_manager.py | 6 ------ llvm_tools/update_chromeos_llvm_hash.py | 5 ----- llvm_tools/update_chromeos_llvm_hash_unittest.py | 2 +- 5 files changed, 1 insertion(+), 23 deletions(-) diff --git a/llvm_tools/README.md b/llvm_tools/README.md index f556c8a0..8072155e 100644 --- a/llvm_tools/README.md +++ b/llvm_tools/README.md @@ -156,16 +156,6 @@ $ ./patch_manager.py \ --failure_mode disable_patches ``` -For example, to remove all patches that no longer apply: - -``` -$ ./patch_manager.py \ - --svn_version 367622 \ - --patch_metadata_file /abs/path/to/patch/file \ - --src_path /abs/path/to/src/tree \ - --failure_mode remove_patches -``` - For example, to bisect a failing patch and stop at the first bisected patch: ``` diff --git a/llvm_tools/failure_modes.py b/llvm_tools/failure_modes.py index b9355b7e..0df81194 100644 --- a/llvm_tools/failure_modes.py +++ b/llvm_tools/failure_modes.py @@ -14,7 +14,6 @@ class FailureModes(enum.Enum): CONTINUE = "continue" DISABLE_PATCHES = "disable_patches" BISECT_PATCHES = "bisect_patches" - REMOVE_PATCHES = "remove_patches" # Only used by 'bisect_patches'. INTERNAL_BISECTION = "internal_bisection" diff --git a/llvm_tools/patch_manager.py b/llvm_tools/patch_manager.py index 33272286..bee4c964 100755 --- a/llvm_tools/patch_manager.py +++ b/llvm_tools/patch_manager.py @@ -285,11 +285,6 @@ def main(sys_argv: List[str]): ) PrintPatchResults(result) - def _remove(args): - patch_utils.remove_old_patches( - args.svn_version, llvm_src_dir, patches_json_fp - ) - def _disable(args): patch_cmd = patch_utils.git_am if args.git_am else patch_utils.gnu_patch patch_utils.update_version_ranges( @@ -317,7 +312,6 @@ def main(sys_argv: List[str]): dispatch_table = { failure_modes.FailureModes.FAIL: _apply_all, failure_modes.FailureModes.CONTINUE: _apply_all, - failure_modes.FailureModes.REMOVE_PATCHES: _remove, failure_modes.FailureModes.DISABLE_PATCHES: _disable, failure_modes.FailureModes.BISECT_PATCHES: _test_single, } diff --git a/llvm_tools/update_chromeos_llvm_hash.py b/llvm_tools/update_chromeos_llvm_hash.py index 002fe5fd..bbb5edb3 100755 --- a/llvm_tools/update_chromeos_llvm_hash.py +++ b/llvm_tools/update_chromeos_llvm_hash.py @@ -223,7 +223,6 @@ def GetCommandLineArgs(): failure_modes.FailureModes.FAIL.value, failure_modes.FailureModes.CONTINUE.value, failure_modes.FailureModes.DISABLE_PATCHES.value, - failure_modes.FailureModes.REMOVE_PATCHES.value, ], help="the mode of the patch manager when handling failed patches " "(default: %(default)s)", @@ -766,10 +765,6 @@ def UpdatePackagesPatchMetadataFile( continue_on_failure=mode == failure_modes.FailureModes.CONTINUE, ) - elif mode == failure_modes.FailureModes.REMOVE_PATCHES: - patches_info = patch_utils.remove_old_patches( - svn_version, src_path, patches_json_fp - ) elif mode == failure_modes.FailureModes.DISABLE_PATCHES: patches_info = patch_utils.update_version_ranges( svn_version, src_path, patches_json_fp diff --git a/llvm_tools/update_chromeos_llvm_hash_unittest.py b/llvm_tools/update_chromeos_llvm_hash_unittest.py index dcf6944e..bab1ebb0 100755 --- a/llvm_tools/update_chromeos_llvm_hash_unittest.py +++ b/llvm_tools/update_chromeos_llvm_hash_unittest.py @@ -813,7 +813,7 @@ class UpdateLLVMHashTest(unittest.TestCase): ): packages_to_update = "test-packages/package1,test-libs/lib1" manifest_packages = "test-libs/lib1,test-libs/lib2" - failure_mode = failure_modes.FailureModes.REMOVE_PATCHES + failure_mode = failure_modes.FailureModes.DISABLE_PATCHES chromeos_path = Path("/some/path/to/chromeos") llvm_ver = 435698 git_hash = "1234abcd" -- cgit v1.2.3 From 3f4382d0af07b86c5caf3f0e119c6473509037d8 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 3 Apr 2024 09:48:37 -0600 Subject: llvm_tools: remove unused `patch_cmd` arg This makes `cros lint` happy. BUG=b:332589934 TEST=repo upload Change-Id: Ic0b15dd0829f731b3387ca6b3df6dbca5688ea93 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5420773 Commit-Queue: George Burgess Tested-by: George Burgess Reviewed-by: Jordan Abrahams-Whitehead --- llvm_tools/patch_manager.py | 4 ---- llvm_tools/patch_manager_unittest.py | 2 -- 2 files changed, 6 deletions(-) diff --git a/llvm_tools/patch_manager.py b/llvm_tools/patch_manager.py index bee4c964..801f8469 100755 --- a/llvm_tools/patch_manager.py +++ b/llvm_tools/patch_manager.py @@ -115,7 +115,6 @@ def CheckPatchApplies( llvm_src_dir: Path, patches_json_fp: Path, rel_patch_path: str, - patch_cmd: Optional[Callable] = None, ) -> GitBisectionCode: """Check that a given patch with the rel_patch_path applies in the stack. @@ -131,7 +130,6 @@ def CheckPatchApplies( rel_patch_path: Relative patch path of the patch we want to check. If patches before this patch fail to apply, then the revision is skipped. - patch_cmd: Use 'git am' to patch instead of GNU 'patch'. """ with patches_json_fp.open(encoding="utf-8") as f: patch_entries = patch_utils.json_to_patch_entries( @@ -297,13 +295,11 @@ def main(sys_argv: List[str]): "Running with bisect_patches requires the " "--test_patch flag." ) svn_version = GetHEADSVNVersion(llvm_src_dir) - patch_cmd = patch_utils.git_am if args.git_am else patch_utils.gnu_patch error_code = CheckPatchApplies( svn_version, llvm_src_dir, patches_json_fp, args.test_patch, - patch_cmd, ) # Since this is for bisection, we want to exit with the # GitBisectionCode enum. diff --git a/llvm_tools/patch_manager_unittest.py b/llvm_tools/patch_manager_unittest.py index 1087727f..30acd24a 100755 --- a/llvm_tools/patch_manager_unittest.py +++ b/llvm_tools/patch_manager_unittest.py @@ -124,7 +124,6 @@ class PatchManagerTest(unittest.TestCase): dirpath, patches_path, "example.patch", - patch_utils.gnu_patch, ) self.assertEqual(result, expected) m.assert_called() @@ -165,7 +164,6 @@ class PatchManagerTest(unittest.TestCase): dirpath, patches_path, "example.patch", - patch_utils.gnu_patch, ) self.assertEqual(result, expected) -- cgit v1.2.3 From 4db0e3155bf85e5c4f977105e870b3d76eb70972 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 3 Apr 2024 09:52:31 -0600 Subject: llvm_tools: fix `cros lint` & mypy issues in patch_utils `mypy` doesn't infer the right types for some of these lists, and _really_ dislikes multiple calls to the same Callable with different signatures. `cros lint` was unhappy with `==` to compare fns, and unmentioned things in docstrings. BUG=b:332589934 TEST=repo upload Change-Id: Ic6929e8524797b2fdc96db65a94c0f98ea9dd8bb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5420774 Commit-Queue: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Tested-by: George Burgess --- llvm_tools/patch_utils.py | 23 ++++++++++------------- llvm_tools/patch_utils_unittest.py | 4 ++-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/llvm_tools/patch_utils.py b/llvm_tools/patch_utils.py index b21cf314..b5383ac9 100644 --- a/llvm_tools/patch_utils.py +++ b/llvm_tools/patch_utils.py @@ -256,11 +256,8 @@ class PatchEntry: f"Cannot apply: patch {abs_patch_path} is not a file" ) - if not patch_cmd: - patch_cmd = gnu_patch - - if patch_cmd == gnu_patch: - cmd = patch_cmd(root_dir, abs_patch_path) + (extra_args or []) + if not patch_cmd or patch_cmd is gnu_patch: + cmd = gnu_patch(root_dir, abs_patch_path) + (extra_args or []) else: cmd = patch_cmd(abs_patch_path) + (extra_args or []) @@ -272,7 +269,7 @@ class PatchEntry: parsed_hunks = self.parsed_hunks() failed_hunks_id_dict = parse_failed_patch_output(e.stdout) failed_hunks = {} - if patch_cmd == gnu_patch: + if patch_cmd is gnu_patch: for path, failed_hunk_ids in failed_hunks_id_dict.items(): hunks_for_file = parsed_hunks[path] failed_hunks[path] = [ @@ -291,7 +288,7 @@ class PatchEntry: self, root_dir: Path, patch_cmd: Optional[Callable] = None ) -> PatchResult: """Dry run applying a patch to a given directory.""" - extra_args = [] if patch_cmd == git_am else ["--dry-run"] + extra_args = [] if patch_cmd is git_am else ["--dry-run"] return self.apply(root_dir, patch_cmd, extra_args) def title(self) -> str: @@ -376,6 +373,7 @@ def apply_all_from_json( svn_version: LLVM Subversion revision to patch. llvm_src_dir: llvm-project root-level source directory to patch. patches_json_fp: Filepath to the PATCHES.json file. + patch_cmd: The function to use when actually applying the patch. continue_on_failure: Skip any patches which failed to apply, rather than throw an Exception. """ @@ -565,6 +563,7 @@ def update_version_ranges_with_entries( svn_version: LLVM revision number. llvm_src_dir: llvm-project directory path. patch_entries: PatchEntry objects to modify. + patch_cmd: The function to use when actually applying the patch. Returns: Tuple of (modified entries, applied patches) @@ -641,20 +640,18 @@ def remove_old_patches( def git_am(patch_path: Path) -> List[Union[str, Path]]: - cmd = ["git", "am", "--3way", str(patch_path)] - return cmd + return ["git", "am", "--3way", patch_path] def gnu_patch(root_dir: Path, patch_path: Path) -> List[Union[str, Path]]: - cmd = [ + return [ "patch", "-d", - str(root_dir.absolute()), + root_dir.absolute(), "-f", "-E", "-p1", "--no-backup-if-mismatch", "-i", - str(patch_path), + patch_path, ] - return cmd diff --git a/llvm_tools/patch_utils_unittest.py b/llvm_tools/patch_utils_unittest.py index 26a211ee..362a8dfd 100755 --- a/llvm_tools/patch_utils_unittest.py +++ b/llvm_tools/patch_utils_unittest.py @@ -170,7 +170,7 @@ a patch_dir, TestPatchUtils._default_json_dict() ) - """Make a deepcopy of the case for testing commit patch option.""" + # Make a deepcopy of the case for testing commit patch option. e1 = copy.deepcopy(e) with mock.patch("pathlib.Path.is_file", return_value=True): @@ -178,7 +178,7 @@ a result = e.apply(src_dir) self.assertTrue(result.succeeded) - """Test that commit patch option works.""" + # Test that commit patch option works. with mock.patch("pathlib.Path.is_file", return_value=True): with mock.patch("subprocess.run", mock.MagicMock()): result1 = e1.apply(src_dir, pu.git_am) -- cgit v1.2.3 From e1133ef445d05e1d11df37bed59a4fdd4f02b855 Mon Sep 17 00:00:00 2001 From: mobiletc-prebuild Date: Mon, 8 Apr 2024 08:05:39 -0700 Subject: afdo_metadata: Publish the new kernel profiles This brings some profiles to their newest versions. The CrOS toolchain detective has been notified about the failures that occurred in this update. BUG=None TEST=Verified in kernel-release-afdo-verify-orchestrator Change-Id: I4053077cb7b1145bd8b042b77f0a110abe1086a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5435853 Auto-Submit: mobiletc-prebuild Role Account Tested-by: mobiletc-prebuild Role Account Reviewed-by: George Burgess Commit-Queue: George Burgess --- afdo_metadata/kernel_afdo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afdo_metadata/kernel_afdo.json b/afdo_metadata/kernel_afdo.json index 8a1f080c..0822034d 100644 --- a/afdo_metadata/kernel_afdo.json +++ b/afdo_metadata/kernel_afdo.json @@ -1,6 +1,6 @@ { "chromeos-kernel-5_10": { - "name": "R125-15823.11-1711964216" + "name": "R125-15823.16-1712568782" }, "chromeos-kernel-5_15": { "name": "R125-15823.11-1711964130" -- cgit v1.2.3 From f6dc855cf184d58707e1ee243d8a214d09679748 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 3 Apr 2024 10:37:34 -0600 Subject: llvm_tools: add clean_up_old_llvm_patches script BUG=b:332589934 TEST=Ran the script; it uploaded a CL correctly: crrev.com/c/5421089 Change-Id: Ib7f18f5d55102c3eeceb6db942832063e9883d41 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5420775 Tested-by: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: George Burgess --- llvm_tools/clean_up_old_llvm_patches.py | 183 ++++++++++++++++++++++++++++++++ llvm_tools/patch_utils.py | 76 +++++++------ llvm_tools/patch_utils_unittest.py | 73 ++++++------- llvm_tools/update_chromeos_llvm_hash.py | 10 +- 4 files changed, 256 insertions(+), 86 deletions(-) create mode 100755 llvm_tools/clean_up_old_llvm_patches.py diff --git a/llvm_tools/clean_up_old_llvm_patches.py b/llvm_tools/clean_up_old_llvm_patches.py new file mode 100755 index 00000000..fef4cf00 --- /dev/null +++ b/llvm_tools/clean_up_old_llvm_patches.py @@ -0,0 +1,183 @@ +#!/usr/bin/env python3 +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Removes all LLVM patches before a certain point.""" + +import argparse +import logging +from pathlib import Path +import subprocess +import sys +import textwrap +from typing import List, Optional + +from cros_utils import git_utils +import patch_utils + + +# The chromiumos-overlay packages to GC patches in. +PACKAGES_TO_COLLECT = patch_utils.CHROMEOS_PATCHES_JSON_PACKAGES + +# Folks who should be on the R-line of any CLs that get uploaded. +CL_REVIEWERS = (git_utils.REVIEWER_DETECTIVE,) + +# Folks who should be on the CC-line of any CLs that get uploaded. +CL_CC = ("gbiv@google.com",) + + +def maybe_autodetect_cros_overlay(my_dir: Path) -> Optional[Path]: + third_party = my_dir.parent.parent + cros_overlay = third_party / "chromiumos-overlay" + if cros_overlay.exists(): + return cros_overlay + return None + + +def remove_old_patches(cros_overlay: Path, min_revision: int) -> bool: + """Removes patches in cros_overlay. Returns whether changes were made.""" + patches_removed = 0 + for package in PACKAGES_TO_COLLECT: + logging.info("GC'ing patches from %s...", package) + patches_json = cros_overlay / package / "files/PATCHES.json" + removed_patch_files = patch_utils.remove_old_patches( + min_revision, patches_json + ) + if not removed_patch_files: + logging.info("No patches removed from %s", patches_json) + continue + + patches_removed += len(removed_patch_files) + for patch in removed_patch_files: + logging.info("Removing %s...", patch) + patch.unlink() + return patches_removed != 0 + + +def commit_changes(cros_overlay: Path, min_rev: int): + commit_msg = textwrap.dedent( + f""" + llvm: remove old patches + + These patches stopped applying before r{min_rev}, so should no longer + be needed. + + BUG=b:332601837 + TEST=CQ + """ + ) + + subprocess.run( + ["git", "commit", "--quiet", "-a", "-m", commit_msg], + cwd=cros_overlay, + check=True, + stdin=subprocess.DEVNULL, + ) + + +def upload_changes(cros_overlay: Path) -> None: + cl_ids = git_utils.upload_to_gerrit( + cros_overlay, + remote="cros", + branch="main", + reviewers=CL_REVIEWERS, + cc=CL_CC, + ) + + if len(cl_ids) > 1: + raise ValueError(f"Unexpected: wanted just one CL upload; got {cl_ids}") + + cl_id = cl_ids[0] + logging.info("Uploaded CL http://crrev.com/c/%s successfully.", cl_id) + git_utils.try_set_autosubmit_labels(cros_overlay, cl_id) + + +def get_opts(my_dir: Path, argv: List[str]) -> argparse.Namespace: + """Returns options for the script.""" + + parser = argparse.ArgumentParser( + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, + ) + parser.add_argument( + "--chromiumos-overlay", + type=Path, + help=""" + Path to chromiumos-overlay. Will autodetect if none is specified. If + autodetection fails and none is specified, this script will fail. + """, + ) + parser.add_argument( + "--revision", + type=int, + help=""" + Revision to delete before (exclusive). All patches that stopped + applying before this will be removed. Phrased as an int, e.g., + `--revision=1234`. + """, + ) + parser.add_argument( + "--commit", + action="store_true", + help="Commit changes after making them.", + ) + parser.add_argument( + "--upload-with-autoreview", + action="store_true", + help=""" + Upload changes after committing them. Implies --commit. Also adds + default reviewers, and starts CQ+1 (among other convenience features). + """, + ) + opts = parser.parse_args(argv) + + if not opts.chromiumos_overlay: + maybe_overlay = maybe_autodetect_cros_overlay(my_dir) + if not maybe_overlay: + parser.error( + "Failed to autodetect --chromiumos-overlay; please pass a value" + ) + opts.chromiumos_overlay = maybe_overlay + return opts + + +def main(argv: List[str]) -> None: + logging.basicConfig( + format=">> %(asctime)s: %(levelname)s: %(filename)s:%(lineno)d: " + "%(message)s", + level=logging.INFO, + ) + + my_dir = Path(__file__).resolve().parent + opts = get_opts(my_dir, argv) + + cros_overlay = opts.chromiumos_overlay + upload = opts.upload_with_autoreview + commit = opts.commit or upload + revision = opts.revision + + made_changes = remove_old_patches(cros_overlay, revision) + if not made_changes: + logging.info("No changes made; exiting.") + return + + if not commit: + logging.info( + "Changes were made, but --commit wasn't specified. My job is done." + ) + return + + logging.info("Committing changes...") + commit_changes(cros_overlay, revision) + if not upload: + logging.info("Change with removed patches has been committed locally.") + return + + logging.info("Uploading changes...") + upload_changes(cros_overlay) + logging.info("Change sent for review.") + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/llvm_tools/patch_utils.py b/llvm_tools/patch_utils.py index b5383ac9..521ff6c6 100644 --- a/llvm_tools/patch_utils.py +++ b/llvm_tools/patch_utils.py @@ -34,6 +34,15 @@ HUNK_HEADER_RE = re.compile(r"^@@\s+-(\d+),(\d+)\s+\+(\d+),(\d+)\s+@@") HUNK_END_RE = re.compile(r"^--\s*$") PATCH_SUBFILE_HEADER_RE = re.compile(r"^\+\+\+ [ab]/(.*)$") +CHROMEOS_PATCHES_JSON_PACKAGES = ( + "dev-util/lldb-server", + "sys-devel/llvm", + "sys-libs/compiler-rt", + "sys-libs/libcxx", + "sys-libs/llvm-libunwind", + "sys-libs/scudo", +) + @dataclasses.dataclass class Hunk: @@ -232,16 +241,6 @@ class PatchEntry: until_v = sys.maxsize return from_v <= svn_version < until_v - def is_old(self, svn_version: int) -> bool: - """Is this patch old compared to `svn_version`?""" - if not self.version_range: - return False - until_v = self.version_range.get("until") - # Sometimes the key is there, but it's set to None. - if until_v is None: - until_v = sys.maxsize - return svn_version >= until_v - def apply( self, root_dir: Path, @@ -297,6 +296,17 @@ class PatchEntry: return self.metadata.get("title", "") +def patch_applies_after( + version_range: Optional[Dict[str, Optional[int]]], svn_version: int +) -> bool: + """Does this patch apply after `svn_version`?""" + if not version_range: + return True + until = version_range.get("until") + before_svn_version = until is not None and svn_version > until + return not before_svn_version + + @dataclasses.dataclass(frozen=True) class PatchInfo: """Holds info for a round of patch applications.""" @@ -596,9 +606,7 @@ def update_version_ranges_with_entries( return modified_entries, applied_patches -def remove_old_patches( - svn_version: int, llvm_src_dir: Path, patches_json_fp: Path -) -> PatchInfo: +def remove_old_patches(svn_version: int, patches_json: Path) -> List[Path]: """Remove patches that don't and will never apply for the future. Patches are determined to be "old" via the "is_old" method for @@ -606,37 +614,27 @@ def remove_old_patches( Args: svn_version: LLVM SVN version. - llvm_src_dir: LLVM source directory. - patches_json_fp: Location to edit patches on. + patches_json: Location of PATCHES.json. Returns: - PatchInfo for modified patches. + A list of all patch paths removed from PATCHES.json. """ - with patches_json_fp.open(encoding="utf-8") as f: - contents = f.read() + contents = patches_json.read_text(encoding="utf-8") indent_len = predict_indent(contents.splitlines()) - patch_entries = json_str_to_patch_entries( - llvm_src_dir, - contents, - ) - oldness = [(entry, entry.is_old(svn_version)) for entry in patch_entries] - filtered_entries = [entry.to_dict() for entry, old in oldness if not old] - with atomic_write_file.atomic_write(patches_json_fp, encoding="utf-8") as f: - _write_json_changes(filtered_entries, f, indent_len=indent_len) - removed_entries = [entry for entry, old in oldness if old] - plural_patches = "patch" if len(removed_entries) == 1 else "patches" - print(f"Removed {len(removed_entries)} old {plural_patches}:") - for r in removed_entries: - print(f"- {r.rel_patch_path}: {r.title()}") - return PatchInfo( - non_applicable_patches=[], - applied_patches=[], - failed_patches=[], - disabled_patches=[], - removed_patches=[p.rel_patch_path for p in removed_entries], - modified_metadata=str(patches_json_fp) if removed_entries else None, - ) + still_new = [] + removed_patches = [] + patches_parent = patches_json.parent + for entry in json.loads(contents): + if patch_applies_after(entry.get("version_range"), svn_version): + still_new.append(entry) + else: + removed_patches.append(patches_parent / entry["rel_patch_path"]) + + with atomic_write_file.atomic_write(patches_json, encoding="utf-8") as f: + _write_json_changes(still_new, f, indent_len=indent_len) + + return removed_patches def git_am(patch_path: Path) -> List[Union[str, Path]]: diff --git a/llvm_tools/patch_utils_unittest.py b/llvm_tools/patch_utils_unittest.py index 362a8dfd..117046c4 100755 --- a/llvm_tools/patch_utils_unittest.py +++ b/llvm_tools/patch_utils_unittest.py @@ -9,9 +9,9 @@ import copy import io import json from pathlib import Path +import shutil import subprocess import tempfile -from typing import Callable import unittest from unittest import mock @@ -21,6 +21,11 @@ import patch_utils as pu class TestPatchUtils(unittest.TestCase): """Test the patch_utils.""" + def make_tempdir(self) -> Path: + tmpdir = Path(tempfile.mkdtemp(prefix="patch_utils_unittest")) + self.addCleanup(shutil.rmtree, tmpdir) + return tmpdir + def test_predict_indent(self): test_str1 = """ a @@ -311,49 +316,39 @@ Hunk #1 SUCCEEDED at 96 with fuzz 1. self.assertEqual(patches2[1].version_range, {"from": 0, "until": 2}) self.assertEqual(patches2[2].version_range, {"from": 4, "until": 5}) - @mock.patch("builtins.print") - def test_remove_old_patches(self, _): - """Can remove old patches from PATCHES.json.""" - one_patch_dict = { - "metadata": { - "title": "[some label] hello world", + def test_remove_old_patches(self): + patches = [ + {"rel_patch_path": "foo.patch"}, + { + "rel_patch_path": "bar.patch", + "version_range": { + "from": 1, + }, }, - "platforms": [ - "chromiumos", - ], - "rel_patch_path": "x/y/z", - "version_range": { - "from": 4, - "until": 5, + { + "rel_patch_path": "baz.patch", + "version_range": { + "until": 1, + }, }, - } - patches = [ - one_patch_dict, - {**one_patch_dict, "version_range": {"until": None}}, - {**one_patch_dict, "version_range": {"from": 100}}, - {**one_patch_dict, "version_range": {"until": 8}}, - ] - cases = [ - (0, lambda x: self.assertEqual(len(x), 4)), - (6, lambda x: self.assertEqual(len(x), 3)), - (8, lambda x: self.assertEqual(len(x), 2)), - (1000, lambda x: self.assertEqual(len(x), 2)), ] - def _t(dirname: str, svn_version: int, assertion_f: Callable): - json_filepath = Path(dirname) / "PATCHES.json" - with json_filepath.open("w", encoding="utf-8") as f: - json.dump(patches, f) - pu.remove_old_patches(svn_version, Path(), json_filepath) - with json_filepath.open("r", encoding="utf-8") as f: - result = json.load(f) - assertion_f(result) + tempdir = self.make_tempdir() + patches_json = tempdir / "PATCHES.json" + with patches_json.open("w", encoding="utf-8") as f: + json.dump(patches, f) - with tempfile.TemporaryDirectory( - prefix="patch_utils_unittest" - ) as dirname: - for r, a in cases: - _t(dirname, r, a) + removed_paths = pu.remove_old_patches( + svn_version=10, patches_json=patches_json + ) + self.assertEqual(removed_paths, [tempdir / "baz.patch"]) + expected_patches = [ + x for x in patches if x["rel_patch_path"] != "baz.patch" + ] + self.assertEqual( + json.loads(patches_json.read_text(encoding="utf-8")), + expected_patches, + ) @staticmethod def _default_json_dict(): diff --git a/llvm_tools/update_chromeos_llvm_hash.py b/llvm_tools/update_chromeos_llvm_hash.py index bbb5edb3..f6161773 100755 --- a/llvm_tools/update_chromeos_llvm_hash.py +++ b/llvm_tools/update_chromeos_llvm_hash.py @@ -29,14 +29,8 @@ import patch_utils import subprocess_helpers -DEFAULT_PACKAGES = [ - "dev-util/lldb-server", - "sys-devel/llvm", - "sys-libs/compiler-rt", - "sys-libs/libcxx", - "sys-libs/llvm-libunwind", - "sys-libs/scudo", -] +# Default list of packages to update. +DEFAULT_PACKAGES = patch_utils.CHROMEOS_PATCHES_JSON_PACKAGES DEFAULT_MANIFEST_PACKAGES = ["sys-devel/llvm"] -- cgit v1.2.3 From b5f88d7db8150006a24675d8db1376678f7e850a Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 3 Apr 2024 10:54:19 -0600 Subject: llvm_tools: use new make_tempdir method in tests This was added in crrev.com/c/5420775, but too noisy to migrate everything as part of that CL. BUG=b:332589934 TEST=repo upload Change-Id: I0356a726a32a18be3671f5dea5613b4c9534b949 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5420794 Reviewed-by: Jordan Abrahams-Whitehead Tested-by: George Burgess Commit-Queue: George Burgess --- llvm_tools/patch_utils_unittest.py | 190 ++++++++++++++++++------------------- 1 file changed, 92 insertions(+), 98 deletions(-) diff --git a/llvm_tools/patch_utils_unittest.py b/llvm_tools/patch_utils_unittest.py index 117046c4..311a4dbd 100755 --- a/llvm_tools/patch_utils_unittest.py +++ b/llvm_tools/patch_utils_unittest.py @@ -208,113 +208,107 @@ Hunk #1 SUCCEEDED at 96 with fuzz 1. def test_is_git_dirty(self): """Test if a git directory has uncommitted changes.""" - with tempfile.TemporaryDirectory( - prefix="patch_utils_unittest" - ) as dirname: - dirpath = Path(dirname) - - def _run_h(cmd): - subprocess.run( - cmd, - cwd=dirpath, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, - check=True, - ) - - _run_h(["git", "init"]) - self.assertFalse(pu.is_git_dirty(dirpath)) - test_file = dirpath / "test_file" - test_file.touch() - self.assertTrue(pu.is_git_dirty(dirpath)) - _run_h(["git", "add", "."]) - _run_h(["git", "commit", "-m", "test"]) - self.assertFalse(pu.is_git_dirty(dirpath)) - test_file.touch() - self.assertFalse(pu.is_git_dirty(dirpath)) - with test_file.open("w", encoding="utf-8"): - test_file.write_text("abc") - self.assertTrue(pu.is_git_dirty(dirpath)) + dirpath = self.make_tempdir() + + def _run_h(cmd): + subprocess.run( + cmd, + cwd=dirpath, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + check=True, + ) + + _run_h(["git", "init"]) + self.assertFalse(pu.is_git_dirty(dirpath)) + test_file = dirpath / "test_file" + test_file.touch() + self.assertTrue(pu.is_git_dirty(dirpath)) + _run_h(["git", "add", "."]) + _run_h(["git", "commit", "-m", "test"]) + self.assertFalse(pu.is_git_dirty(dirpath)) + test_file.touch() + self.assertFalse(pu.is_git_dirty(dirpath)) + with test_file.open("w", encoding="utf-8"): + test_file.write_text("abc") + self.assertTrue(pu.is_git_dirty(dirpath)) @mock.patch("patch_utils.git_clean_context", mock.MagicMock) def test_update_version_ranges(self): """Test the UpdateVersionRanges function.""" - with tempfile.TemporaryDirectory( - prefix="patch_manager_unittest" - ) as dirname: - dirpath = Path(dirname) - patches = [ - pu.PatchEntry( - workdir=dirpath, - rel_patch_path="x.patch", - metadata=None, - platforms=None, - version_range={ - "from": 0, - "until": 2, - }, - ), - pu.PatchEntry( - workdir=dirpath, - rel_patch_path="y.patch", - metadata=None, - platforms=None, - version_range={ - "from": 0, - "until": 2, - }, - ), - pu.PatchEntry( - workdir=dirpath, - rel_patch_path="z.patch", - metadata=None, - platforms=None, - version_range={ - "from": 4, - "until": 5, - }, - ), - ] - - patches[0].apply = mock.MagicMock( - return_value=pu.PatchResult( - succeeded=False, failed_hunks={"a/b/c": []} - ) - ) - patches[1].apply = mock.MagicMock( - return_value=pu.PatchResult(succeeded=True) - ) - patches[2].apply = mock.MagicMock( - return_value=pu.PatchResult(succeeded=False) + dirpath = self.make_tempdir() + patches = [ + pu.PatchEntry( + workdir=dirpath, + rel_patch_path="x.patch", + metadata=None, + platforms=None, + version_range={ + "from": 0, + "until": 2, + }, + ), + pu.PatchEntry( + workdir=dirpath, + rel_patch_path="y.patch", + metadata=None, + platforms=None, + version_range={ + "from": 0, + "until": 2, + }, + ), + pu.PatchEntry( + workdir=dirpath, + rel_patch_path="z.patch", + metadata=None, + platforms=None, + version_range={ + "from": 4, + "until": 5, + }, + ), + ] + + patches[0].apply = mock.MagicMock( + return_value=pu.PatchResult( + succeeded=False, failed_hunks={"a/b/c": []} ) + ) + patches[1].apply = mock.MagicMock( + return_value=pu.PatchResult(succeeded=True) + ) + patches[2].apply = mock.MagicMock( + return_value=pu.PatchResult(succeeded=False) + ) - # Make a deepcopy of patches to test commit patch option - patches2 = copy.deepcopy(patches) + # Make a deepcopy of patches to test commit patch option + patches2 = copy.deepcopy(patches) - results, _ = pu.update_version_ranges_with_entries( - 1, dirpath, patches, pu.gnu_patch - ) + results, _ = pu.update_version_ranges_with_entries( + 1, dirpath, patches, pu.gnu_patch + ) - # We should only have updated the version_range of the first patch, - # as that one failed to apply. - self.assertEqual(len(results), 1) - self.assertEqual(results[0].version_range, {"from": 0, "until": 1}) - self.assertEqual(patches[0].version_range, {"from": 0, "until": 1}) - self.assertEqual(patches[1].version_range, {"from": 0, "until": 2}) - self.assertEqual(patches[2].version_range, {"from": 4, "until": 5}) - - # Test git am option - results2, _ = pu.update_version_ranges_with_entries( - 1, dirpath, patches2, pu.git_am - ) + # We should only have updated the version_range of the first patch, + # as that one failed to apply. + self.assertEqual(len(results), 1) + self.assertEqual(results[0].version_range, {"from": 0, "until": 1}) + self.assertEqual(patches[0].version_range, {"from": 0, "until": 1}) + self.assertEqual(patches[1].version_range, {"from": 0, "until": 2}) + self.assertEqual(patches[2].version_range, {"from": 4, "until": 5}) + + # Test git am option + results2, _ = pu.update_version_ranges_with_entries( + 1, dirpath, patches2, pu.git_am + ) - # We should only have updated the version_range of the first patch - # via git am, as that one failed to apply. - self.assertEqual(len(results2), 1) - self.assertEqual(results2[0].version_range, {"from": 0, "until": 1}) - self.assertEqual(patches2[0].version_range, {"from": 0, "until": 1}) - self.assertEqual(patches2[1].version_range, {"from": 0, "until": 2}) - self.assertEqual(patches2[2].version_range, {"from": 4, "until": 5}) + # We should only have updated the version_range of the first patch + # via git am, as that one failed to apply. + self.assertEqual(len(results2), 1) + self.assertEqual(results2[0].version_range, {"from": 0, "until": 1}) + self.assertEqual(patches2[0].version_range, {"from": 0, "until": 1}) + self.assertEqual(patches2[1].version_range, {"from": 0, "until": 2}) + self.assertEqual(patches2[2].version_range, {"from": 4, "until": 5}) def test_remove_old_patches(self): patches = [ -- cgit v1.2.3 From ae16c1ddb4b3fca7bc7613e1a5b2f2dd95686bd4 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 8 Apr 2024 16:40:37 -0600 Subject: setup_for_workon: make --checkout or --no-checkout mandatory As suggested by ryanbeltran@. BUG=None TEST=Ran with --checkout, --no-checkout, and neither of these. TEST=Succeeded in the first two cases, failed with a helpful error TEST=message in the last. Change-Id: I418daaf64053aefcf454a0b4794db037f2fcc39b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5436086 Commit-Queue: George Burgess Tested-by: George Burgess Reviewed-by: Ryan Beltran --- llvm_tools/setup_for_workon.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/llvm_tools/setup_for_workon.py b/llvm_tools/setup_for_workon.py index 41f3d45c..8c67f816 100755 --- a/llvm_tools/setup_for_workon.py +++ b/llvm_tools/setup_for_workon.py @@ -138,12 +138,6 @@ def main(argv: List[str]) -> None: autodetected. Example: ${cros_overlay}/sys-devel/llvm. """, ) - parser.add_argument( - "--checkout", - help=""" - If specified, the llvm directory will be checked out to the given SHA. - """, - ) parser.add_argument( "--clean-llvm", action="store_true", @@ -175,6 +169,26 @@ def main(argv: List[str]) -> None: Set to 'host' for working on the host system, and not a board. """, ) + + checkout_group = parser.add_mutually_exclusive_group(required=True) + checkout_group.add_argument( + "--checkout", + help=""" + If specified, the llvm directory will be checked out to the given SHA. + """, + ) + # The value of this isn't used anywhere; it's just used as an explicit + # nudge for checking LLVM out. + checkout_group.add_argument( + "--no-checkout", + action="store_true", + help=""" + Don't check llvm-project out to anything special before running. Useful + if you'd like to, for example, workon multiple LLVM projects + simultaneously and have already called `setup_for_workon` on another + one. + """, + ) opts = parser.parse_args(argv) ebuild_dir = opts.ebuild_dir @@ -199,7 +213,7 @@ def main(argv: List[str]) -> None: ["git", "reset", "--hard", "HEAD"], ) - if opts.checkout: + if opts.checkout is not None: git_housekeeping_commands.append( ["git", "checkout", "--quiet", opts.checkout], ) -- cgit v1.2.3 From 9a6d822bdc252af248994cecb68b55c8906757a4 Mon Sep 17 00:00:00 2001 From: mobiletc-prebuild Date: Wed, 10 Apr 2024 08:05:30 -0700 Subject: afdo_metadata: Publish the new kernel profiles This brings some profiles to their newest versions. The CrOS toolchain detective has been notified about the failures that occurred in this update. BUG=None TEST=Verified in kernel-release-afdo-verify-orchestrator Change-Id: I58c8469ec6fa403c0a8cf535d844b95652f72468 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5443983 Commit-Queue: George Burgess Commit-Queue: mobiletc-prebuild Role Account Auto-Submit: mobiletc-prebuild Role Account Tested-by: mobiletc-prebuild Role Account Reviewed-by: George Burgess --- afdo_metadata/kernel_afdo.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/afdo_metadata/kernel_afdo.json b/afdo_metadata/kernel_afdo.json index 0822034d..0180b302 100644 --- a/afdo_metadata/kernel_afdo.json +++ b/afdo_metadata/kernel_afdo.json @@ -3,12 +3,12 @@ "name": "R125-15823.16-1712568782" }, "chromeos-kernel-5_15": { - "name": "R125-15823.11-1711964130" + "name": "R125-15832.0-1712569184" }, "chromeos-kernel-5_4": { - "name": "R125-15823.5-1711964299" + "name": "R125-15823.16-1712569649" }, "chromeos-kernel-6_1": { - "name": "R125-15823.11-1711964186" + "name": "R125-15823.16-1712569561" } } \ No newline at end of file -- cgit v1.2.3 From 13efc0f6f9816844c97eb5ccfd491777719ea472 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 28 Mar 2024 22:11:06 +0000 Subject: Make git am a dry run when running test_apply() git am doesn't have any dry run options. So we run git apply --summary for test_apply() when using git am. BUG=b:330740421 TEST=local test in llvm-toolchain Change-Id: Ifd69466098cad2179aebc3e57b4bb442699a6f96 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5404830 Reviewed-by: Aditya Kumar Reviewed-by: George Burgess Reviewed-by: Pirama Arumuga Nainar Auto-Submit: Zijun Zhao Tested-by: Jordan Abrahams-Whitehead Commit-Queue: Jordan Abrahams-Whitehead --- llvm_tools/patch_utils.py | 61 ++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/llvm_tools/patch_utils.py b/llvm_tools/patch_utils.py index 521ff6c6..c180a87a 100644 --- a/llvm_tools/patch_utils.py +++ b/llvm_tools/patch_utils.py @@ -158,6 +158,31 @@ class PatchResult: return s +def git_apply(patch_path: Path) -> List[Union[str, Path]]: + """Patch a patch file using 'git apply'.""" + return ["git", "apply", patch_path] + + +def git_am(patch_path: Path) -> List[Union[str, Path]]: + """Patch a patch file using 'git am'.""" + return ["git", "am", "--3way", patch_path] + + +def gnu_patch(root_dir: Path, patch_path: Path) -> List[Union[str, Path]]: + """Patch a patch file using GNU 'patch'.""" + return [ + "patch", + "-d", + root_dir.absolute(), + "-f", + "-E", + "-p1", + "--no-backup-if-mismatch", + "-i", + patch_path, + ] + + @dataclasses.dataclass class PatchEntry: """Object mapping of an entry of PATCHES.json.""" @@ -277,7 +302,7 @@ class PatchEntry: if hunk.hunk_id in failed_hunk_ids ] elif failed_hunks_id_dict: - # use git am + # using git am failed_hunks = parsed_hunks return PatchResult(succeeded=False, failed_hunks=failed_hunks) @@ -286,9 +311,19 @@ class PatchEntry: def test_apply( self, root_dir: Path, patch_cmd: Optional[Callable] = None ) -> PatchResult: - """Dry run applying a patch to a given directory.""" - extra_args = [] if patch_cmd is git_am else ["--dry-run"] - return self.apply(root_dir, patch_cmd, extra_args) + """Dry run applying a patch to a given directory. + + When using gnu_patch, this will pass --dry-run. + When using git_am or git_apply, this will instead + use git_apply with --summary. + """ + if patch_cmd is git_am or patch_cmd is git_apply: + # There is no dry run option for git am, + # so we use git apply for test. + return self.apply(root_dir, git_apply, ["--summary"]) + if patch_cmd is gnu_patch or patch_cmd is None: + return self.apply(root_dir, patch_cmd, ["--dry-run"]) + raise ValueError(f"No such patch command: {patch_cmd.__name__}.") def title(self) -> str: if not self.metadata: @@ -635,21 +670,3 @@ def remove_old_patches(svn_version: int, patches_json: Path) -> List[Path]: _write_json_changes(still_new, f, indent_len=indent_len) return removed_patches - - -def git_am(patch_path: Path) -> List[Union[str, Path]]: - return ["git", "am", "--3way", patch_path] - - -def gnu_patch(root_dir: Path, patch_path: Path) -> List[Union[str, Path]]: - return [ - "patch", - "-d", - root_dir.absolute(), - "-f", - "-E", - "-p1", - "--no-backup-if-mismatch", - "-i", - patch_path, - ] -- cgit v1.2.3 From 26d580d4ecdccce9b92188d13d7e69a58038e2f0 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 3 Apr 2024 12:53:57 -0600 Subject: afdo_tools: move worktree creation to git_utils This will be needed soon by more CLs for b/332589934. BUG=b:332589934 TEST=repo upload Change-Id: Id91a3604e0e547de0d348e6aa01ec168e0165c50 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5435854 Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: George Burgess Tested-by: George Burgess --- afdo_tools/update_kernel_afdo.py | 47 ++-------------------------------------- cros_utils/git_utils.py | 45 +++++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/afdo_tools/update_kernel_afdo.py b/afdo_tools/update_kernel_afdo.py index a7e40763..0a299bd2 100755 --- a/afdo_tools/update_kernel_afdo.py +++ b/afdo_tools/update_kernel_afdo.py @@ -9,7 +9,6 @@ It supports updating on canary, stable, and beta branches. """ import argparse -import contextlib import dataclasses import datetime import enum @@ -21,8 +20,7 @@ import re import shlex import subprocess import sys -import tempfile -from typing import Dict, Generator, Iterable, List, Optional, Tuple +from typing import Dict, Iterable, List, Optional, Tuple from cros_utils import git_utils @@ -167,47 +165,6 @@ def get_parser(): return parser -@contextlib.contextmanager -def git_worktree(git_directory: Path) -> Generator[Path, None, None]: - """Creates a temp worktree of `git_directory`, yielding the result.""" - with tempfile.TemporaryDirectory(prefix="update_kernel_afdo_") as t: - tempdir = Path(t) - logging.info( - "Establishing worktree of %s in %s", git_directory, tempdir - ) - subprocess.run( - [ - "git", - "worktree", - "add", - "--detach", - "--force", - tempdir, - ], - cwd=git_directory, - check=True, - stdin=subprocess.DEVNULL, - ) - - try: - yield tempdir - finally: - # Explicitly `git worktree remove` here, so the parent worktree's - # metadata is cleaned up promptly. - subprocess.run( - [ - "git", - "worktree", - "remove", - "--force", - tempdir, - ], - cwd=git_directory, - check=False, - stdin=subprocess.DEVNULL, - ) - - @dataclasses.dataclass(frozen=True, eq=True, order=True) class GitBranch: """Represents a ChromeOS branch.""" @@ -807,7 +764,7 @@ def main(argv: List[str]) -> None: fetcher = KernelProfileFetcher() had_failures = False - with git_worktree(toolchain_utils) as worktree: + with git_utils.create_worktree(toolchain_utils) as worktree: for channel in opts.channel: branch = branches[channel] result = update_afdo_for_channel( diff --git a/cros_utils/git_utils.py b/cros_utils/git_utils.py index 1ae02ae0..6910a0ca 100644 --- a/cros_utils/git_utils.py +++ b/cros_utils/git_utils.py @@ -4,12 +4,14 @@ """Shared utilities for working with git.""" +import contextlib import logging from pathlib import Path import re import shlex import subprocess -from typing import Iterable, List +import tempfile +from typing import Generator, Iterable, List # Email address used to tag the detective as a reviewer. @@ -105,3 +107,44 @@ def try_set_autosubmit_labels(chromeos_tree: Path, cl_id: int) -> None: "Failed to run gerrit command %s. Ignoring.", shlex.join(cmd), ) + + +@contextlib.contextmanager +def create_worktree(git_directory: Path) -> Generator[Path, None, None]: + """Creates a temp worktree of `git_directory`, yielding the result.""" + with tempfile.TemporaryDirectory(prefix="update_kernel_afdo_") as t: + tempdir = Path(t) + logging.info( + "Establishing worktree of %s in %s", git_directory, tempdir + ) + subprocess.run( + [ + "git", + "worktree", + "add", + "--detach", + "--force", + tempdir, + ], + cwd=git_directory, + check=True, + stdin=subprocess.DEVNULL, + ) + + try: + yield tempdir + finally: + # Explicitly `git worktree remove` here, so the parent worktree's + # metadata is cleaned up promptly. + subprocess.run( + [ + "git", + "worktree", + "remove", + "--force", + tempdir, + ], + cwd=git_directory, + check=False, + stdin=subprocess.DEVNULL, + ) -- cgit v1.2.3 From 91004c1369b35a2d7127bb5b6c1ae33e582fe993 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 3 Apr 2024 13:03:23 -0600 Subject: llvm_tools: add revision autodetection to the patch cleanup script This is the last bit of b/332589934#comment3. Once this lands & is tested, we can add a tiny script to work in a cros worktree, add that to cron, and consider this fixed. BUG=b:332589934 TEST=Ran on Chrotomation Change-Id: I812f9e75e2349b88308be89687687131159bafc3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5435855 Commit-Queue: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Tested-by: George Burgess --- llvm_tools/clean_up_old_llvm_patches.py | 118 ++++++++++++++++++++++++--- llvm_tools/clean_up_old_llvm_patches_test.py | 68 +++++++++++++++ 2 files changed, 175 insertions(+), 11 deletions(-) create mode 100755 llvm_tools/clean_up_old_llvm_patches_test.py diff --git a/llvm_tools/clean_up_old_llvm_patches.py b/llvm_tools/clean_up_old_llvm_patches.py index fef4cf00..5418c707 100755 --- a/llvm_tools/clean_up_old_llvm_patches.py +++ b/llvm_tools/clean_up_old_llvm_patches.py @@ -6,8 +6,11 @@ """Removes all LLVM patches before a certain point.""" import argparse +import importlib.abc +import importlib.util import logging from pathlib import Path +import re import subprocess import sys import textwrap @@ -93,6 +96,63 @@ def upload_changes(cros_overlay: Path) -> None: git_utils.try_set_autosubmit_labels(cros_overlay, cl_id) +def find_chromeos_llvm_version(chromiumos_overlay: Path) -> int: + sys_devel_llvm = chromiumos_overlay / "sys-devel" / "llvm" + + # Pick this from the name of the stable ebuild; 9999 is a bit harder to + # parse, and stable is just as good. + stable_llvm_re = re.compile(r"^llvm.*_pre(\d+)-r\d+\.ebuild$") + match_gen = ( + stable_llvm_re.fullmatch(x.name) for x in sys_devel_llvm.iterdir() + ) + matches = [int(x.group(1)) for x in match_gen if x] + + if len(matches) != 1: + raise ValueError( + f"Expected exactly one ebuild name match in {sys_devel_llvm}; " + f"found {len(matches)}" + ) + return matches[0] + + +def find_android_llvm_version(android_toolchain_tree: Path) -> int: + android_version_py = ( + android_toolchain_tree + / "toolchain" + / "llvm_android" + / "android_version.py" + ) + + # Per + # https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly. + # Parsing this file is undesirable, since `_svn_revision`, as a variable, + # isn't meant to be relied on. Let Python handle the logic instead. + module_name = "android_version" + android_version = sys.modules.get(module_name) + if android_version is None: + spec = importlib.util.spec_from_file_location( + module_name, android_version_py + ) + if not spec: + raise ImportError( + f"Failed loading module spec from {android_version_py}" + ) + android_version = importlib.util.module_from_spec(spec) + sys.modules[module_name] = android_version + loader = spec.loader + if not isinstance(loader, importlib.abc.Loader): + raise ValueError( + f"Loader for {android_version_py} was of type " + f"{type(loader)}; wanted an importlib.util.Loader" + ) + loader.exec_module(android_version) + + rev = android_version.get_svn_revision() + match = re.match(r"r(\d+)", rev) + assert match, f"Invalid SVN revision: {rev!r}" + return int(match.group(1)) + + def get_opts(my_dir: Path, argv: List[str]) -> argparse.Namespace: """Returns options for the script.""" @@ -101,20 +161,19 @@ def get_opts(my_dir: Path, argv: List[str]) -> argparse.Namespace: formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument( - "--chromiumos-overlay", + "--android-toolchain", type=Path, help=""" - Path to chromiumos-overlay. Will autodetect if none is specified. If - autodetection fails and none is specified, this script will fail. + Path to an android-toolchain repo root. Only meaningful if + `--autodetect-revision` is passed. """, ) parser.add_argument( - "--revision", - type=int, + "--chromiumos-overlay", + type=Path, help=""" - Revision to delete before (exclusive). All patches that stopped - applying before this will be removed. Phrased as an int, e.g., - `--revision=1234`. + Path to chromiumos-overlay. Will autodetect if none is specified. If + autodetection fails and none is specified, this script will fail. """, ) parser.add_argument( @@ -130,6 +189,26 @@ def get_opts(my_dir: Path, argv: List[str]) -> argparse.Namespace: default reviewers, and starts CQ+1 (among other convenience features). """, ) + + revision_opt = parser.add_mutually_exclusive_group(required=True) + revision_opt.add_argument( + "--revision", + type=int, + help=""" + Revision to delete before (exclusive). All patches that stopped + applying before this will be removed. Phrased as an int, e.g., + `--revision=1234`. + """, + ) + revision_opt.add_argument( + "--autodetect-revision", + action="store_true", + help=""" + Autodetect the value for `--revision`. If this is passed, you must also + pass `--android-toolchain`. This sets `--revision` to the _lesser_ of + Android's current LLVM version, and ChromeOS'. + """, + ) opts = parser.parse_args(argv) if not opts.chromiumos_overlay: @@ -139,6 +218,23 @@ def get_opts(my_dir: Path, argv: List[str]) -> argparse.Namespace: "Failed to autodetect --chromiumos-overlay; please pass a value" ) opts.chromiumos_overlay = maybe_overlay + + if opts.autodetect_revision: + if not opts.android_toolchain: + parser.error( + "--android-toolchain must be passed with --autodetect-revision" + ) + + cros_llvm_version = find_chromeos_llvm_version(opts.chromiumos_overlay) + logging.info("Detected CrOS LLVM revision: r%d", cros_llvm_version) + android_llvm_version = find_android_llvm_version(opts.android_toolchain) + logging.info( + "Detected Android LLVM revision: r%d", android_llvm_version + ) + r = min(cros_llvm_version, android_llvm_version) + logging.info("Selected minimum LLVM revision: r%d", r) + opts.revision = r + return opts @@ -155,9 +251,9 @@ def main(argv: List[str]) -> None: cros_overlay = opts.chromiumos_overlay upload = opts.upload_with_autoreview commit = opts.commit or upload - revision = opts.revision + min_revision = opts.revision - made_changes = remove_old_patches(cros_overlay, revision) + made_changes = remove_old_patches(cros_overlay, min_revision) if not made_changes: logging.info("No changes made; exiting.") return @@ -169,7 +265,7 @@ def main(argv: List[str]) -> None: return logging.info("Committing changes...") - commit_changes(cros_overlay, revision) + commit_changes(cros_overlay, min_revision) if not upload: logging.info("Change with removed patches has been committed locally.") return diff --git a/llvm_tools/clean_up_old_llvm_patches_test.py b/llvm_tools/clean_up_old_llvm_patches_test.py new file mode 100755 index 00000000..02100c8f --- /dev/null +++ b/llvm_tools/clean_up_old_llvm_patches_test.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Tests for clean_up_old_llvm_patches""" + +from pathlib import Path +import shutil +import tempfile +import unittest + +import clean_up_old_llvm_patches + + +ANDROID_VERSION_PY_EXAMPLE = """ +def get_svn_revision(): + return "r654321" +""" + + +class Test(unittest.TestCase): + """Tests for clean_up_old_llvm_patches""" + + def make_tempdir(self) -> Path: + tmpdir = Path(tempfile.mkdtemp(prefix="patch_utils_unittest")) + self.addCleanup(shutil.rmtree, tmpdir) + return tmpdir + + def test_android_version_autodetection(self): + android_root = self.make_tempdir() + android_version_py = ( + android_root / "toolchain" / "llvm_android" / "android_version.py" + ) + android_version_py.parent.mkdir(parents=True) + android_version_py.write_text( + ANDROID_VERSION_PY_EXAMPLE, encoding="utf-8" + ) + + self.assertEqual( + clean_up_old_llvm_patches.find_android_llvm_version(android_root), + 654321, + ) + + def test_chromeos_version_autodetection(self): + chromiumos_overlay = self.make_tempdir() + llvm = chromiumos_overlay / "sys-devel" / "llvm" + llvm.mkdir(parents=True) + + file_names = ( + "Manifest", + "llvm-12.0-r1.ebuild", + "llvm-18.0_pre123456-r90.ebuild", + "llvm-9999.ebuild", + ) + for f in file_names: + (llvm / f).touch() + + self.assertEqual( + clean_up_old_llvm_patches.find_chromeos_llvm_version( + chromiumos_overlay + ), + 123456, + ) + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3 From 9418ce841b65c955a4b836f271feabc0f5092c4e Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 8 Apr 2024 15:36:08 -0600 Subject: llvm_tools: add gerrit cwd This has to be run in a worktree on Chrotomation, which might not be in a `repo` checkout. BUG=b:332601837 TEST=None :) Change-Id: Ia9a9888db302ca28ce76b3bb7802003dab140755 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5436084 Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: George Burgess Tested-by: George Burgess --- cros_utils/git_utils.py | 10 ++++++++-- llvm_tools/clean_up_old_llvm_patches.py | 19 ++++++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/cros_utils/git_utils.py b/cros_utils/git_utils.py index 6910a0ca..c4245280 100644 --- a/cros_utils/git_utils.py +++ b/cros_utils/git_utils.py @@ -79,11 +79,17 @@ def upload_to_gerrit( return _parse_cls_from_upload_output(run_result.stdout) -def try_set_autosubmit_labels(chromeos_tree: Path, cl_id: int) -> None: +def try_set_autosubmit_labels(cwd: Path, cl_id: int) -> None: """Sets autosubmit on a CL. Logs - not raises - on failure. This sets a series of convenience labels on the given cl_number, so landing it (e.g., for the detective) is as easy as possible. + + Args: + cwd: the directory that the `gerrit` tool should be run in. Anywhere in + a ChromeOS tree will do. The `gerrit` command fails if it isn't run + from within a ChromeOS tree. + cl_id: The CL number to apply labels to. """ gerrit_cl_id = str(cl_id) gerrit_commands = ( @@ -98,7 +104,7 @@ def try_set_autosubmit_labels(chromeos_tree: Path, cl_id: int) -> None: # script is expeted to be used. return_code = subprocess.run( cmd, - cwd=chromeos_tree, + cwd=cwd, check=False, stdin=subprocess.DEVNULL, ).returncode diff --git a/llvm_tools/clean_up_old_llvm_patches.py b/llvm_tools/clean_up_old_llvm_patches.py index 5418c707..d1ae54b2 100755 --- a/llvm_tools/clean_up_old_llvm_patches.py +++ b/llvm_tools/clean_up_old_llvm_patches.py @@ -79,7 +79,7 @@ def commit_changes(cros_overlay: Path, min_rev: int): ) -def upload_changes(cros_overlay: Path) -> None: +def upload_changes(cros_overlay: Path, autosubmit_cwd: Path) -> None: cl_ids = git_utils.upload_to_gerrit( cros_overlay, remote="cros", @@ -93,7 +93,7 @@ def upload_changes(cros_overlay: Path) -> None: cl_id = cl_ids[0] logging.info("Uploaded CL http://crrev.com/c/%s successfully.", cl_id) - git_utils.try_set_autosubmit_labels(cros_overlay, cl_id) + git_utils.try_set_autosubmit_labels(autosubmit_cwd, cl_id) def find_chromeos_llvm_version(chromiumos_overlay: Path) -> int: @@ -168,6 +168,15 @@ def get_opts(my_dir: Path, argv: List[str]) -> argparse.Namespace: `--autodetect-revision` is passed. """, ) + parser.add_argument( + "--gerrit-tool-cwd", + type=Path, + help=""" + Working directory for `gerrit` tool invocations. This should point to + somewhere within a ChromeOS source tree. If none is passed, this will + try running them in the path specified by `--chromiumos-overlay`. + """, + ) parser.add_argument( "--chromiumos-overlay", type=Path, @@ -219,6 +228,9 @@ def get_opts(my_dir: Path, argv: List[str]) -> argparse.Namespace: ) opts.chromiumos_overlay = maybe_overlay + if not opts.gerrit_tool_cwd: + opts.gerrit_tool_cwd = opts.chromiumos_overlay + if opts.autodetect_revision: if not opts.android_toolchain: parser.error( @@ -249,6 +261,7 @@ def main(argv: List[str]) -> None: opts = get_opts(my_dir, argv) cros_overlay = opts.chromiumos_overlay + gerrit_tool_cwd = opts.gerrit_tool_cwd upload = opts.upload_with_autoreview commit = opts.commit or upload min_revision = opts.revision @@ -271,7 +284,7 @@ def main(argv: List[str]) -> None: return logging.info("Uploading changes...") - upload_changes(cros_overlay) + upload_changes(cros_overlay, gerrit_tool_cwd) logging.info("Change sent for review.") -- cgit v1.2.3 From e72432d7e9e2b3a731a9dcdc80555d3bd5efa9f9 Mon Sep 17 00:00:00 2001 From: Jordan R Abrahams-Whitehead Date: Wed, 10 Apr 2024 18:22:12 +0000 Subject: patch_sync: Clean up clippy lints Fixes all the latest clippy lints in patch_sync. This CL should provide no functional changes if implemented correctly. Most of these changes are moving values into AsRef generic parameters, rather than passing as a ref. BUG=b:333741962 TEST=cargo clippy; cargo test Change-Id: I232a21008ca2bbe7c85a6f4b01b3267c0aab47fc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5443986 Tested-by: Jordan Abrahams-Whitehead Reviewed-by: George Burgess Commit-Queue: Jordan Abrahams-Whitehead --- llvm_tools/patch_sync/src/patch_parsing.rs | 9 ++++++--- llvm_tools/patch_sync/src/version_control.rs | 30 ++++++++++++++-------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/llvm_tools/patch_sync/src/patch_parsing.rs b/llvm_tools/patch_sync/src/patch_parsing.rs index 7f545e5b..b9d0319b 100644 --- a/llvm_tools/patch_sync/src/patch_parsing.rs +++ b/llvm_tools/patch_sync/src/patch_parsing.rs @@ -73,9 +73,12 @@ impl PatchCollection { } /// Copy this collection with patches filtered by given criterion. - pub fn filter_patches(&self, f: impl FnMut(&PatchDictSchema) -> bool) -> Self { + pub fn filter_patches(&self, mut f: F) -> Self + where + F: FnMut(&PatchDictSchema) -> bool, + { Self { - patches: self.patches.iter().cloned().filter(f).collect(), + patches: self.patches.iter().filter(|&x| f(x)).cloned().collect(), workdir: self.workdir.clone(), indent_len: self.indent_len, } @@ -437,7 +440,7 @@ fn copy_create_parents(from: &Path, to: &Path) -> Result<()> { std::fs::create_dir_all(to_parent)?; } - copy(&from, &to) + copy(from, to) .with_context(|| format!("copying file from {} to {}", &from.display(), &to.display()))?; Ok(()) } diff --git a/llvm_tools/patch_sync/src/version_control.rs b/llvm_tools/patch_sync/src/version_control.rs index 5d70a4b5..55197f98 100644 --- a/llvm_tools/patch_sync/src/version_control.rs +++ b/llvm_tools/patch_sync/src/version_control.rs @@ -43,8 +43,8 @@ impl RepoSetupContext { let android_git = anpp.parent().unwrap(); git_cd_cmd(android_git, ["checkout", ANDROID_MAIN_BRANCH])?; } - repo_cd_cmd(&self.cros_checkout, &["sync", CHROMIUMOS_OVERLAY_REL_PATH])?; - repo_cd_cmd(&self.android_checkout, &["sync", ANDROID_LLVM_REL_PATH])?; + repo_cd_cmd(&self.cros_checkout, ["sync", CHROMIUMOS_OVERLAY_REL_PATH])?; + repo_cd_cmd(&self.android_checkout, ["sync", ANDROID_LLVM_REL_PATH])?; } Ok(()) } @@ -52,7 +52,7 @@ impl RepoSetupContext { pub fn cros_repo_upload>(&self, reviewers: &[S]) -> Result<()> { let llvm_dir = self .cros_checkout - .join(&CHROMIUMOS_OVERLAY_REL_PATH) + .join(CHROMIUMOS_OVERLAY_REL_PATH) .join("sys-devel/llvm"); ensure!( llvm_dir.is_dir(), @@ -142,14 +142,14 @@ impl RepoSetupContext { /// Get the Android path to the PATCHES.json file pub fn android_patches_path(&self) -> PathBuf { self.android_checkout - .join(&ANDROID_LLVM_REL_PATH) + .join(ANDROID_LLVM_REL_PATH) .join("patches/PATCHES.json") } /// Get the ChromiumOS path to the PATCHES.json file pub fn cros_patches_path(&self) -> PathBuf { self.cros_checkout - .join(&CHROMIUMOS_OVERLAY_REL_PATH) + .join(CHROMIUMOS_OVERLAY_REL_PATH) .join("sys-devel/llvm/files/PATCHES.json") } @@ -177,7 +177,7 @@ impl RepoSetupContext { commit_msg: &str, extra_flags: I, ) -> Result<()> { - let git_path = &checkout_path.join(&subproject_git_wd); + let git_path = &checkout_path.join(subproject_git_wd); ensure!( git_path.is_dir(), "git_path {} is not a directory", @@ -185,7 +185,7 @@ impl RepoSetupContext { ); repo_cd_cmd( checkout_path, - &["start", WORK_BRANCH_NAME, subproject_git_wd], + ["start", WORK_BRANCH_NAME, subproject_git_wd], )?; let base_args = ["upload", "--br", WORK_BRANCH_NAME, "-y", "--verify"]; let new_args = base_args @@ -193,8 +193,8 @@ impl RepoSetupContext { .copied() .chain(extra_flags) .chain(["--", subproject_git_wd]); - git_cd_cmd(git_path, &["add", "."]) - .and_then(|_| git_cd_cmd(git_path, &["commit", "-m", commit_msg])) + git_cd_cmd(git_path, ["add", "."]) + .and_then(|_| git_cd_cmd(git_path, ["commit", "-m", commit_msg])) .and_then(|_| repo_cd_cmd(checkout_path, new_args))?; Ok(()) } @@ -249,7 +249,7 @@ impl RepoSetupContext { file.to_str() .ok_or_else(|| anyhow!("failed to convert filepath to str"))? ); - let output = git_cd_cmd(pwd, &["show", &git_ref])?; + let output = git_cd_cmd(pwd, ["show", &git_ref])?; if !output.status.success() { bail!("could not get old file contents for {}", &git_ref) } @@ -318,7 +318,7 @@ where S: AsRef, { let mut command = Command::new("git"); - command.current_dir(&pwd).args(args); + command.current_dir(pwd).args(args); let output = command.output()?; if !output.status.success() { bail!( @@ -337,7 +337,7 @@ where S: AsRef, { let mut command = Command::new("repo"); - command.current_dir(&pwd).args(args); + command.current_dir(pwd).args(args); let status = command.status()?; if !status.success() { bail!("repo command failed:\n {:?} \n", command) @@ -363,7 +363,7 @@ mod test { // With revision let ebuild_name = "llvm-13.0_pre433403_p20211019-r10.ebuild"; let ebuild_path = llvm_dir.join(ebuild_name); - File::create(&ebuild_path).expect("creating test ebuild file"); + File::create(ebuild_path).expect("creating test ebuild file"); let new_ebuild_path = RepoSetupContext::rev_bump_llvm(&llvm_dir).expect("rev bumping the ebuild"); assert!( @@ -377,7 +377,7 @@ mod test { // Without revision let ebuild_name = "llvm-13.0_pre433403_p20211019.ebuild"; let ebuild_path = llvm_dir.join(ebuild_name); - File::create(&ebuild_path).expect("creating test ebuild file"); + File::create(ebuild_path).expect("creating test ebuild file"); let new_ebuild_path = RepoSetupContext::rev_bump_llvm(&llvm_dir).expect("rev bumping the ebuild"); assert!( @@ -394,7 +394,7 @@ mod test { File::create(&ebuild_path).expect("creating test ebuild file"); let ebuild_link_name = "llvm-13.0_pre433403_p20211019-r2.ebuild"; let ebuild_link_path = llvm_dir.join(ebuild_link_name); - File::create(&ebuild_link_path).expect("creating test ebuild link file"); + File::create(ebuild_link_path).expect("creating test ebuild link file"); let new_ebuild_path = RepoSetupContext::rev_bump_llvm(&llvm_dir).expect("rev bumping the ebuild"); assert!( -- cgit v1.2.3 From 6523933c1ac1f97652a6872ca0ed5b8c9ed74c3f Mon Sep 17 00:00:00 2001 From: Jordan R Abrahams-Whitehead Date: Wed, 10 Apr 2024 22:00:49 +0000 Subject: patch_sync: Fix android patch filtering. Previously, we were filtering patches *from android to chromiumos* using the android revision number, but what we _actually_ want to do is filter patches *from chromiumos to android* using the android revision number. This is confusing, but it's a very quick fix. Additionally, add slightly more logging so that we're easily able to catch such version range changes as before. BUG=b:333741962 TEST=Ran on chrotomation2 successfully Change-Id: Icb85c3c6fa42cc924295e6d49131b834a8899ea6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5444000 Commit-Queue: Jordan Abrahams-Whitehead Tested-by: Jordan Abrahams-Whitehead Reviewed-by: George Burgess --- llvm_tools/patch_sync/src/main.rs | 10 ++++++---- llvm_tools/patch_sync/src/patch_parsing.rs | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/llvm_tools/patch_sync/src/main.rs b/llvm_tools/patch_sync/src/main.rs index 5f9b9708..e3fa4820 100644 --- a/llvm_tools/patch_sync/src/main.rs +++ b/llvm_tools/patch_sync/src/main.rs @@ -180,14 +180,16 @@ fn transpose_subcmd(args: TransposeOpt) -> Result<()> { ) })? }; - let new_android_patches = new_android_patches.filter_patches(|p| { - match (p.get_from_version(), p.get_until_version()) { + if args.verbose { + println!("Android LLVM version: r{}", android_llvm_version); + } + let new_cros_patches = + new_cros_patches.filter_patches(|p| match (p.get_from_version(), p.get_until_version()) { (Some(start), Some(end)) => start <= android_llvm_version && android_llvm_version < end, (Some(start), None) => start <= android_llvm_version, (None, Some(end)) => android_llvm_version < end, (None, None) => true, - } - }); + }); // Need to filter version updates to only existing patches to the other platform. let cros_version_updates = diff --git a/llvm_tools/patch_sync/src/patch_parsing.rs b/llvm_tools/patch_sync/src/patch_parsing.rs index b9d0319b..193c7fb6 100644 --- a/llvm_tools/patch_sync/src/patch_parsing.rs +++ b/llvm_tools/patch_sync/src/patch_parsing.rs @@ -313,11 +313,25 @@ impl std::fmt::Display for PatchCollection { .and_then(serde_json::Value::as_str) .unwrap_or("[No Title]"); let path = self.workdir.join(&p.rel_patch_path); + let from = p.get_from_version(); + let until = p.get_until_version(); writeln!(f, "* {}", title)?; if i == self.patches.len() - 1 { - write!(f, " {}", path.display())?; + write!( + f, + " {}\n r{}-r{}", + path.display(), + from.map_or("None".to_string(), |x| x.to_string()), + until.map_or("None".to_string(), |x| x.to_string()) + )?; } else { - writeln!(f, " {}", path.display())?; + writeln!( + f, + " {}\n r{}-r{}", + path.display(), + from.map_or("None".to_string(), |x| x.to_string()), + until.map_or("None".to_string(), |x| x.to_string()) + )?; } } Ok(()) -- cgit v1.2.3 From 92a0ed1a7ab0db182820c2c20f57a64b9bd1fb7f Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Fri, 12 Apr 2024 02:32:20 +0000 Subject: rust-analyzer-chromiumos-wrapper: Generate Content-Length for tests in the helper Manually specifying the Content-Length makes it more tedious to modify the tests, so let the helper generate it instead. This simplifies the test payloads. BUG=b:333979840 TEST=cargo test Change-Id: I3e485dcaa74c6ca17f31cf8f6bad15911b592173 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5446197 Reviewed-by: George Burgess Reviewed-by: Allen Webb Auto-Submit: Tatsuyuki Ishi Tested-by: Tatsuyuki Ishi Commit-Queue: George Burgess Reviewed-by: Bastian Kersting --- rust-analyzer-chromiumos-wrapper/src/main.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rust-analyzer-chromiumos-wrapper/src/main.rs b/rust-analyzer-chromiumos-wrapper/src/main.rs index 43ca5a3d..f9f055e7 100644 --- a/rust-analyzer-chromiumos-wrapper/src/main.rs +++ b/rust-analyzer-chromiumos-wrapper/src/main.rs @@ -360,7 +360,8 @@ mod test { m.insert(pattern, replacement); m }; - stream_with_replacement(&mut read.as_bytes(), &mut w, &replacement_map)?; + let input = format!("Content-Length: {}\r\n\r\n{}", read.as_bytes().len(), read); + stream_with_replacement(&mut input.as_bytes(), &mut w, &replacement_map)?; // serde_json may not format the json output the same as we do, so we can't just compare // as strings or slices. @@ -387,7 +388,7 @@ mod test { fn test_stream_with_replacement_1() -> Result<()> { test_stream_with_replacement( // read - "Content-Length: 93\r\n\r\n{\"somekey\": {\"somepath\": \"XYZXYZabc\",\ + "{\"somekey\": {\"somepath\": \"XYZXYZabc\",\ \"anotherpath\": \"somestring\"}, \"anotherkey\": \"XYZXYZdef\"}", // pattern "XYZXYZ", @@ -403,7 +404,7 @@ mod test { fn test_stream_with_replacement_2() -> Result<()> { test_stream_with_replacement( // read - "Content-Length: 83\r\n\r\n{\"key0\": \"sometextABCDEF\",\ + "{\"key0\": \"sometextABCDEF\",\ \"key1\": {\"key2\": 5, \"key3\": \"moreABCDEFtext\"}, \"key4\": 1}", // pattern "ABCDEF", @@ -419,7 +420,7 @@ mod test { fn test_stream_with_replacement_3() -> Result<()> { test_stream_with_replacement( // read - "Content-Length: 55\r\n\r\n{\"path\": \"/my_folder/rust-analyzer-chromiumos-wrapper\"}", + "{\"path\": \"/my_folder/rust-analyzer-chromiumos-wrapper\"}", // pattern "", // replacement -- cgit v1.2.3 From 48b9e2d0f85f99e56e2df07ecc2d4f9b360f5216 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Fri, 12 Apr 2024 02:33:48 +0000 Subject: rust-analyzer-chromiumos-wrapper: Simplify test output Vec initialization The upper bound should be the byte length of json_expected, not str length of read. But it doesn't really matter since this is not performance critical test code, so just use the default constructor. BUG=b:333979840 TEST=cargo test Change-Id: I11e963d6f0fe65d08ba3b552ce24785ac51bfbd7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5446198 Reviewed-by: Bastian Kersting Reviewed-by: George Burgess Tested-by: Tatsuyuki Ishi Reviewed-by: Allen Webb Commit-Queue: George Burgess Auto-Submit: Tatsuyuki Ishi --- rust-analyzer-chromiumos-wrapper/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer-chromiumos-wrapper/src/main.rs b/rust-analyzer-chromiumos-wrapper/src/main.rs index f9f055e7..e293cdbf 100644 --- a/rust-analyzer-chromiumos-wrapper/src/main.rs +++ b/rust-analyzer-chromiumos-wrapper/src/main.rs @@ -354,7 +354,7 @@ mod test { replacement: &str, json_expected: &str, ) -> Result<()> { - let mut w = Vec::::with_capacity(read.len()); + let mut w = Vec::new(); let replacement_map = { let mut m = HashMap::new(); m.insert(pattern, replacement); -- cgit v1.2.3 From dc3dc47e53e3030966505bb0f49980cf8236643a Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Fri, 12 Apr 2024 02:45:39 +0000 Subject: rust-analyzer-chromiumos-wrapper: Simplify test payloads Use raw literals to avoid escape sequences. Remove comments about parameter names, since the information is easily available through IDEs (Inlay Hints) these days. BUG=b:333979840 TEST=cargo test Change-Id: I725f74142f760d8e41b8b766d9ef8272ec219cb9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5446199 Auto-Submit: Tatsuyuki Ishi Commit-Queue: George Burgess Reviewed-by: Allen Webb Reviewed-by: George Burgess Tested-by: Tatsuyuki Ishi --- rust-analyzer-chromiumos-wrapper/src/main.rs | 58 +++++++++++++++++----------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/rust-analyzer-chromiumos-wrapper/src/main.rs b/rust-analyzer-chromiumos-wrapper/src/main.rs index e293cdbf..09657b12 100644 --- a/rust-analyzer-chromiumos-wrapper/src/main.rs +++ b/rust-analyzer-chromiumos-wrapper/src/main.rs @@ -387,46 +387,60 @@ mod test { #[test] fn test_stream_with_replacement_1() -> Result<()> { test_stream_with_replacement( - // read - "{\"somekey\": {\"somepath\": \"XYZXYZabc\",\ - \"anotherpath\": \"somestring\"}, \"anotherkey\": \"XYZXYZdef\"}", - // pattern + r#"{ + "somekey": { + "somepath": "XYZXYZabc", + "anotherpath": "somestring" + }, + "anotherkey": "XYZXYZdef" + }"#, "XYZXYZ", - // replacement "REPLACE", - // json_expected - "{\"somekey\": {\"somepath\": \"REPLACEabc\", \"anotherpath\": \"somestring\"},\ - \"anotherkey\": \"REPLACEdef\"}", + r#"{ + "somekey": { + "somepath": "REPLACEabc", + "anotherpath": "somestring" + }, + "anotherkey": "REPLACEdef" + }"#, ) } #[test] fn test_stream_with_replacement_2() -> Result<()> { test_stream_with_replacement( - // read - "{\"key0\": \"sometextABCDEF\",\ - \"key1\": {\"key2\": 5, \"key3\": \"moreABCDEFtext\"}, \"key4\": 1}", - // pattern + r#"{ + "key0": "sometextABCDEF", + "key1": { + "key2": 5, + "key3": "moreABCDEFtext" + }, + "key4": 1 + }"#, "ABCDEF", - // replacement "replacement", - // json_expected - "{\"key0\": \"sometextreplacement\", \"key1\": {\"key2\": 5,\ - \"key3\": \"morereplacementtext\"}, \"key4\": 1}", + r#"{ + "key0": "sometextreplacement", + "key1": { + "key2": 5, + "key3": "morereplacementtext" + }, + "key4": 1 + }"#, ) } #[test] fn test_stream_with_replacement_3() -> Result<()> { test_stream_with_replacement( - // read - "{\"path\": \"/my_folder/rust-analyzer-chromiumos-wrapper\"}", - // pattern + r#"{ + "path": "/my_folder/rust-analyzer-chromiumos-wrapper" + }"#, "", - // replacement "", - // json_expected - "{\"path\": \"/usr/sbin/rust-analyzer\"}", + r#"{ + "path": "/usr/sbin/rust-analyzer" + }"#, ) } } -- cgit v1.2.3 From 9b49b4f22d1d3fac3f0a142b269e1b95d7716e11 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Wed, 10 Apr 2024 03:35:46 +0000 Subject: rust-analyzer-chromiumos-wrapper: Use arrays instead of hashmaps to store replacements For string replacements, hashmap don't really improve performance nor simplify code. Just use arrays which is a little simpler. Also update the tests to take a variable count of replacements, which will be useful for future tests. BUG=b:333979840 TEST=cargo test Change-Id: I59de9cdeeebe262dc20d2ef438d9206574c4a6b6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5446200 Reviewed-by: Allen Webb Tested-by: Tatsuyuki Ishi Reviewed-by: George Burgess Commit-Queue: George Burgess Auto-Submit: Tatsuyuki Ishi --- rust-analyzer-chromiumos-wrapper/src/main.rs | 44 +++++++++------------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/rust-analyzer-chromiumos-wrapper/src/main.rs b/rust-analyzer-chromiumos-wrapper/src/main.rs index 09657b12..d653530c 100644 --- a/rust-analyzer-chromiumos-wrapper/src/main.rs +++ b/rust-analyzer-chromiumos-wrapper/src/main.rs @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use std::collections::HashMap; use std::env; use std::fs::File; use std::io::{self, BufRead, BufReader, BufWriter, Write}; @@ -122,16 +121,14 @@ fn main() -> Result<()> { let mut child_stdin = BufWriter::new(child.0.stdin.take().unwrap()); let mut child_stdout = BufReader::new(child.0.stdout.take().unwrap()); - let replacement_map = { - let mut m = HashMap::new(); - m.insert(outside_prefix, inside_prefix); - m.insert(outside_sysroot_prefix, "/usr/lib/rustlib"); - m.insert(outside_home, "/home"); - m - }; + let replacement_map = [ + (outside_prefix, inside_prefix), + (outside_sysroot_prefix, "/usr/lib/rustlib"), + (outside_home, "/home"), + ]; let join_handle = { - let rm = replacement_map.clone(); + let rm = replacement_map; thread::spawn(move || { let mut stdin = io::stdin().lock(); stream_with_replacement(&mut stdin, &mut child_stdin, &rm) @@ -140,7 +137,7 @@ fn main() -> Result<()> { }; // For the mapping between inside to outside, we just reverse the map. - let replacement_map_rev = replacement_map.iter().map(|(k, v)| (*v, *k)).collect(); + let replacement_map_rev = replacement_map.map(|(k, v)| (v, k)); let mut stdout = BufWriter::new(io::stdout().lock()); stream_with_replacement(&mut child_stdout, &mut stdout, &replacement_map_rev) .context("Streaming from rust-analyzer into stdout")?; @@ -209,12 +206,8 @@ fn read_header(r: &mut R, header: &mut Header) -> Result<()> { /// Extend `dest` with `contents`, replacing any occurrence of patterns in a json string in /// `contents` with a replacement. -fn replace( - contents: &[u8], - replacement_map: &HashMap<&str, &str>, - dest: &mut Vec, -) -> Result<()> { - fn map_value(val: Value, replacement_map: &HashMap<&str, &str>) -> Value { +fn replace(contents: &[u8], replacement_map: &[(&str, &str)], dest: &mut Vec) -> Result<()> { + fn map_value(val: Value, replacement_map: &[(&str, &str)]) -> Value { match val { Value::String(s) => // `s.replace` is very likely doing more work than necessary. Probably we only need @@ -271,7 +264,7 @@ fn replace( fn stream_with_replacement( r: &mut R, w: &mut W, - replacement_map: &HashMap<&str, &str>, + replacement_map: &[(&str, &str)], ) -> Result<()> { let mut head = Header::default(); let mut buf = Vec::with_capacity(1024); @@ -350,16 +343,10 @@ mod test { fn test_stream_with_replacement( read: &str, - pattern: &str, - replacement: &str, + replacement_map: &[(&str, &str)], json_expected: &str, ) -> Result<()> { let mut w = Vec::new(); - let replacement_map = { - let mut m = HashMap::new(); - m.insert(pattern, replacement); - m - }; let input = format!("Content-Length: {}\r\n\r\n{}", read.as_bytes().len(), read); stream_with_replacement(&mut input.as_bytes(), &mut w, &replacement_map)?; @@ -394,8 +381,7 @@ mod test { }, "anotherkey": "XYZXYZdef" }"#, - "XYZXYZ", - "REPLACE", + &[("XYZXYZ", "REPLACE")], r#"{ "somekey": { "somepath": "REPLACEabc", @@ -417,8 +403,7 @@ mod test { }, "key4": 1 }"#, - "ABCDEF", - "replacement", + &[("ABCDEF", "replacement")], r#"{ "key0": "sometextreplacement", "key1": { @@ -436,8 +421,7 @@ mod test { r#"{ "path": "/my_folder/rust-analyzer-chromiumos-wrapper" }"#, - "", - "", + &[], r#"{ "path": "/usr/sbin/rust-analyzer" }"#, -- cgit v1.2.3 From 7da035ef581aadda122882a5c405e601fc27300d Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Wed, 10 Apr 2024 04:57:15 +0000 Subject: rust-analyzer-chromiumos-wrapper: Replace on first match only. Applying replacement once transforms a path from the old namespace to new namespace. Doing further replacements will end up with confusing results. BUG=b:333979840 TEST=cargo test Change-Id: Icc57262d47d64f7aa5ced72d32c1246a2e2ceab4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5446201 Tested-by: Tatsuyuki Ishi Reviewed-by: George Burgess Auto-Submit: Tatsuyuki Ishi Reviewed-by: Allen Webb Commit-Queue: George Burgess --- rust-analyzer-chromiumos-wrapper/src/main.rs | 32 ++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/rust-analyzer-chromiumos-wrapper/src/main.rs b/rust-analyzer-chromiumos-wrapper/src/main.rs index d653530c..701a452b 100644 --- a/rust-analyzer-chromiumos-wrapper/src/main.rs +++ b/rust-analyzer-chromiumos-wrapper/src/main.rs @@ -209,10 +209,14 @@ fn read_header(r: &mut R, header: &mut Header) -> Result<()> { fn replace(contents: &[u8], replacement_map: &[(&str, &str)], dest: &mut Vec) -> Result<()> { fn map_value(val: Value, replacement_map: &[(&str, &str)]) -> Value { match val { - Value::String(s) => - // `s.replace` is very likely doing more work than necessary. Probably we only need - // to look for the pattern at the beginning of the string. - { + Value::String(s) => { + // rust-analyzer uses LSP paths most of the time, which are encoded with the file: + // URL scheme. However, for certain config items, paths are used instead of URIs. + // Hence, we match not only the prefix but also anywhere in the middle. + // TODO: Rewrite to concisely handle URIs and normal paths separately to address the + // following limitations: + // - Components in the middle can get accidentally matched. + // - Percent encoded characters in URIs are not decoded and hence not matched. lazy_static! { static ref SERVER_PATH_REGEX: Regex = Regex::new(r".*/rust-analyzer-chromiumos-wrapper$").unwrap(); @@ -221,9 +225,12 @@ fn replace(contents: &[u8], replacement_map: &[(&str, &str)], dest: &mut Vec let mut s = SERVER_PATH_REGEX .replace_all(&s, CHROOT_SERVER_PATH) .to_string(); - // Then replace all mappings we get. + // Replace by the first matched pattern. for (pattern, replacement) in replacement_map { - s = s.replace(pattern, replacement); + if s.find(pattern).is_some() { + s = s.replace(pattern, replacement); + break; + } } Value::String(s.to_string()) } @@ -427,4 +434,17 @@ mod test { }"#, ) } + + #[test] + fn test_stream_with_replacement_replace_once() -> Result<()> { + test_stream_with_replacement( + r#"{ + "path": "/mnt/home/file" + }"#, + &[("/mnt/home", "/home"), ("/home", "/foo")], + r#"{ + "path": "/home/file" + }"#, + ) + } } -- cgit v1.2.3 From 51776b56e015507430321ef5365531aeba18316b Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Thu, 11 Apr 2024 10:00:08 +0000 Subject: rust-analyzer-chromiumos-wrapper: Update rust-analyzer in chroot to /usr/bin Based on the ebuild (and observation in actual chroot) the rust-analyzer binary should reside in /usr/bin. BUG=b:333979840 TEST=cargo test Change-Id: I6d3fc9115096084e16870840109d6a1ddf458ba5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5446202 Tested-by: Tatsuyuki Ishi Commit-Queue: George Burgess Auto-Submit: Tatsuyuki Ishi Reviewed-by: Allen Webb Reviewed-by: George Burgess --- rust-analyzer-chromiumos-wrapper/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer-chromiumos-wrapper/src/main.rs b/rust-analyzer-chromiumos-wrapper/src/main.rs index 701a452b..b43ad5c3 100644 --- a/rust-analyzer-chromiumos-wrapper/src/main.rs +++ b/rust-analyzer-chromiumos-wrapper/src/main.rs @@ -21,7 +21,7 @@ use simplelog::{Config, LevelFilter, WriteLogger}; use serde_json::{from_slice, to_writer, Value}; -const CHROOT_SERVER_PATH: &str = "/usr/sbin/rust-analyzer"; +const CHROOT_SERVER_PATH: &str = "/usr/bin/rust-analyzer"; fn main() -> Result<()> { let args = env::args().skip(1); @@ -430,7 +430,7 @@ mod test { }"#, &[], r#"{ - "path": "/usr/sbin/rust-analyzer" + "path": "/usr/bin/rust-analyzer" }"#, ) } -- cgit v1.2.3 From 977ad131c629f8c7b69b76537cfc60fa8546dddb Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Fri, 12 Apr 2024 03:06:42 +0000 Subject: rust-analyzer-chromiumos-wrapper: Perform exact prefix match for replacement Paths in rust-analyzer RPC messages can be either file: URIs or normal paths. Previously both were handled by allowing replacements in the middle of a string; but this was an ugly solution as it was explained in the comments. Hence, introduce a separate path to process file: URIs, and perform exact prefix match for both URIs and paths. The assumption that a path can be a URI or a normal path, and not something else (e.g. JSON object encoded in string that contains multiple paths), was validated through instrumenting the previous code such that it will error out on such unexpected entries. The instrumented version worked in VS Code rust-analyzer without hitting the exception path. BUG=b:333979840 TEST=cargo test TEST=check ctrl+click navigation in VS Code in CrOS repository Change-Id: I556def4e0a0ea9d7333a2bfb30f0bc481bc20cc9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5449292 Tested-by: Tatsuyuki Ishi Commit-Queue: Allen Webb Reviewed-by: George Burgess Reviewed-by: Allen Webb Auto-Submit: Tatsuyuki Ishi --- rust-analyzer-chromiumos-wrapper/Cargo.lock | 113 +++++++++++++---------- rust-analyzer-chromiumos-wrapper/Cargo.toml | 3 +- rust-analyzer-chromiumos-wrapper/src/main.rs | 131 ++++++++++++++++++--------- 3 files changed, 154 insertions(+), 93 deletions(-) diff --git a/rust-analyzer-chromiumos-wrapper/Cargo.lock b/rust-analyzer-chromiumos-wrapper/Cargo.lock index 248b313a..a3b40969 100644 --- a/rust-analyzer-chromiumos-wrapper/Cargo.lock +++ b/rust-analyzer-chromiumos-wrapper/Cargo.lock @@ -2,15 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "aho-corasick" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" -dependencies = [ - "memchr", -] - [[package]] name = "anyhow" version = "1.0.57" @@ -24,16 +15,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "itoa" -version = "1.0.2" +name = "form_urlencoded" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] [[package]] -name = "lazy_static" -version = "1.4.0" +name = "itoa" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" [[package]] name = "libc" @@ -50,12 +54,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "memchr" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" - [[package]] name = "num_threads" version = "0.1.6" @@ -66,44 +64,20 @@ dependencies = [ ] [[package]] -name = "regex" -version = "1.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.3" +name = "percent-encoding" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "rust-analyzer-chromiumos-wrapper" version = "0.1.0" dependencies = [ "anyhow", - "lazy_static", "log", - "regex", "serde_json", "simplelog", + "url", ] [[package]] @@ -167,6 +141,47 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/rust-analyzer-chromiumos-wrapper/Cargo.toml b/rust-analyzer-chromiumos-wrapper/Cargo.toml index a6deac24..9fcc0028 100644 --- a/rust-analyzer-chromiumos-wrapper/Cargo.toml +++ b/rust-analyzer-chromiumos-wrapper/Cargo.toml @@ -8,11 +8,10 @@ panic = "abort" [dependencies] anyhow = "1.0" -lazy_static = "1.4" log = { version = "0.4.17" } -regex = "1.0" serde_json = "1.0" simplelog = { version = "0.12.0" } +url = "2.5.0" [features] default = ["no_debug_log"] diff --git a/rust-analyzer-chromiumos-wrapper/src/main.rs b/rust-analyzer-chromiumos-wrapper/src/main.rs index b43ad5c3..b55623b5 100644 --- a/rust-analyzer-chromiumos-wrapper/src/main.rs +++ b/rust-analyzer-chromiumos-wrapper/src/main.rs @@ -3,6 +3,7 @@ // found in the LICENSE file. use std::env; +use std::ffi::OsStr; use std::fs::File; use std::io::{self, BufRead, BufReader, BufWriter, Write}; use std::os::unix::process::CommandExt; @@ -12,15 +13,14 @@ use std::str::from_utf8; use std::thread; use anyhow::{anyhow, bail, Context, Result}; -use lazy_static::lazy_static; -use log::trace; - -use regex::Regex; +use log::{trace, warn}; use simplelog::{Config, LevelFilter, WriteLogger}; use serde_json::{from_slice, to_writer, Value}; +use url::Url; +const SERVER_FILENAME: &str = "rust-analyzer-chromiumos-wrapper"; const CHROOT_SERVER_PATH: &str = "/usr/bin/rust-analyzer"; fn main() -> Result<()> { @@ -204,35 +204,82 @@ fn read_header(r: &mut R, header: &mut Header) -> Result<()> { } } +// The url crate's percent decoding helper returns a Path, while for non-url strings we don't +// want to decode all of them as a Path since most of them are non-path strings. +// We opt for not sharing the code paths as the handling of plain strings and Paths are slightly +// different (notably that Path normalizes away trailing slashes), but otherwise the two functions +// are functionally equal. +fn replace_uri(s: &str, replacement_map: &[(&str, &str)]) -> Result { + let uri = Url::parse(s).with_context(|| format!("while parsing path {s:?}"))?; + let is_dir = uri.as_str().ends_with('/'); + let path = uri + .to_file_path() + .map_err(|()| anyhow!("while converting {s:?} to file path"))?; + + // Always replace the server path everywhere. + if path.file_name() == Some(OsStr::new(SERVER_FILENAME)) { + return Ok(CHROOT_SERVER_PATH.into()); + } + + fn path_to_url(path: &Path, is_dir: bool) -> Result { + let url = if is_dir { + Url::from_directory_path(path) + } else { + Url::from_file_path(path) + }; + url.map_err(|()| anyhow!("while converting {path:?} to url")) + .map(|p| p.into()) + } + + // Replace by the first prefix match. + for (pattern, replacement) in replacement_map { + if let Ok(rest) = path.strip_prefix(pattern) { + let new_path = Path::new(replacement).join(rest); + return path_to_url(&new_path, is_dir); + } + } + + Ok(s.into()) +} + +fn replace_path(s: &str, replacement_map: &[(&str, &str)]) -> String { + // Always replace the server path everywhere. + if s.strip_suffix(SERVER_FILENAME) + .is_some_and(|s| s.ends_with('/')) + { + return CHROOT_SERVER_PATH.into(); + } + + // Replace by the first prefix match. + for (pattern, replacement) in replacement_map { + if let Some(rest) = s.strip_prefix(pattern) { + if rest.is_empty() || rest.starts_with('/') { + return [replacement, rest].concat(); + } + } + } + + s.into() +} + /// Extend `dest` with `contents`, replacing any occurrence of patterns in a json string in /// `contents` with a replacement. fn replace(contents: &[u8], replacement_map: &[(&str, &str)], dest: &mut Vec) -> Result<()> { fn map_value(val: Value, replacement_map: &[(&str, &str)]) -> Value { match val { - Value::String(s) => { - // rust-analyzer uses LSP paths most of the time, which are encoded with the file: - // URL scheme. However, for certain config items, paths are used instead of URIs. - // Hence, we match not only the prefix but also anywhere in the middle. - // TODO: Rewrite to concisely handle URIs and normal paths separately to address the - // following limitations: - // - Components in the middle can get accidentally matched. - // - Percent encoded characters in URIs are not decoded and hence not matched. - lazy_static! { - static ref SERVER_PATH_REGEX: Regex = - Regex::new(r".*/rust-analyzer-chromiumos-wrapper$").unwrap(); - } - // Always replace the server path everywhere. - let mut s = SERVER_PATH_REGEX - .replace_all(&s, CHROOT_SERVER_PATH) - .to_string(); - // Replace by the first matched pattern. - for (pattern, replacement) in replacement_map { - if s.find(pattern).is_some() { - s = s.replace(pattern, replacement); - break; - } + Value::String(mut s) => { + if s.starts_with("file:") { + // rust-analyzer uses LSP paths most of the time, which are encoded with the + // file: URL scheme. + s = replace_uri(&s, replacement_map).unwrap_or_else(|e| { + warn!("replace_uri failed: {e:?}"); + s + }); + } else { + // For certain config items, paths may be used instead of URIs. + s = replace_path(&s, replacement_map); } - Value::String(s.to_string()) + Value::String(s) } Value::Array(mut v) => { for val_ref in v.iter_mut() { @@ -379,43 +426,43 @@ mod test { } #[test] - fn test_stream_with_replacement_1() -> Result<()> { + fn test_stream_with_replacement_simple() -> Result<()> { test_stream_with_replacement( r#"{ "somekey": { - "somepath": "XYZXYZabc", - "anotherpath": "somestring" + "somepath": "/XYZXYZ/", + "anotherpath": "/some/string" }, - "anotherkey": "XYZXYZdef" + "anotherkey": "/XYZXYZ/def" }"#, - &[("XYZXYZ", "REPLACE")], + &[("/XYZXYZ", "/REPLACE")], r#"{ "somekey": { - "somepath": "REPLACEabc", - "anotherpath": "somestring" + "somepath": "/REPLACE/", + "anotherpath": "/some/string" }, - "anotherkey": "REPLACEdef" + "anotherkey": "/REPLACE/def" }"#, ) } #[test] - fn test_stream_with_replacement_2() -> Result<()> { + fn test_stream_with_replacement_file_uri() -> Result<()> { test_stream_with_replacement( r#"{ - "key0": "sometextABCDEF", + "key0": "file:///ABCDEF/", "key1": { "key2": 5, - "key3": "moreABCDEFtext" + "key3": "file:///ABCDEF/text" }, "key4": 1 }"#, - &[("ABCDEF", "replacement")], + &[("/ABCDEF", "/replacement")], r#"{ - "key0": "sometextreplacement", + "key0": "file:///replacement/", "key1": { "key2": 5, - "key3": "morereplacementtext" + "key3": "file:///replacement/text" }, "key4": 1 }"#, @@ -423,7 +470,7 @@ mod test { } #[test] - fn test_stream_with_replacement_3() -> Result<()> { + fn test_stream_with_replacement_self_binary() -> Result<()> { test_stream_with_replacement( r#"{ "path": "/my_folder/rust-analyzer-chromiumos-wrapper" -- cgit v1.2.3 From 5910e9f15c2e2f8699e54fc04277ff09d03d016a Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Fri, 12 Apr 2024 13:07:54 -0600 Subject: llvm_tools: add internal CL support to cros_cls Some llvm-next CLs (e.g., manifest updates) need to be internal. Supporting those here is straightforward. BUG=b:333462347 TEST=repo upload Change-Id: I6ca14cfce2e086743476fe0eb059b9172736707e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5450238 Reviewed-by: Jordan Abrahams-Whitehead Tested-by: George Burgess Commit-Queue: George Burgess --- llvm_tools/cros_cls.py | 19 +++++++++++++------ llvm_tools/cros_cls_test.py | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/llvm_tools/cros_cls.py b/llvm_tools/cros_cls.py index d0524b6d..d5b5ffa0 100644 --- a/llvm_tools/cros_cls.py +++ b/llvm_tools/cros_cls.py @@ -65,6 +65,7 @@ class ChangeListURL: cl_id: int patch_set: Optional[int] = None + internal: bool = False @classmethod def parse(cls, url: str) -> "ChangeListURL": @@ -73,8 +74,9 @@ class ChangeListURL: r"(?:https?://)?" # Match either chromium-review or crrev, leaving the CL number and # patch set as the next parts. These can be parsed in unison. - r"(?:chromium-review\.googlesource\.com.*/\+/" - r"|crrev\.com/c/)" + r"(chromium-review\.googlesource\.com.*/\+/" + r"|crrev\.com/[ci]/" + r"|chrome-internal-review\.googlesource\.com.*/\+/)" # Match the CL number... r"(\d+)" # and (optionally) the patch-set, as well as consuming any of the @@ -91,12 +93,16 @@ class ChangeListURL: "crrev.com/c/${cl_number}/${patch_set_number}, and " "chromium-review.googlesource.com/c/project/path/+/" "${cl_number}/${patch_set_number}. The patch-set number is " - "optional, and there may be a preceding http:// or https://." + "optional, and there may be a preceding http:// or https://. " + "Internal CL links are also supported." ) - cl_id, maybe_patch_set = m.groups() + host, cl_id, maybe_patch_set = m.groups() + internal = host.startswith("chrome-internal-review") or host.startswith( + "crrev.com/i/" + ) if maybe_patch_set is not None: maybe_patch_set = int(maybe_patch_set) - return cls(int(cl_id), maybe_patch_set) + return cls(int(cl_id), maybe_patch_set, internal) @classmethod def parse_with_patch_set(cls, url: str) -> "ChangeListURL": @@ -107,7 +113,8 @@ class ChangeListURL: return result def __str__(self): - result = f"https://crrev.com/c/{self.cl_id}" + namespace = "i" if self.internal else "c" + result = f"https://crrev.com/{namespace}/{self.cl_id}" if self.patch_set is not None: result += f"/{self.patch_set}" return result diff --git a/llvm_tools/cros_cls_test.py b/llvm_tools/cros_cls_test.py index fd4ed3ef..45efaf31 100755 --- a/llvm_tools/cros_cls_test.py +++ b/llvm_tools/cros_cls_test.py @@ -22,6 +22,21 @@ class TestChangeListURL(unittest.TestCase): cros_cls.ChangeListURL(cl_id=123456, patch_set=None), ) + def test_parsing_long_form_internal_url(self): + self.assertEqual( + cros_cls.ChangeListURL.parse( + "chrome-internal-review.googlesource.com/c/chromeos/" + "manifest-internal/+/654321" + ), + cros_cls.ChangeListURL(cl_id=654321, patch_set=None, internal=True), + ) + + def test_parsing_short_internal_url(self): + self.assertEqual( + cros_cls.ChangeListURL.parse("crrev.com/i/654321"), + cros_cls.ChangeListURL(cl_id=654321, patch_set=None, internal=True), + ) + def test_parsing_discards_http(self): self.assertEqual( cros_cls.ChangeListURL.parse("http://crrev.com/c/123456"), @@ -106,6 +121,17 @@ class TestChangeListURL(unittest.TestCase): "https://crrev.com/c/1234", ) + self.assertEqual( + str( + cros_cls.ChangeListURL( + cl_id=1234, + patch_set=2, + internal=True, + ) + ), + "https://crrev.com/i/1234/2", + ) + class Test(unittest.TestCase): """General tests for cros_cls.""" -- cgit v1.2.3 From f8e584c226ae80b91180c1779afd1fdf537efce7 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Fri, 12 Apr 2024 13:15:38 -0600 Subject: llvm_tools: add a file to contain llvm testing information This will be the new home for the LLVM_NEXT SHA (and associated revision). BUG=b:333462347 TEST=Unittests Change-Id: Ic03420e5c201a826c3cebdb79f900cceb91e6dc3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5450239 Reviewed-by: Jordan Abrahams-Whitehead Tested-by: George Burgess Commit-Queue: George Burgess --- llvm_tools/llvm_next.py | 30 ++++++++++++++++++++++++++++++ llvm_tools/llvm_next_test.py | 24 ++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 llvm_tools/llvm_next.py create mode 100755 llvm_tools/llvm_next_test.py diff --git a/llvm_tools/llvm_next.py b/llvm_tools/llvm_next.py new file mode 100644 index 00000000..1c075e50 --- /dev/null +++ b/llvm_tools/llvm_next.py @@ -0,0 +1,30 @@ +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Contains useful constants for testing LLVM.""" + +from typing import Iterable + +import cros_cls + + +LLVM_NEXT_HASH = "28a8f1b901389c1e478407440f7ccf2d41c71b64" +LLVM_NEXT_REV = 516547 + +# NOTE: Always specify patch-sets for CLs. We don't want uploads by untrusted +# users to turn into bot invocations w/ untrusted input. + +# A list of CLs that constitute the current llvm-next roll. +# This is taken as the set of CLs that will be landed simultaneously in order +# to make llvm-next go live. +# +# Generally speaking, for simple rolls, this should just contain a link to the +# Manifest update CL. +LLVM_NEXT_TESTING_CLS: Iterable[cros_cls.ChangeListURL] = () + +# The CL used to disable -Werror, and report the results. +DISABLE_WERROR_CL = cros_cls.ChangeListURL( + cl_id=2599698, + patch_set=5, +) diff --git a/llvm_tools/llvm_next_test.py b/llvm_tools/llvm_next_test.py new file mode 100755 index 00000000..a4e6a395 --- /dev/null +++ b/llvm_tools/llvm_next_test.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Tests for llvm_next.""" + +import unittest + +import llvm_next + + +class Test(unittest.TestCase): + """Tests for llvm_next.""" + + def test_all_cls_have_patchesets(self): + cls = [llvm_next.DISABLE_WERROR_CL] + cls += llvm_next.LLVM_NEXT_TESTING_CLS + for cl in cls: + self.assertIsNotNone(cl.patch_set, f"CL {cl} needs a patch-set") + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3 From 53ba4150fc1a28086ae239938e2201d022fabe78 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 15 Apr 2024 10:12:57 -0600 Subject: llvm_tools: add bb_add.py This allows for folks (...mostly automation and the mage) to conveniently run `bb add` with 'well-known' toolchain CLs/CL stacks, like the current llvm-next CL stack, or the disable-werror CL, or similar. BUG=b:333462347 TEST=Unittests Change-Id: I43aa2f3a863a4121a6920a4e7a4adcd412057644 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5454854 Reviewed-by: Ryan Beltran Commit-Queue: George Burgess Tested-by: George Burgess --- llvm_tools/bb_add.py | 91 +++++++++++++++++++++++++++++++++++++++++ llvm_tools/bb_add_test.py | 100 ++++++++++++++++++++++++++++++++++++++++++++++ llvm_tools/cros_cls.py | 7 +++- 3 files changed, 196 insertions(+), 2 deletions(-) create mode 100755 llvm_tools/bb_add.py create mode 100755 llvm_tools/bb_add_test.py diff --git a/llvm_tools/bb_add.py b/llvm_tools/bb_add.py new file mode 100755 index 00000000..1ff83490 --- /dev/null +++ b/llvm_tools/bb_add.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Runs `bb add`, with additional convenience features.""" + +import argparse +import logging +import os +import shlex +import sys +from typing import Iterable, List + +import cros_cls +import llvm_next + + +def generate_bb_add_command( + use_llvm_next: bool, + disable_werror: bool, + extra_cls: Iterable[cros_cls.ChangeListURL], + bots: Iterable[str], +) -> List[str]: + cls: List[cros_cls.ChangeListURL] = [] + if use_llvm_next: + if not llvm_next.LLVM_NEXT_TESTING_CLS: + raise ValueError( + "llvm-next testing requested, but no llvm-next CLs exist." + ) + cls += llvm_next.LLVM_NEXT_TESTING_CLS + + if disable_werror: + cls.append(llvm_next.DISABLE_WERROR_CL) + + if extra_cls: + cls += extra_cls + + cmd = ["bb", "add"] + for cl in cls: + cmd += ("-cl", cl.crrev_url_without_http()) + cmd += bots + return cmd + + +def main(argv: List[str]) -> None: + logging.basicConfig( + format=">> %(asctime)s: %(levelname)s: %(filename)s:%(lineno)d: " + "%(message)s", + level=logging.INFO, + ) + + parser = argparse.ArgumentParser( + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, + ) + parser.add_argument( + "--llvm-next", + action="store_true", + help="Add the current llvm-next patch set.", + ) + parser.add_argument( + "--disable-werror", + action="store_true", + help="Add the 'disable -Werror' patch sets", + ) + parser.add_argument( + "--cl", + action="append", + type=cros_cls.ChangeListURL.parse, + help=""" + CL to add to the `bb add` run. May be specified multiple times. In the + form crrev.com/c/123456. + """, + ) + parser.add_argument("bot", nargs="+", help="Bot(s) to run `bb add` with.") + opts = parser.parse_args(argv) + + cmd = generate_bb_add_command( + use_llvm_next=opts.llvm_next, + disable_werror=opts.disable_werror, + extra_cls=opts.cl, + bots=opts.bot, + ) + logging.info("Running `bb add` command: %s...", shlex.join(cmd)) + # execvp raises if it fails, so no need to check. + os.execvp(cmd[0], cmd) + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/llvm_tools/bb_add_test.py b/llvm_tools/bb_add_test.py new file mode 100755 index 00000000..6f7fe6a7 --- /dev/null +++ b/llvm_tools/bb_add_test.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Tests for bb_add.py.""" + +from typing import Iterable +import unittest + +import bb_add +import cros_cls +import llvm_next + + +_ARBITRARY_BOTS = ["chromeos/cq/amd64-generic-cq"] + + +class Test(unittest.TestCase): + """Tests for bb_add.py.""" + + def set_llvm_next_cls(self, cls: Iterable[cros_cls.ChangeListURL]): + old_cls = llvm_next.LLVM_NEXT_TESTING_CLS + llvm_next.LLVM_NEXT_TESTING_CLS = cls + + def restore_cls(): + llvm_next.LLVM_NEXT_TESTING_CLS = old_cls + + self.addCleanup(restore_cls) + + def test_generate_bb_add_raises_if_no_llvm_next_cls(self): + self.set_llvm_next_cls(()) + with self.assertRaisesRegex( + ValueError, "^llvm-next testing requested.*" + ): + bb_add.generate_bb_add_command( + use_llvm_next=True, + disable_werror=False, + extra_cls=(), + bots=_ARBITRARY_BOTS, + ) + + def test_generate_bb_add_adds_llvm_next_cls(self): + self.set_llvm_next_cls((cros_cls.ChangeListURL(123, 1),)) + cmd = bb_add.generate_bb_add_command( + use_llvm_next=True, + disable_werror=False, + extra_cls=(), + bots=_ARBITRARY_BOTS, + ) + self.assertEqual( + cmd, ["bb", "add", "-cl", "crrev.com/c/123/1"] + _ARBITRARY_BOTS + ) + + def test_generate_bb_add_adds_disable_werror_cl(self): + self.set_llvm_next_cls((cros_cls.ChangeListURL(123, 1),)) + cmd = bb_add.generate_bb_add_command( + use_llvm_next=False, + disable_werror=True, + extra_cls=(), + bots=_ARBITRARY_BOTS, + ) + self.assertEqual( + cmd, + [ + "bb", + "add", + "-cl", + llvm_next.DISABLE_WERROR_CL.crrev_url_without_http(), + ] + + _ARBITRARY_BOTS, + ) + + def test_generate_bb_add_adds_extra_cls(self): + self.set_llvm_next_cls((cros_cls.ChangeListURL(123, 1),)) + cmd = bb_add.generate_bb_add_command( + use_llvm_next=False, + disable_werror=False, + extra_cls=( + cros_cls.ChangeListURL(123, 1), + cros_cls.ChangeListURL(126), + ), + bots=_ARBITRARY_BOTS, + ) + self.assertEqual( + cmd, + [ + "bb", + "add", + "-cl", + "crrev.com/c/123/1", + "-cl", + "crrev.com/c/126", + ] + + _ARBITRARY_BOTS, + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/llvm_tools/cros_cls.py b/llvm_tools/cros_cls.py index d5b5ffa0..b74132e2 100644 --- a/llvm_tools/cros_cls.py +++ b/llvm_tools/cros_cls.py @@ -112,13 +112,16 @@ class ChangeListURL: raise ValueError("A patchset number must be specified.") return result - def __str__(self): + def crrev_url_without_http(self): namespace = "i" if self.internal else "c" - result = f"https://crrev.com/{namespace}/{self.cl_id}" + result = f"crrev.com/{namespace}/{self.cl_id}" if self.patch_set is not None: result += f"/{self.patch_set}" return result + def __str__(self): + return f"https://{self.crrev_url_without_http()}" + def builder_url(build_id: BuildID) -> str: """Returns a builder URL given a build ID.""" -- cgit v1.2.3 From 18a3ccb67c9aaaec5878d1be0b1e75cb29a8974c Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 15 Apr 2024 10:53:27 -0600 Subject: llvm_tools: let `get_llvm_hash` grab llvm-next/llvm hashes This gives folks a convenient tool to get this info, since it (soon) won't be in ebuilds. BUG=b:333462347 TEST=Unittests Change-Id: I4b9a8e4ed75a459e7bcdfefe5d2e0a713746ce15 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5454855 Reviewed-by: Ryan Beltran Commit-Queue: George Burgess Tested-by: George Burgess --- llvm_tools/get_llvm_hash.py | 68 +++++++++++++++++++++++++++++++-- llvm_tools/get_llvm_hash_unittest.py | 7 ++++ llvm_tools/manifest_utils.py | 71 +++++++++++++++++++++++++++-------- llvm_tools/manifest_utils_unittest.py | 10 +++++ 4 files changed, 137 insertions(+), 19 deletions(-) diff --git a/llvm_tools/get_llvm_hash.py b/llvm_tools/get_llvm_hash.py index 0922f685..05e14b58 100755 --- a/llvm_tools/get_llvm_hash.py +++ b/llvm_tools/get_llvm_hash.py @@ -18,6 +18,8 @@ import tempfile from typing import Iterator, Optional, Tuple, Union import git_llvm_rev +import llvm_next +import manifest_utils import subprocess_helpers @@ -25,7 +27,13 @@ _LLVM_GIT_URL = ( "https://chromium.googlesource.com/external/github.com/llvm/llvm-project" ) -KNOWN_HASH_SOURCES = {"google3", "google3-unstable", "tot"} +KNOWN_HASH_SOURCES = ( + "google3", + "google3-unstable", + "llvm", + "llvm-next", + "tot", +) def GetVersionFrom(src_dir: Union[Path, str], git_hash: str) -> int: @@ -355,6 +363,32 @@ def GetLLVMHashAndVersionFromSVNOption( return git_hash, version +def _FindChromeOSTreeRoot(chromeos_tree_path: Path) -> Path: + """Returns the root of a ChromeOS tree, given a path in said tree.""" + if (chromeos_tree_path / ".repo").exists(): + return chromeos_tree_path + + for parent in chromeos_tree_path.parents: + if (parent / ".repo").exists(): + return parent + raise ValueError(f"{chromeos_tree_path} is not in a repo checkout") + + +def GetCrOSCurrentLLVMHash(chromeos_tree: Path) -> str: + """Retrieves the current ChromeOS LLVM hash. + + Args: + chromeos_tree: A ChromeOS source tree. This is allowed to be + arbitrary subdirectory of an actual ChromeOS tree, for convenience. + + Raises: + ManifestValueError if the toolchain manifest doesn't match the + expected structure. + """ + chromeos_root = _FindChromeOSTreeRoot(chromeos_tree) + return manifest_utils.extract_current_llvm_hash(chromeos_root) + + class LLVMHash: """Provides methods to retrieve a LLVM hash.""" @@ -397,15 +431,21 @@ class LLVMHash: Returns: The hash as a string that corresponds to the LLVM version. """ - hash_value = GetGitHashFrom( GetAndUpdateLLVMProjectInLLVMTools(), version ) return hash_value + def GetCrOSCurrentLLVMHash(self, chromeos_tree: Path) -> str: + """Retrieves the current ChromeOS LLVM hash.""" + return GetCrOSCurrentLLVMHash(chromeos_tree) + + def GetCrOSLLVMNextHash(self) -> str: + """Retrieves the current ChromeOS llvm-next hash.""" + return llvm_next.LLVM_NEXT_HASH + def GetGoogle3LLVMHash(self) -> str: """Retrieves the google3 LLVM hash.""" - return self.GetLLVMHash(GetGoogle3LLVMVersion(stable=True)) def GetGoogle3UnstableLLVMHash(self) -> str: @@ -428,6 +468,7 @@ def main() -> None: Parses the command line for the optional command line arguments. """ + my_dir = Path(__file__).parent.resolve() # Create parser and add optional command-line arguments. parser = argparse.ArgumentParser(description="Finds the LLVM hash.") @@ -438,17 +479,36 @@ def main() -> None: help="which git hash of LLVM to find. Either a svn revision, or one " "of %s" % sorted(KNOWN_HASH_SOURCES), ) + parser.add_argument( + "--chromeos_tree", + type=Path, + required=True, + help=""" + Path to a ChromeOS tree. If not passed, one will be inferred. If none + can be inferred, this script will fail. + """, + ) # Parse command-line arguments. args_output = parser.parse_args() cur_llvm_version = args_output.llvm_version + chromeos_tree = args_output.chromeos_tree + if not chromeos_tree: + # Try to infer this unconditionally, so mishandling of this script can + # be more easily detected (which allows more flexibility in the + # implementation in the future for things outside of what directly + # needs this value). + chromeos_tree = _FindChromeOSTreeRoot(my_dir) new_llvm_hash = LLVMHash() - if isinstance(cur_llvm_version, int): # Find the git hash of the specific LLVM version. print(new_llvm_hash.GetLLVMHash(cur_llvm_version)) + elif cur_llvm_version == "llvm": + print(new_llvm_hash.GetCrOSCurrentLLVMHash(chromeos_tree)) + elif cur_llvm_version == "llvm-next": + print(new_llvm_hash.GetCrOSLLVMNextHash()) elif cur_llvm_version == "google3": print(new_llvm_hash.GetGoogle3LLVMHash()) elif cur_llvm_version == "google3-unstable": diff --git a/llvm_tools/get_llvm_hash_unittest.py b/llvm_tools/get_llvm_hash_unittest.py index 3fb85861..fda002ce 100755 --- a/llvm_tools/get_llvm_hash_unittest.py +++ b/llvm_tools/get_llvm_hash_unittest.py @@ -15,6 +15,7 @@ import unittest from unittest import mock import get_llvm_hash +import llvm_next import subprocess_helpers @@ -203,6 +204,12 @@ class TestGetLLVMHash(unittest.TestCase): self.assertEqual(get_llvm_hash.GetLLVMMajorVersion(), "5432") + def testGetLLVMNextHash(self): + self.assertEqual( + get_llvm_hash.LLVMHash().GetCrOSLLVMNextHash(), + llvm_next.LLVM_NEXT_HASH, + ) + if __name__ == "__main__": unittest.main() diff --git a/llvm_tools/manifest_utils.py b/llvm_tools/manifest_utils.py index 3d6337bf..e53afa6d 100644 --- a/llvm_tools/manifest_utils.py +++ b/llvm_tools/manifest_utils.py @@ -11,7 +11,7 @@ on toolchain projects (llvm-project, etc.) which are public. from pathlib import Path import shutil import subprocess -from typing import List, Union +from typing import List, Optional, Union from xml.etree import ElementTree import atomic_write_file @@ -28,13 +28,64 @@ class UpdateManifestError(Exception): """Error occurred when updating the manifest.""" -def make_xmlparser(): +class ManifestParseError(Exception): + """Error occurred when parsing the contents of the manifest.""" + + +def make_xmlparser() -> ElementTree.XMLParser: """Return a new xmlparser with custom TreeBuilder.""" return ElementTree.XMLParser( target=ElementTree.TreeBuilder(insert_comments=True) ) +def _find_llvm_project_in_manifest_tree( + xmlroot: ElementTree.Element, +) -> Optional[ElementTree.Element]: + """Returns the llvm-project `project` in `xmlroot`, if it exists.""" + for child in xmlroot: + if ( + child.tag == "project" + and child.attrib.get("path") == LLVM_PROJECT_PATH + ): + return child + return None + + +def extract_current_llvm_hash(src_tree: Path) -> str: + """Returns the current LLVM SHA for the CrOS tree rooted at `src_tree`. + + Raises: + ManifestParseError if the manifest didn't have the expected contents. + """ + xmlroot = ElementTree.parse( + get_chromeos_manifest_path(src_tree), parser=make_xmlparser() + ).getroot() + return extract_current_llvm_hash_from_xml(xmlroot) + + +def extract_current_llvm_hash_from_xml(xmlroot: ElementTree.Element) -> str: + """Returns the current LLVM SHA for the parsed XML file. + + Raises: + ManifestParseError if the manifest didn't have the expected contents. + """ + if xmlroot.tag != "manifest": + raise ManifestParseError( + f"Root tag is {xmlroot.tag}; should be `manifest`." + ) + + llvm_project = _find_llvm_project_in_manifest_tree(xmlroot) + if llvm_project is None: + raise ManifestParseError("No llvm-project `project` found in manifest.") + + revision = llvm_project.attrib.get("revision") + if not revision: + raise ManifestParseError("Toolchain's `project` has no revision.") + + return revision + + def update_chromeos_manifest(revision: str, src_tree: Path) -> Path: """Replaces the manifest project revision with 'revision'. @@ -73,21 +124,11 @@ def get_chromeos_manifest_path(src_tree: Path) -> Path: def update_chromeos_manifest_tree(revision: str, xmlroot: ElementTree.Element): """Update the revision info for LLVM for a manifest XML root.""" - - # This exists mostly for testing. - def is_llvm_project(child): - return ( - child.tag == "project" and child.attrib["path"] == LLVM_PROJECT_PATH - ) - - finder = (child for child in xmlroot if is_llvm_project(child)) - llvm_project_elem = next(finder, None) + llvm_project_elem = _find_llvm_project_in_manifest_tree(xmlroot) # Element objects can be falsy, so we need to explicitly check None. - if llvm_project_elem is not None: - # Update the llvm revision git sha - llvm_project_elem.attrib["revision"] = revision - else: + if llvm_project_elem is None: raise UpdateManifestError("xmltree did not have llvm-project") + llvm_project_elem.attrib["revision"] = revision def format_manifest(repo_manifest: Path): diff --git a/llvm_tools/manifest_utils_unittest.py b/llvm_tools/manifest_utils_unittest.py index 8e283e34..28179413 100755 --- a/llvm_tools/manifest_utils_unittest.py +++ b/llvm_tools/manifest_utils_unittest.py @@ -77,6 +77,16 @@ class TestManifestUtils(unittest.TestCase): string_root2 = ElementTree.tostring(root) self.assertEqual(string_root1, string_root2) + def test_extract_current_llvm_hash(self): + root = ElementTree.fromstring( + MANIFEST_FIXTURE, + parser=manifest_utils.make_xmlparser(), + ) + self.assertEqual( + manifest_utils.extract_current_llvm_hash_from_xml(root), + "abcd", + ) + if __name__ == "__main__": unittest.main() -- cgit v1.2.3 From 5a25614b9561d7d6029a97118a852697450e2218 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 15 Apr 2024 10:56:37 -0600 Subject: llvm_tools: migrate nightly_revert_checker to get_llvm_hash Yay for replacing old custom logic BUG=b:333462347 TEST=Unittests Change-Id: I5459942eaaa08f0b0d694dff707bf34ee8ffe8b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5454856 Commit-Queue: George Burgess Tested-by: George Burgess Reviewed-by: Bob Haarman --- llvm_tools/nightly_revert_checker.py | 59 ++++++------------------------- llvm_tools/nightly_revert_checker_test.py | 38 -------------------- 2 files changed, 10 insertions(+), 87 deletions(-) diff --git a/llvm_tools/nightly_revert_checker.py b/llvm_tools/nightly_revert_checker.py index 88aac9b7..6090e614 100755 --- a/llvm_tools/nightly_revert_checker.py +++ b/llvm_tools/nightly_revert_checker.py @@ -11,10 +11,10 @@ fires off an email. All LLVM SHAs to monitor are autodetected. import argparse import dataclasses -import io import json import logging import os +from pathlib import Path import pprint import subprocess import sys @@ -131,57 +131,18 @@ def _find_interesting_android_shas( return result -def _parse_llvm_ebuild_for_shas( - ebuild_file: io.TextIOWrapper, -) -> List[Tuple[str, str]]: - def parse_ebuild_assignment(line: str) -> str: - no_comments = line.split("#")[0] - no_assign = no_comments.split("=", 1)[1].strip() - assert no_assign.startswith('"') and no_assign.endswith('"'), no_assign - return no_assign[1:-1] - - llvm_hash, llvm_next_hash = None, None - for line in ebuild_file: - if line.startswith("LLVM_HASH="): - llvm_hash = parse_ebuild_assignment(line) - if llvm_next_hash: - break - if line.startswith("LLVM_NEXT_HASH"): - llvm_next_hash = parse_ebuild_assignment(line) - if llvm_hash: - break - if not llvm_next_hash or not llvm_hash: - raise ValueError( - "Failed to detect SHAs for llvm/llvm_next. Got: " - "llvm=%s; llvm_next=%s" % (llvm_hash, llvm_next_hash) - ) - - results: List[Tuple[str, str]] = [("llvm", llvm_hash)] - if llvm_next_hash != llvm_hash: - results.append(("llvm-next", llvm_next_hash)) - return results - - def _find_interesting_chromeos_shas( chromeos_base: str, ) -> List[Tuple[str, str]]: - llvm_dir = os.path.join( - chromeos_base, "src/third_party/chromiumos-overlay/sys-devel/llvm" - ) - candidate_ebuilds = [ - os.path.join(llvm_dir, x) - for x in os.listdir(llvm_dir) - if "_pre" in x and not os.path.islink(os.path.join(llvm_dir, x)) - ] - - if len(candidate_ebuilds) != 1: - raise ValueError( - "Expected exactly one llvm ebuild candidate; got %s" - % pprint.pformat(candidate_ebuilds) - ) - - with open(candidate_ebuilds[0], encoding="utf-8") as f: - return _parse_llvm_ebuild_for_shas(f) + chromeos_path = Path(chromeos_base) + llvm_hash = get_llvm_hash.LLVMHash() + + current_llvm = llvm_hash.GetCrOSCurrentLLVMHash(chromeos_path) + results = [("llvm", current_llvm)] + next_llvm = llvm_hash.GetCrOSLLVMNextHash() + if current_llvm != next_llvm: + results.append(("llvm-next", next_llvm)) + return results _Email = NamedTuple( diff --git a/llvm_tools/nightly_revert_checker_test.py b/llvm_tools/nightly_revert_checker_test.py index 722ad125..dbcd01dd 100755 --- a/llvm_tools/nightly_revert_checker_test.py +++ b/llvm_tools/nightly_revert_checker_test.py @@ -5,7 +5,6 @@ """Tests for nightly_revert_checker.""" -import io import unittest from unittest import mock @@ -138,43 +137,6 @@ class Test(unittest.TestCase): self.assertEqual(email, expected_email) - def test_llvm_ebuild_parsing_appears_to_function(self): - llvm_ebuild = io.StringIO( - "\n".join( - ( - "foo", - '#LLVM_HASH="123"', - 'LLVM_HASH="123" # comment', - 'LLVM_NEXT_HASH="456"', - ) - ) - ) - - shas = nightly_revert_checker._parse_llvm_ebuild_for_shas(llvm_ebuild) - self.assertEqual( - shas, - [ - ("llvm", "123"), - ("llvm-next", "456"), - ], - ) - - def test_llvm_ebuild_parsing_fails_if_both_hashes_arent_present(self): - bad_bodies = [ - "", - 'LLVM_HASH="123" # comment', - 'LLVM_NEXT_HASH="123" # comment', - 'LLVM_NEXT_HASH="123" # comment\n#LLVM_HASH="123"', - ] - - for bad in bad_bodies: - with self.assertRaises(ValueError) as e: - nightly_revert_checker._parse_llvm_ebuild_for_shas( - io.StringIO(bad) - ) - - self.assertIn("Failed to detect SHAs", str(e.exception)) - @mock.patch("revert_checker.find_reverts") @mock.patch("get_upstream_patch.get_from_upstream") def test_do_cherrypick_is_called(self, do_cherrypick, find_reverts): -- cgit v1.2.3 From c5dcecf1f21e2ab38a168070dfcedc18ecb6fcaf Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 15 Apr 2024 11:02:08 -0600 Subject: llvm_tools: remove LLVM_HASH usage from get_upstream_patch BUG=b:333462347 TEST=repo upload Change-Id: I6affa26c73367a7e447ea6bfe200b6ce0d7fa3de Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5454857 Reviewed-by: Bob Haarman Commit-Queue: George Burgess Tested-by: George Burgess --- llvm_tools/get_upstream_patch.py | 44 ++++------------------------------------ 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/llvm_tools/get_upstream_patch.py b/llvm_tools/get_upstream_patch.py index 18b08b00..7335aade 100755 --- a/llvm_tools/get_upstream_patch.py +++ b/llvm_tools/get_upstream_patch.py @@ -12,7 +12,6 @@ import json import logging import os from pathlib import Path -import shlex import subprocess import sys import typing as t @@ -191,41 +190,6 @@ def add_patch( os.rename(temp_file, patches_json_path) -def parse_ebuild_for_assignment(ebuild_path: str, var_name: str) -> str: - # '_pre' filters the LLVM 9.0 ebuild, which we never want to target, from - # this list. - candidates = [ - x - for x in os.listdir(ebuild_path) - if x.endswith(".ebuild") and "_pre" in x - ] - - if not candidates: - raise ValueError("No ebuilds found under %r" % ebuild_path) - - ebuild = os.path.join(ebuild_path, max(candidates)) - with open(ebuild, encoding="utf-8") as f: - var_name_eq = var_name + "=" - for orig_line in f: - if not orig_line.startswith(var_name_eq): - continue - - # We shouldn't see much variety here, so do the simplest thing - # possible. - line = orig_line[len(var_name_eq) :] - # Remove comments - line = line.split("#")[0] - # Remove quotes - parts = shlex.split(line) - if len(parts) != 1: - raise ValueError( - "Expected exactly one quoted value in %r" % orig_line - ) - return parts[0].strip() - - raise ValueError("No %s= line found in %r" % (var_name, ebuild)) - - # Resolves a git ref (or similar) to a LLVM SHA. def resolve_llvm_ref(llvm_dir: t.Union[Path, str], sha: str) -> str: return subprocess.check_output( @@ -309,12 +273,12 @@ def make_cl( git.DeleteBranch(llvm_symlink_dir, branch) -def resolve_symbolic_sha(start_sha: str, llvm_symlink_dir: str) -> str: +def resolve_symbolic_sha(start_sha: str, chromeos_path: Path) -> str: if start_sha == "llvm": - return parse_ebuild_for_assignment(llvm_symlink_dir, "LLVM_HASH") + return get_llvm_hash.LLVMHash().GetCrOSCurrentLLVMHash(chromeos_path) if start_sha == "llvm-next": - return parse_ebuild_for_assignment(llvm_symlink_dir, "LLVM_NEXT_HASH") + return get_llvm_hash.LLVMHash().GetCrOSLLVMNextHash() return start_sha @@ -515,7 +479,7 @@ def get_from_upstream( error_path = os.path.dirname(os.path.dirname(llvm_symlink_dir)) raise ValueError(f"Uncommited changes detected in {error_path}") - start_sha = resolve_symbolic_sha(start_sha, llvm_symlink_dir) + start_sha = resolve_symbolic_sha(start_sha, Path(chromeos_path)) logging.info("Base llvm hash == %s", start_sha) llvm_config = git_llvm_rev.LLVMConfig( -- cgit v1.2.3 From f46a883d0fc95495cbc2b819590e91579e8c32e5 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 10 Apr 2024 17:15:09 -0600 Subject: llvm_tools: add package stabilization script This allows a dev to make all changes in their LLVM ebuilds stable with a single command. Critically, if used with `--llvm-next`, a user can run `cros-tree bootstrap-sdk` in the tree this was run in, and they'll get something very close to an SDK run with llvm-next, but locally. No tests are included, since this has near zero conditional logic. Vast majority of that is elsewhere. BUG=b:333737743 TEST=Ran the script with --llvm-next, with an updated llvm-next. TEST=New ebuilds were created, as expected. Change-Id: Iad7bdcd4c51828e185fea698cd43922be47dd75f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5444011 Commit-Queue: George Burgess Reviewed-by: Ryan Beltran Tested-by: George Burgess --- llvm_tools/stabilize_all_llvm_packages.py | 141 ++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100755 llvm_tools/stabilize_all_llvm_packages.py diff --git a/llvm_tools/stabilize_all_llvm_packages.py b/llvm_tools/stabilize_all_llvm_packages.py new file mode 100755 index 00000000..40ca29f5 --- /dev/null +++ b/llvm_tools/stabilize_all_llvm_packages.py @@ -0,0 +1,141 @@ +#!/usr/bin/env python3 +# Copyright 2024 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Marks all LLVM packages as stable. + +This essentially performs the job of annealing: take whatever's in the 9999 +ebuilds, and put it in non-9999 ebuilds. The result is committed to +chromiumos-overlay, unless there are no changes to make. If the stabilization +does nothing, no new ebuilds will be created, and nothing will be committed. + +The results of this script should _not_ be uploaded. Annealing should be +responsible for actually stabilizing our ebuilds upstream. + +Run this from inside of the chroot. +""" + +import argparse +import contextlib +import logging +from pathlib import Path +import subprocess +import sys +from typing import List + +import chroot +import get_upstream_patch +import manifest_utils +import patch_utils + + +CROS_SOURCE_ROOT = Path("/mnt/host/source") + + +@contextlib.contextmanager +def llvm_checked_out_to(checkout_sha: str): + """Checks out LLVM to `checkout_sha`, if necessary. + + Restores LLVM to the prior SHA when exited. + """ + llvm_dir = CROS_SOURCE_ROOT / manifest_utils.LLVM_PROJECT_PATH + original_sha = subprocess.run( + ["git", "rev-parse", "HEAD"], + check=True, + cwd=llvm_dir, + stdout=subprocess.PIPE, + encoding="utf-8", + ).stdout.strip() + if checkout_sha == original_sha: + logging.info( + "LLVM is already checked out to %s; not checking out", checkout_sha + ) + yield + return + + return_code = subprocess.run( + ["git", "status", "--porcelain"], + check=False, + cwd=llvm_dir, + ).returncode + if return_code: + raise ValueError( + f"LLVM checkout at {llvm_dir} is unclean; refusing to modify" + ) + + logging.info("Checking %s out to SHA %s...", llvm_dir, checkout_sha) + + subprocess.run( + ["git", "checkout", checkout_sha], + check=True, + cwd=llvm_dir, + ) + try: + yield + finally: + logging.info("Restoring %s to original checkout...", llvm_dir) + return_code = subprocess.run( + ["git", "checkout", original_sha], + check=False, + cwd=llvm_dir, + ).returncode + if return_code: + logging.error( + "Failed checking llvm-project back out to %s :(", + original_sha, + ) + + +def resolve_llvm_sha(llvm_next: bool) -> str: + sys_devel_llvm = ( + CROS_SOURCE_ROOT / "src/third_party/chromiumos-overlay/sys-devel/llvm" + ) + sha = "llvm-next" if llvm_next else "llvm" + return get_upstream_patch.resolve_symbolic_sha(sha, str(sys_devel_llvm)) + + +def main(argv: List[str]) -> None: + chroot.VerifyInsideChroot() + + logging.basicConfig( + format=">> %(asctime)s: %(levelname)s: %(filename)s:%(lineno)d: " + "%(message)s", + level=logging.INFO, + ) + + parser = argparse.ArgumentParser( + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, + ) + parser.add_argument( + "--llvm-next", + action="store_true", + help=""" + If passed, the ebuilds will be stabilized using the current llvm-next + hash. + """, + ) + opts = parser.parse_args(argv) + desired_sha = resolve_llvm_sha(opts.llvm_next) + + with llvm_checked_out_to(desired_sha): + packages_to_stabilize = patch_utils.CHROMEOS_PATCHES_JSON_PACKAGES + logging.info("Stabilizing %s...", ", ".join(packages_to_stabilize)) + + cros_overlay = CROS_SOURCE_ROOT / "src/third_party/chromiumos-overlay" + return_code = subprocess.run( + [ + "cros_mark_as_stable", + f"--overlays={cros_overlay}", + "--packages=" + ":".join(packages_to_stabilize), + "commit", + ], + check=False, + stdin=subprocess.DEVNULL, + ).returncode + sys.exit(return_code) + + +if __name__ == "__main__": + main(sys.argv[1:]) -- cgit v1.2.3 From 54e65f7949aca046aaa703514913ff5cd50f1626 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 16 Apr 2024 08:46:20 -0600 Subject: git: add helper to determine if something's a full SHA BUG=b:333462347 TEST=repo upload Change-Id: I83ba2269e45c8a14ef548a8c1f4b6a352356e23e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5458711 Commit-Queue: George Burgess Tested-by: George Burgess Reviewed-by: Ryan Beltran --- llvm_tools/git.py | 5 +++++ llvm_tools/git_unittest.py | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/llvm_tools/git.py b/llvm_tools/git.py index 7ca44b04..ea4ce3d2 100755 --- a/llvm_tools/git.py +++ b/llvm_tools/git.py @@ -17,6 +17,11 @@ from typing import Iterable, Optional, Union CommitContents = collections.namedtuple("CommitContents", ["url", "cl_number"]) +def IsFullGitSHA(s: str) -> bool: + """Returns if `s` looks like a git SHA.""" + return len(s) == 40 and all(x.isdigit() or "a" <= x <= "f" for x in s) + + def CreateBranch(repo: Union[Path, str], branch: str) -> None: """Creates a branch in the given repo. diff --git a/llvm_tools/git_unittest.py b/llvm_tools/git_unittest.py index 940f0dba..fa756ddf 100755 --- a/llvm_tools/git_unittest.py +++ b/llvm_tools/git_unittest.py @@ -17,10 +17,28 @@ import git # These are unittests; protected access is OK to a point. # pylint: disable=protected-access +EXAMPLE_GIT_SHA = "d46d9c1a23118e3943f43fe2dfc9f9c9c0b4aefe" + class HelperFunctionsTest(unittest.TestCase): """Test class for updating LLVM hashes of packages.""" + def testIsFullGitSHASuccessCases(self): + shas = ("a" * 40, EXAMPLE_GIT_SHA) + for s in shas: + self.assertTrue(git.IsFullGitSHA(s), s) + + def testIsFullGitSHAFailureCases(self): + shas = ( + "", + "A" * 40, + "g" * 40, + EXAMPLE_GIT_SHA[1:], + EXAMPLE_GIT_SHA + "a", + ) + for s in shas: + self.assertFalse(git.IsFullGitSHA(s), s) + @mock.patch.object(os.path, "isdir", return_value=False) def testFailedToCreateBranchForInvalidDirectoryPath(self, mock_isdir): path_to_repo = "/invalid/path/to/repo" -- cgit v1.2.3 From 8a26cd3ee163f5db801efd68deb70fc6f51cc25a Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 16 Apr 2024 08:53:24 -0600 Subject: cros_utils: add support for parsing for internal CL uploads BUG=b:333462347 TEST=Unittests Change-Id: Ia6abfee1465465784c2934a4ac64e878ac577d6c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5458262 Reviewed-by: Jordan Abrahams-Whitehead Tested-by: George Burgess Commit-Queue: George Burgess --- cros_utils/git_utils.py | 5 ++++- cros_utils/git_utils_test.py | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/cros_utils/git_utils.py b/cros_utils/git_utils.py index c4245280..d8c11d0a 100644 --- a/cros_utils/git_utils.py +++ b/cros_utils/git_utils.py @@ -21,7 +21,10 @@ REVIEWER_DETECTIVE = "c-compiler-chrome@google.com" def _parse_cls_from_upload_output(upload_output: str) -> List[int]: """Returns the CL number in the given upload output.""" id_regex = re.compile( - r"^remote:\s+https://chromium-review\S+/\+/(\d+)\s", re.MULTILINE + r"^remote:\s+https://" + r"(?:chromium|chrome-internal)" + r"-review\S+/\+/(\d+)\s", + re.MULTILINE, ) results = id_regex.findall(upload_output) diff --git a/cros_utils/git_utils_test.py b/cros_utils/git_utils_test.py index 2edf1591..f6060a7b 100755 --- a/cros_utils/git_utils_test.py +++ b/cros_utils/git_utils_test.py @@ -11,7 +11,7 @@ from cros_utils import git_utils # pylint: disable=protected-access -GERRIT_OUTPUT_WITH_ONE_CL = """ +GERRIT_OUTPUT_WITH_ONE_CL = r""" Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 128 threads @@ -29,7 +29,7 @@ To https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils * [new reference] HEAD -> refs/for/main """ -GERRIT_OUTPUT_WITH_TWO_CLS = """ +GERRIT_OUTPUT_WITH_TWO_CLS = r""" Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 128 threads @@ -49,6 +49,33 @@ To https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils """ +GERRIT_OUTPUT_WITH_INTERNAL_CL = r""" +Upload project manifest-internal/ to remote branch refs/heads/main: + branch DO-NOT-COMMIT ( 1 commit, Tue Apr 16 08:51:25 2024 -0600): + 456aadd0 DO NOT COMMIT +to https://chrome-internal-review.googlesource.com (y/N)? <--yes> +Enumerating objects: 5, done. +Counting objects: 100% (5/5), done. +Delta compression using up to 128 threads +Compressing objects: 100% (3/3), done. +Writing objects: 100% (3/3), 334 bytes | 334.00 KiB/s, done. +Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 (from 0) +remote: Resolving deltas: 100% (2/2) +remote: Waiting for private key checker: 1/1 objects left +remote: Processing changes: refs: 1, new: 1, done +remote: +remote: SUCCESS +remote: +remote: https://chrome-internal-review.googlesource.com/c/chromeos/manifest-internal/+/7190037 DO NOT COMMIT [NEW] +remote: +To https://chrome-internal-review.googlesource.com/chromeos/manifest-internal + * [new reference] DO-NOT-COMMIT -> refs/for/main + +---------------------------------------------------------------------- +[OK ] manifest-internal/ DO-NOT-COMMIT +""" + + class Test(unittest.TestCase): """Tests for git_utils.""" @@ -68,6 +95,14 @@ class Test(unittest.TestCase): [5375204, 5375205], ) + def test_cl_parsing_works_with_internal_cl(self): + self.assertEqual( + git_utils._parse_cls_from_upload_output( + GERRIT_OUTPUT_WITH_INTERNAL_CL + ), + [7190037], + ) + if __name__ == "__main__": unittest.main() -- cgit v1.2.3 From c6733c05ba5253d8c7606dfe8a8a86611bc66b24 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 16 Apr 2024 08:16:15 -0600 Subject: auto_abandon_cls: include internal CLs BUG=b:335019675 TEST=Ran with --dry-run Change-Id: I2e78f31e8b22f8ae318e55037c7a680b059ac869 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5458261 Tested-by: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: George Burgess --- auto_abandon_cls.py | 66 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/auto_abandon_cls.py b/auto_abandon_cls.py index d210c085..ae78bfa5 100755 --- a/auto_abandon_cls.py +++ b/auto_abandon_cls.py @@ -16,10 +16,18 @@ import sys from typing import List -def enumerate_old_cls(old_days: int) -> List[int]: +def gerrit_cmd(internal: bool) -> List[str]: + cmd = ["gerrit"] + if internal: + cmd.append("--internal") + return cmd + + +def enumerate_old_cls(old_days: int, internal: bool) -> List[int]: """Returns CL numbers that haven't been updated in `old_days` days.""" stdout = subprocess.run( - ["gerrit", "--raw", "search", f"owner:me status:open age:{old_days}d"], + gerrit_cmd(internal) + + ["--raw", "search", f"owner:me status:open age:{old_days}d"], check=True, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, @@ -27,17 +35,42 @@ def enumerate_old_cls(old_days: int) -> List[int]: ).stdout # Sort for prettier output; it's unclear if Gerrit always sorts, and it's # cheap. - return sorted(int(x) for x in stdout.splitlines()) + lines = stdout.splitlines() + if internal: + # These are printed as `chrome-internal:NNNN`, rather than `NNNN`. + chrome_internal_prefix = "chrome-internal:" + assert all(x.startswith(chrome_internal_prefix) for x in lines), lines + lines = [x[len(chrome_internal_prefix) :] for x in lines] + return sorted(int(x) for x in lines) -def abandon_cls(cls: List[int]) -> None: +def abandon_cls(cls: List[int], internal: bool) -> None: subprocess.run( - ["gerrit", "abandon"] + [str(x) for x in cls], + gerrit_cmd(internal) + ["abandon"] + [str(x) for x in cls], check=True, stdin=subprocess.DEVNULL, ) +def detect_and_abandon_cls( + old_days: int, dry_run: bool, internal: bool +) -> None: + old_cls = enumerate_old_cls(old_days, internal) + if not old_cls: + logging.info("No CLs less than %d days old found; quit", old_days) + return + + cl_namespace = "i" if internal else "c" + logging.info( + "Abandoning CLs: %s", [f"crrev.com/{cl_namespace}/{x}" for x in old_cls] + ) + if dry_run: + logging.info("--dry-run specified; skip the actual abandon part") + return + + abandon_cls(old_cls, internal) + + def main(argv: List[str]) -> None: logging.basicConfig( format=">> %(asctime)s: %(levelname)s: %(filename)s:%(lineno)d: " @@ -65,17 +98,18 @@ def main(argv: List[str]) -> None: ) opts = parser.parse_args(argv) - old_cls = enumerate_old_cls(opts.old_days) - if not old_cls: - logging.info("No CLs less than %d days old found; quit", opts.old_days) - return - - logging.info("Abandoning CLs: %s", [f"crrev.com/c/{x}" for x in old_cls]) - if opts.dry_run: - logging.info("--dry-run specified; skip the actual abandon part") - return - - abandon_cls(old_cls) + logging.info("Checking for external CLs...") + detect_and_abandon_cls( + old_days=opts.old_days, + dry_run=opts.dry_run, + internal=False, + ) + logging.info("Checking for internal CLs...") + detect_and_abandon_cls( + old_days=opts.old_days, + dry_run=opts.dry_run, + internal=True, + ) if __name__ == "__main__": -- cgit v1.2.3 From a37c013c31fd5b50a5ac48353e3ac33ec49c01b3 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 16 Apr 2024 16:58:35 -0600 Subject: llvm_tools: move FindChromeOSRootAbove to chroot.py This will be used more widely in later CLs. BUG=b:333462347 TEST=unittests Change-Id: Icbba5f343f3e92e347785686c3bb324d53ed46b6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5460283 Reviewed-by: Ryan Beltran Tested-by: George Burgess Commit-Queue: George Burgess --- llvm_tools/chroot.py | 17 +++++++++++++++++ llvm_tools/get_llvm_hash.py | 16 +++------------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/llvm_tools/chroot.py b/llvm_tools/chroot.py index 1dcf8e66..a104bd63 100755 --- a/llvm_tools/chroot.py +++ b/llvm_tools/chroot.py @@ -49,6 +49,23 @@ def VerifyChromeOSRoot(chromeos_root: Union[Path, str]) -> None: assert path.is_dir(), msg +def FindChromeOSRootAbove(chromeos_tree_path: Path) -> Path: + """Returns the root of a ChromeOS tree, given a path in said tree. + + May return `chromeos_tree_path`, if that's already the root of the tree. + + Raises: + ValueError if the given path is not in a ChromeOS tree. + """ + if (chromeos_tree_path / ".repo").exists(): + return chromeos_tree_path + + for parent in chromeos_tree_path.parents: + if (parent / ".repo").exists(): + return parent + raise ValueError(f"{chromeos_tree_path} is not in a repo checkout") + + def GetChrootEbuildPaths( chromeos_root: Union[Path, str], packages: Iterable[str], diff --git a/llvm_tools/get_llvm_hash.py b/llvm_tools/get_llvm_hash.py index 05e14b58..401a68a5 100755 --- a/llvm_tools/get_llvm_hash.py +++ b/llvm_tools/get_llvm_hash.py @@ -17,6 +17,7 @@ import sys import tempfile from typing import Iterator, Optional, Tuple, Union +import chroot import git_llvm_rev import llvm_next import manifest_utils @@ -363,17 +364,6 @@ def GetLLVMHashAndVersionFromSVNOption( return git_hash, version -def _FindChromeOSTreeRoot(chromeos_tree_path: Path) -> Path: - """Returns the root of a ChromeOS tree, given a path in said tree.""" - if (chromeos_tree_path / ".repo").exists(): - return chromeos_tree_path - - for parent in chromeos_tree_path.parents: - if (parent / ".repo").exists(): - return parent - raise ValueError(f"{chromeos_tree_path} is not in a repo checkout") - - def GetCrOSCurrentLLVMHash(chromeos_tree: Path) -> str: """Retrieves the current ChromeOS LLVM hash. @@ -385,7 +375,7 @@ def GetCrOSCurrentLLVMHash(chromeos_tree: Path) -> str: ManifestValueError if the toolchain manifest doesn't match the expected structure. """ - chromeos_root = _FindChromeOSTreeRoot(chromeos_tree) + chromeos_root = chroot.FindChromeOSRootAbove(chromeos_tree) return manifest_utils.extract_current_llvm_hash(chromeos_root) @@ -499,7 +489,7 @@ def main() -> None: # be more easily detected (which allows more flexibility in the # implementation in the future for things outside of what directly # needs this value). - chromeos_tree = _FindChromeOSTreeRoot(my_dir) + chromeos_tree = chroot.FindChromeOSRootAbove(my_dir) new_llvm_hash = LLVMHash() if isinstance(cur_llvm_version, int): -- cgit v1.2.3