summaryrefslogtreecommitdiff
path: root/android/sh_binary_test.go
diff options
context:
space:
mode:
author Jaewoong Jung <jungjw@google.com> 2020-06-01 10:45:49 -0700
committer Jaewoong Jung <jungjw@google.com> 2020-06-01 13:44:48 -0700
commit4b79e98a6e4f882d6bbb882e9fed626e0c490bd7 (patch)
treef1497567645e52e96f18a1cc46a1eee07e93c2a4 /android/sh_binary_test.go
parenta91b64d3eeea5598062326c02cdd14dd8d8b704b (diff)
Soong package structure refactoring
Give prebuilt_etc and sh_binary their own packages and split the gigantic main Android.bp up to small, per-package ones. Test: m nothing, TreeHugger Bug: 156980228 Change-Id: I7b00cd344b9f16861f1ff39edf0029f016b853d0
Diffstat (limited to 'android/sh_binary_test.go')
-rw-r--r--android/sh_binary_test.go70
1 files changed, 0 insertions, 70 deletions
diff --git a/android/sh_binary_test.go b/android/sh_binary_test.go
deleted file mode 100644
index 137e77348..000000000
--- a/android/sh_binary_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package android
-
-import (
- "reflect"
- "testing"
-)
-
-func testShBinary(t *testing.T, bp string) (*TestContext, Config) {
- fs := map[string][]byte{
- "test.sh": nil,
- "testdata/data1": nil,
- "testdata/sub/data2": nil,
- }
-
- config := TestArchConfig(buildDir, nil, bp, fs)
-
- ctx := NewTestArchContext()
- ctx.RegisterModuleType("sh_test", ShTestFactory)
- ctx.RegisterModuleType("sh_test_host", ShTestHostFactory)
- ctx.Register(config)
- _, errs := ctx.ParseFileList(".", []string{"Android.bp"})
- FailIfErrored(t, errs)
- _, errs = ctx.PrepareBuildActions(config)
- FailIfErrored(t, errs)
-
- return ctx, config
-}
-
-func TestShTestTestData(t *testing.T) {
- ctx, config := testShBinary(t, `
- sh_test {
- name: "foo",
- src: "test.sh",
- filename: "test.sh",
- data: [
- "testdata/data1",
- "testdata/sub/data2",
- ],
- }
- `)
-
- mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
-
- entries := AndroidMkEntriesForTest(t, config, "", mod)[0]
- expected := []string{":testdata/data1", ":testdata/sub/data2"}
- actual := entries.EntryMap["LOCAL_TEST_DATA"]
- if !reflect.DeepEqual(expected, actual) {
- t.Errorf("Unexpected test data expected: %q, actual: %q", expected, actual)
- }
-}
-
-func TestShTestHost(t *testing.T) {
- ctx, _ := testShBinary(t, `
- sh_test_host {
- name: "foo",
- src: "test.sh",
- filename: "test.sh",
- data: [
- "testdata/data1",
- "testdata/sub/data2",
- ],
- }
- `)
-
- buildOS := BuildOs.String()
- mod := ctx.ModuleForTests("foo", buildOS+"_x86_64").Module().(*ShTest)
- if !mod.Host() {
- t.Errorf("host bit is not set for a sh_test_host module.")
- }
-}