summaryrefslogtreecommitdiff
path: root/rust/rust_test.go
diff options
context:
space:
mode:
authorThiƩbaud Weksteen <tweek@google.com>2021-04-14 11:18:47 +0200
committerThiƩbaud Weksteen <tweek@google.com>2021-04-15 12:02:51 +0200
commite4dd14b25fe65b2fc6a5a2fb51d3647f1d455890 (patch)
tree5a406992407fcba97fe3c22e9186225ce276156d /rust/rust_test.go
parent4fab05a2ade36fe74cf3af2aacbb6f53fe280da8 (diff)
bloaty: measure stripped Rust binaries
Modify bloaty's MeasureSizeForPath to allow a module to provide multiple paths. This is used to measure both unstripped and stripped libraries/binaries. Add unit test to ensure correct measurements are generated for Rust. Test: m out/soong/binary_sizes.pb.gz Change-Id: I59439b77dbf1cf5ad71e1c02996a6a90938536b4
Diffstat (limited to 'rust/rust_test.go')
-rw-r--r--rust/rust_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/rust/rust_test.go b/rust/rust_test.go
index 890fb262b..3354d1de4 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -384,3 +384,17 @@ func TestMultilib(t *testing.T) {
_ = ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_rlib_dylib-std")
_ = ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_rlib_dylib-std")
}
+
+// Test that library size measurements are generated.
+func TestLibrarySizes(t *testing.T) {
+ ctx := testRust(t, `
+ rust_library_dylib {
+ name: "libwaldo",
+ srcs: ["foo.rs"],
+ crate_name: "waldo",
+ }`)
+
+ m := ctx.SingletonForTests("file_metrics")
+ m.Output("libwaldo.dylib.so.bloaty.csv")
+ m.Output("stripped/libwaldo.dylib.so.bloaty.csv")
+}