summaryrefslogtreecommitdiff
path: root/rust/rust_test.go
diff options
context:
space:
mode:
authorMatthew Maurer <mmaurer@google.com>2019-10-31 10:44:40 -0700
committerMatthew Maurer <mmaurer@google.com>2019-11-13 17:46:19 -0800
commit99020b04fbf5ce97d9a7a5b56b44cadeeb34ca4c (patch)
treead88fefd6317657e8977d0fcc73313d4c590df14 /rust/rust_test.go
parent940ef19f77ed30fb1b3c850ef4f880420a6fb456 (diff)
Build Rust Device Sysroots in Soong
In order to ensure we are using current platform Bionic for any platform Rust binaries, we need to build the sysroot in Soong. This will also enable us too hook the "test" crate if necessary. While both a dynamic and static sysroot are available, on device only a dynamic sysroot will be injected. On host, we continue using the sysroot used to build the compiler as before. Bug: 139486496 Change-Id: I127377e5b056610ceb5015a34d266250320fbc31
Diffstat (limited to 'rust/rust_test.go')
-rw-r--r--rust/rust_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/rust/rust_test.go b/rust/rust_test.go
index eb04e7257..bbd911114 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -209,6 +209,25 @@ func TestProcMacroDeviceDeps(t *testing.T) {
name: "libbar",
srcs: ["foo.rs"],
}
+ // Make a dummy libstd to let resolution go through
+ rust_library_dylib {
+ name: "libstd",
+ crate_name: "std",
+ srcs: ["foo.rs"],
+ no_stdlibs: true,
+ }
+ rust_library_dylib {
+ name: "libterm",
+ crate_name: "term",
+ srcs: ["foo.rs"],
+ no_stdlibs: true,
+ }
+ rust_library_dylib {
+ name: "libtest",
+ crate_name: "test",
+ srcs: ["foo.rs"],
+ no_stdlibs: true,
+ }
rust_proc_macro {
name: "libpm",
rlibs: ["libbar"],
@@ -226,3 +245,18 @@ func TestProcMacroDeviceDeps(t *testing.T) {
t.Errorf("Proc_macro is not using host variant of dependent modules.")
}
}
+
+// Test that no_stdlibs suppresses dependencies on rust standard libraries
+func TestNoStdlibs(t *testing.T) {
+ ctx := testRust(t, `
+ rust_binary {
+ name: "fizz-buzz",
+ srcs: ["foo.rs"],
+ no_stdlibs: true,
+ }`)
+ module := ctx.ModuleForTests("fizz-buzz", "android_arm64_armv8-a_core").Module().(*Module)
+
+ if android.InList("libstd", module.Properties.AndroidMkDylibs) {
+ t.Errorf("no_stdlibs did not suppress dependency on libstd")
+ }
+}