Loading sh/sh_binary.go +12 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,12 @@ type shBinaryProperties struct { Recovery_available *bool } // Test option struct. type TestOptions struct { // If the test is a hostside(no device required) unittest that shall be run during presubmit check. Unit_test *bool } type TestProperties struct { // list of compatibility suites (for example "cts", "vts") that the module should be // installed into. Loading Loading @@ -143,6 +149,9 @@ type TestProperties struct { // list of device library modules that should be installed alongside the test. // Only available for host sh_test modules. Data_device_libs []string `android:"path,arch_variant"` // Test options. Test_options TestOptions } type ShBinary struct { Loading Loading @@ -440,6 +449,9 @@ func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries { dir := strings.TrimSuffix(s.dataModules[relPath].String(), relPath) entries.AddStrings("LOCAL_TEST_DATA", dir+":"+relPath) } if Bool(s.testProperties.Test_options.Unit_test) { entries.SetBool("LOCAL_IS_UNIT_TEST", true) } }, }, }} Loading sh/sh_binary_test.go +7 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package sh import ( "os" "path/filepath" "strconv" "testing" "android/soong/android" Loading Loading @@ -148,6 +149,9 @@ func TestShTestHost(t *testing.T) { "testdata/data1", "testdata/sub/data2", ], test_options: { unit_test: true, }, } `) Loading @@ -156,6 +160,9 @@ func TestShTestHost(t *testing.T) { if !mod.Host() { t.Errorf("host bit is not set for a sh_test_host module.") } entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0] actualData, _ := strconv.ParseBool(entries.EntryMap["LOCAL_IS_UNIT_TEST"][0]) android.AssertBoolEquals(t, "LOCAL_IS_UNIT_TEST", true, actualData) } func TestShTestHost_dataDeviceModules(t *testing.T) { Loading Loading
sh/sh_binary.go +12 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,12 @@ type shBinaryProperties struct { Recovery_available *bool } // Test option struct. type TestOptions struct { // If the test is a hostside(no device required) unittest that shall be run during presubmit check. Unit_test *bool } type TestProperties struct { // list of compatibility suites (for example "cts", "vts") that the module should be // installed into. Loading Loading @@ -143,6 +149,9 @@ type TestProperties struct { // list of device library modules that should be installed alongside the test. // Only available for host sh_test modules. Data_device_libs []string `android:"path,arch_variant"` // Test options. Test_options TestOptions } type ShBinary struct { Loading Loading @@ -440,6 +449,9 @@ func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries { dir := strings.TrimSuffix(s.dataModules[relPath].String(), relPath) entries.AddStrings("LOCAL_TEST_DATA", dir+":"+relPath) } if Bool(s.testProperties.Test_options.Unit_test) { entries.SetBool("LOCAL_IS_UNIT_TEST", true) } }, }, }} Loading
sh/sh_binary_test.go +7 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package sh import ( "os" "path/filepath" "strconv" "testing" "android/soong/android" Loading Loading @@ -148,6 +149,9 @@ func TestShTestHost(t *testing.T) { "testdata/data1", "testdata/sub/data2", ], test_options: { unit_test: true, }, } `) Loading @@ -156,6 +160,9 @@ func TestShTestHost(t *testing.T) { if !mod.Host() { t.Errorf("host bit is not set for a sh_test_host module.") } entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0] actualData, _ := strconv.ParseBool(entries.EntryMap["LOCAL_IS_UNIT_TEST"][0]) android.AssertBoolEquals(t, "LOCAL_IS_UNIT_TEST", true, actualData) } func TestShTestHost_dataDeviceModules(t *testing.T) { Loading