aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Haarman <inglorion@chromium.org>2024-01-31 22:57:28 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-02-01 18:45:53 +0000
commitc2b9e7a4b98906464c89062c3e9d755e7919963a (patch)
treeafefe8d2583718db0eccd42e2a9f9ab9b43a275b
parentbf1e26ec64ed7904322aaa32e7b80458c3a5d99f (diff)
downloadtoolchain-utils-c2b9e7a4b98906464c89062c3e9d755e7919963a.tar.gz
pgo_rust: explicitly build rust-artifacts
pgo_rust builds dev-lang/rust and dev-lang/rust-host a couple of times with different USE flags (instrumented for frontend profiling, instrumented for LLVM profiling) and generates profile data with each configuration. However, USE flags are not taken into account when deciding if dependencies need to be rebuilt. This resulted in dev-lang/rust-artifacts not being rebuilt with the changed USE flags, and profiles not being generated correctly. This change explicitly rebuilds dev-lang/rust-artifacts each time we change the flags, so that profiles are generated correctly. BUG=b:322998657 TEST=pgo_rust.py generate; see that profiles are generated successfully Change-Id: I28265c8d5cf98c4abf751f681e7a361be587359a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5258978 Commit-Queue: Bob Haarman <inglorion@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org>
-rwxr-xr-xpgo_tools_rust/pgo_rust.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pgo_tools_rust/pgo_rust.py b/pgo_tools_rust/pgo_rust.py
index fc693169..eb4c8e61 100755
--- a/pgo_tools_rust/pgo_rust.py
+++ b/pgo_tools_rust/pgo_rust.py
@@ -303,7 +303,14 @@ def build_rust(
use = (env_use + " " + use).strip()
# -E to preserve environment variables like USE, FEATURES, etc.
run(
- ["sudo", "-E", "emerge", "dev-lang/rust", "dev-lang/rust-host"],
+ [
+ "sudo",
+ "-E",
+ "emerge",
+ "dev-lang/rust-artifacts",
+ "dev-lang/rust-host",
+ "dev-lang/rust",
+ ],
env={"USE": use},
)
@@ -323,6 +330,7 @@ def merge_profdata(llvm_or_frontend, *, source_directory: Path, dest: Path):
dest.parent.mkdir(parents=True, exist_ok=True)
files = list(source_directory.glob("*.profraw"))
+ assert files, f"No profraw files found in {source_directory}"
run([llvm_profdata, "merge", f"--output={dest}"] + files)