summaryrefslogtreecommitdiff
path: root/rust/compiler_test.go
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2020-04-28 13:58:45 -0400
committerIvan Lozano <ivanlozano@google.com>2020-04-29 15:31:42 -0400
commitf900f4b848d6d04090a2c61d36478fff15d6ec9b (patch)
tree8b63e7447720cdbb5907a8fdd5c1f58b3a249d49 /rust/compiler_test.go
parent9d1df10e2a7aacb4ada52000dc299ce8c187330a (diff)
Test for rust install path regressions.
Bug: 153423714 Test: Soong tests pass. Change-Id: Ica4d2c7e47f1c325fa387a91f6c476dfa4f93710
Diffstat (limited to 'rust/compiler_test.go')
-rw-r--r--rust/compiler_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/rust/compiler_test.go b/rust/compiler_test.go
index bbf9f8d11..bcde75795 100644
--- a/rust/compiler_test.go
+++ b/rust/compiler_test.go
@@ -74,3 +74,33 @@ func TestEnforceSingleSourceFile(t *testing.T) {
host_supported: true,
}`)
}
+
+func TestInstallDir(t *testing.T) {
+ ctx := testRust(t, `
+ rust_library_dylib {
+ name: "libfoo",
+ srcs: ["foo.rs"],
+ crate_name: "foo",
+ }
+ rust_binary {
+ name: "fizzbuzz",
+ srcs: ["foo.rs"],
+ }`)
+
+ install_path_lib64 := ctx.ModuleForTests("libfoo",
+ "android_arm64_armv8-a_dylib").Module().(*Module).compiler.(*libraryDecorator).path.String()
+ install_path_lib32 := ctx.ModuleForTests("libfoo",
+ "android_arm_armv7-a-neon_dylib").Module().(*Module).compiler.(*libraryDecorator).path.String()
+ install_path_bin := ctx.ModuleForTests("fizzbuzz",
+ "android_arm64_armv8-a").Module().(*Module).compiler.(*binaryDecorator).path.String()
+
+ if !strings.HasSuffix(install_path_lib64, "system/lib64/libfoo.dylib.so") {
+ t.Fatalf("unexpected install path for 64-bit library: %#v", install_path_lib64)
+ }
+ if !strings.HasSuffix(install_path_lib32, "system/lib/libfoo.dylib.so") {
+ t.Fatalf("unexpected install path for 32-bit library: %#v", install_path_lib32)
+ }
+ if !strings.HasSuffix(install_path_bin, "system/bin/fizzbuzz") {
+ t.Fatalf("unexpected install path for binary: %#v", install_path_bin)
+ }
+}