Mark test helpers as helpers.

This enables identifying the correct location of test failures.

from godocs:
Helper marks the calling function as a test helper function.
When printing file and line information, that function will be skipped.
Helper may be called simultaneously from multiple goroutines.

Test: go test bp2build tests
Change-Id: I52430e541494c78f5222c11510a4d273fe205a06
This commit is contained in:
Liz Kammer
2021-05-25 10:39:35 -04:00
parent 70975ac815
commit e4982e8828
6 changed files with 7 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ toolchain_library {
) )
func runCcLibraryTestCase(t *testing.T, tc bp2buildTestCase) { func runCcLibraryTestCase(t *testing.T, tc bp2buildTestCase) {
t.Helper()
runBp2BuildTestCase(t, registerCcLibraryModuleTypes, tc) runBp2BuildTestCase(t, registerCcLibraryModuleTypes, tc)
} }
@@ -52,6 +53,7 @@ func registerCcLibraryModuleTypes(ctx android.RegistrationContext) {
} }
func runBp2BuildTestCase(t *testing.T, registerModuleTypes func(ctx android.RegistrationContext), tc bp2buildTestCase) { func runBp2BuildTestCase(t *testing.T, registerModuleTypes func(ctx android.RegistrationContext), tc bp2buildTestCase) {
t.Helper()
dir := "." dir := "."
filesystem := make(map[string][]byte) filesystem := make(map[string][]byte)
toParse := []string{ toParse := []string{

View File

@@ -84,6 +84,7 @@ func registerCcLibraryHeadersModuleTypes(ctx android.RegistrationContext) {
} }
func runCcLibraryHeadersTestCase(t *testing.T, tc bp2buildTestCase) { func runCcLibraryHeadersTestCase(t *testing.T, tc bp2buildTestCase) {
t.Helper()
runBp2BuildTestCase(t, registerCcLibraryHeadersModuleTypes, tc) runBp2BuildTestCase(t, registerCcLibraryHeadersModuleTypes, tc)
} }

View File

@@ -76,6 +76,7 @@ func registerCcLibraryStaticModuleTypes(ctx android.RegistrationContext) {
} }
func runCcLibraryStaticTestCase(t *testing.T, tc bp2buildTestCase) { func runCcLibraryStaticTestCase(t *testing.T, tc bp2buildTestCase) {
t.Helper()
runBp2BuildTestCase(t, registerCcLibraryStaticModuleTypes, tc) runBp2BuildTestCase(t, registerCcLibraryStaticModuleTypes, tc)
} }

View File

@@ -27,6 +27,7 @@ func registerCcObjectModuleTypes(ctx android.RegistrationContext) {
} }
func runCcObjectTestCase(t *testing.T, tc bp2buildTestCase) { func runCcObjectTestCase(t *testing.T, tc bp2buildTestCase) {
t.Helper()
runBp2BuildTestCase(t, registerCcObjectModuleTypes, tc) runBp2BuildTestCase(t, registerCcObjectModuleTypes, tc)
} }

View File

@@ -8,6 +8,7 @@ import (
) )
func runPythonTestCase(t *testing.T, tc bp2buildTestCase) { func runPythonTestCase(t *testing.T, tc bp2buildTestCase) {
t.Helper()
runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, tc) runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, tc)
} }

View File

@@ -49,6 +49,7 @@ func TestShBinaryLoadStatement(t *testing.T) {
} }
func runShBinaryTestCase(t *testing.T, tc bp2buildTestCase) { func runShBinaryTestCase(t *testing.T, tc bp2buildTestCase) {
t.Helper()
runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, tc) runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, tc)
} }