Revert "support sandboxed rust rules"

Revert submission 2629131-sandbox-rust-inputs

Reason for revert: Fail on android build.

Reverted changes: /q/submissionid:2629131-sandbox-rust-inputs

Change-Id: Ifd9aa46e80a12d8f4ffa0a2daa74b96727cbb7e6
This commit is contained in:
Wen-yi Chu
2023-09-22 03:58:59 +00:00
parent df0ed707a5
commit 41326c1f41
28 changed files with 383 additions and 1402 deletions

View File

@@ -135,7 +135,7 @@ func TestBinaryFlags(t *testing.T) {
fizzBuzz := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Rule("rustc")
flags := fizzBuzz.RuleParams.Command
flags := fizzBuzz.Args["rustcFlags"]
if strings.Contains(flags, "--test") {
t.Errorf("extra --test flag, rustcFlags: %#v", flags)
}
@@ -150,11 +150,11 @@ func TestBootstrap(t *testing.T) {
bootstrap: true,
}`)
foo := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Rule("rustc")
foo := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Rule("rustLink")
flag := "-Wl,-dynamic-linker,/system/bin/bootstrap/linker64"
if !strings.Contains(foo.RuleParams.Command, flag) {
t.Errorf("missing link flag to use bootstrap linker, expecting %#v, command: %#v", flag, foo.RuleParams.Command)
if !strings.Contains(foo.Args["linkFlags"], flag) {
t.Errorf("missing link flag to use bootstrap linker, expecting %#v, linkFlags: %#v", flag, foo.Args["linkFlags"])
}
}
@@ -167,17 +167,19 @@ func TestStaticBinaryFlags(t *testing.T) {
}`)
fizzOut := ctx.ModuleForTests("fizz", "android_arm64_armv8-a").Rule("rustc")
fizzOutLink := ctx.ModuleForTests("fizz", "android_arm64_armv8-a").Rule("rustLink")
fizzMod := ctx.ModuleForTests("fizz", "android_arm64_armv8-a").Module().(*Module)
flags := fizzOut.RuleParams.Command
flags := fizzOut.Args["rustcFlags"]
linkFlags := fizzOutLink.Args["linkFlags"]
if !strings.Contains(flags, "-C relocation-model=static") {
t.Errorf("static binary missing '-C relocation-model=static' in command, found: %#v", flags)
t.Errorf("static binary missing '-C relocation-model=static' in rustcFlags, found: %#v", flags)
}
if !strings.Contains(flags, "-C panic=abort") {
t.Errorf("static binary missing '-C panic=abort' in command, found: %#v", flags)
t.Errorf("static binary missing '-C panic=abort' in rustcFlags, found: %#v", flags)
}
if !strings.Contains(flags, "-static") {
t.Errorf("static binary missing '-static' in command, found: %#v", flags)
if !strings.Contains(linkFlags, "-static") {
t.Errorf("static binary missing '-static' in linkFlags, found: %#v", flags)
}
if !android.InList("libc", fizzMod.Properties.AndroidMkStaticLibs) {
@@ -199,9 +201,10 @@ func TestLinkObjects(t *testing.T) {
name: "libfoo",
}`)
fizzBuzz := ctx.ModuleForTests("fizz-buzz", "android_arm64_armv8-a").Rule("rustc")
if !strings.Contains(fizzBuzz.RuleParams.Command, "/libfoo.so") {
t.Errorf("missing shared dependency 'libfoo.so' in command: %#v", fizzBuzz.RuleParams.Command)
fizzBuzz := ctx.ModuleForTests("fizz-buzz", "android_arm64_armv8-a").Rule("rustLink")
linkFlags := fizzBuzz.Args["linkFlags"]
if !strings.Contains(linkFlags, "/libfoo.so") {
t.Errorf("missing shared dependency 'libfoo.so' in linkFlags: %#v", linkFlags)
}
}