//     -failfast
 //         Do not start new tests after the first test failure.
 //
+//     -fullpath
+//         Show full file names in the error messages.
+//
 //     -fuzz regexp
 //         Run the fuzz test matching the regular expression. When specified,
 //         the command line argument must match exactly one package within the
 
        "cpu":                  true,
        "cpuprofile":           true,
        "failfast":             true,
+       "fullpath":             true,
        "fuzz":                 true,
        "fuzzminimizetime":     true,
        "fuzztime":             true,
 
        -failfast
            Do not start new tests after the first test failure.
 
+       -fullpath
+           Show full file names in the error messages.
+
        -fuzz regexp
            Run the fuzz test matching the regular expression. When specified,
            the command line argument must match exactly one package within the
 
        cf.StringVar(&testCPUProfile, "cpuprofile", "", "")
        cf.Bool("failfast", false, "")
        cf.StringVar(&testFuzz, "fuzz", "", "")
+       cf.Bool("fullpath", false, "")
        cf.StringVar(&testList, "list", "", "")
        cf.StringVar(&testMemProfile, "memprofile", "", "")
        cf.String("memprofilerate", "", "")
 
--- /dev/null
+[short] skip
+
+# test with -fullpath
+! go test ./x/... -fullpath
+stdout '^ +.+/gopath/src/x/fullpath/fullpath_test.go:8: test failed'
+# test without -fullpath
+! go test ./x/...
+stdout '^ +fullpath_test.go:8: test failed'
+
+-- go.mod --
+module example
+-- x/fullpath/fullpath_test.go --
+package fullpath_test
+
+import (
+       "testing"
+)
+
+func TestFullPath(t *testing.T) {
+       t.Error("test failed")
+}
 
        parallel = flag.Int("test.parallel", runtime.GOMAXPROCS(0), "run at most `n` tests in parallel")
        testlog = flag.String("test.testlogfile", "", "write test action log to `file` (for use only by cmd/go)")
        shuffle = flag.String("test.shuffle", "off", "randomize the execution order of tests and benchmarks")
+       fullPath = flag.Bool("test.fullpath", false, "show full file names in error messages")
 
        initBenchmarkFlags()
        initFuzzFlags()
        parallel             *int
        shuffle              *string
        testlog              *string
+       fullPath             *bool
 
        haveExamples bool // are there examples?
 
        file := frame.File
        line := frame.Line
        if file != "" {
-               // Truncate file name at last file name separator.
-               if index := strings.LastIndex(file, "/"); index >= 0 {
+               if *fullPath {
+                       // If relative path, truncate file name at last file name separator.
+               } else if index := strings.LastIndex(file, "/"); index >= 0 {
                        file = file[index+1:]
                } else if index = strings.LastIndex(file, "\\"); index >= 0 {
                        file = file[index+1:]