internal/licences: use relative path to open testdata

We don't need to do the extra work to construct the that's being done
in testDataPath because the test will be run in the directory of the
test file. In addition, this is broken on the android builders because
they build on a different machine than where the tests run.

For golang/go#61209

Change-Id: I066cde3d972e21d52240d9c518524569d60a65f7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/524798
kokoro-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/internal/licenses/licenses_test.go b/internal/licenses/licenses_test.go
index 0899e40..9d8e662 100644
--- a/internal/licenses/licenses_test.go
+++ b/internal/licenses/licenses_test.go
@@ -15,7 +15,6 @@
 	"os"
 	"path"
 	"path/filepath"
-	"runtime"
 	"sort"
 	"strings"
 	"testing"
@@ -229,18 +228,6 @@
 	Match:   []lc.Match{{ID: "MIT"}},
 }
 
-// testDataPath returns a path corresponding to a path relative to the calling
-// test file. For convenience, rel is assumed to be "/"-delimited.
-//
-// It panics on failure.
-func testDataPath(rel string) string {
-	_, filename, _, ok := runtime.Caller(1)
-	if !ok {
-		panic("unable to determine relative path")
-	}
-	return filepath.Clean(filepath.Join(filepath.Dir(filename), filepath.FromSlash(rel)))
-}
-
 func TestModuleIsRedistributable(t *testing.T) {
 	// More thorough tests of the helper functions are below. This end-to-end test covers
 	// a few key cases using actual zip files.
@@ -288,7 +275,7 @@
 		},
 	} {
 		t.Run(test.filename, func(t *testing.T) {
-			f, err := os.Open(filepath.Join(testDataPath("testdata"), test.filename+".zip"))
+			f, err := os.Open(filepath.Join("testdata", test.filename+".zip"))
 			if err != nil {
 				t.Fatal(err)
 			}