var globalSkip … var ( gopathInstallDir … gorootInstallDir … ) var oldGOROOT … var minpkgs … var soname … var testX … var testWork … // run runs a command and calls t.Errorf if it fails. func run(t *testing.T, msg string, args ...string) { … } // runWithEnv runs a command under the given environment and calls t.Errorf if it fails. func runWithEnv(t *testing.T, msg string, env []string, args ...string) { … } // goCmd invokes the go tool with the installsuffix set up by TestMain. It calls // t.Fatalf if the command fails. func goCmd(t *testing.T, args ...string) string { … } // TestMain calls testMain so that the latter can use defer (TestMain exits with os.Exit). func testMain(m *testing.M) (int, error) { … } func TestMain(m *testing.M) { … } // cloneTestdataModule clones the packages from src/testshared into gopath. // It returns the directory within gopath at which the module root is located. func cloneTestdataModule(gopath string) (string, error) { … } // cloneGOROOTDeps copies (or symlinks) the portions of GOROOT/src and // GOROOT/pkg relevant to this test into the given directory. // It must be run from within the testdata module. func cloneGOROOTDeps(goroot string) error { … } // The shared library was built at the expected location. func TestSOBuilt(t *testing.T) { … } func hasDynTag(f *elf.File, tag elf.DynTag) bool { … } // The shared library does not have relocations against the text segment. func TestNoTextrel(t *testing.T) { … } // The shared library does not contain symbols called ".dup" // (See golang.org/issue/14841.) func TestNoDupSymbols(t *testing.T) { … } // The install command should have created a "shlibname" file for the // listed packages (and runtime/cgo, and math on arm) indicating the // name of the shared library containing it. func TestShlibnameFiles(t *testing.T) { … } // Is a given offset into the file contained in a loaded segment? func isOffsetLoaded(f *elf.File, offset uint64) bool { … } func rnd(v int32, r int32) int32 { … } func readwithpad(r io.Reader, sz int32) ([]byte, error) { … } type note … // Read all notes from f. As ELF section names are not supposed to be special, one // looks for a particular note by scanning all SHT_NOTE sections looking for a note // with a particular "name" and "tag". func readNotes(f *elf.File) ([]*note, error) { … } func dynStrings(t *testing.T, path string, flag elf.DynTag) []string { … } func AssertIsLinkedToRegexp(t *testing.T, path string, re *regexp.Regexp) { … } func AssertIsLinkedTo(t *testing.T, path, lib string) { … } func AssertHasRPath(t *testing.T, path, dir string) { … } // Build a trivial program that links against the shared runtime and check it runs. func TestTrivialExecutable(t *testing.T) { … } // Build a trivial program in PIE mode that links against the shared runtime and check it runs. func TestTrivialExecutablePIE(t *testing.T) { … } // Check that the file size does not exceed a limit. func checkSize(t *testing.T, f string, limit int64) { … } // Build a division test program and check it runs. func TestDivisionExecutable(t *testing.T) { … } // Build an executable that uses cgo linked against the shared runtime and check it // runs. func TestCgoExecutable(t *testing.T) { … } func checkPIE(t *testing.T, name string) { … } func TestTrivialPIE(t *testing.T) { … } func TestCgoPIE(t *testing.T) { … } // Build a GOPATH package into a shared library that links against the goroot runtime // and an executable that links against both. func TestGopathShlib(t *testing.T) { … } // The shared library contains a note listing the packages it contains in a section // that is not mapped into memory. func testPkgListNote(t *testing.T, f *elf.File, note *note) { … } // The shared library contains a note containing the ABI hash that is mapped into // memory and there is a local symbol called go.link.abihashbytes that points 16 // bytes into it. func testABIHashNote(t *testing.T, f *elf.File, note *note) { … } // A Go shared library contains a note indicating which other Go shared libraries it // was linked against in an unmapped section. func testDepsNote(t *testing.T, f *elf.File, note *note) { … } // The shared library contains notes with defined contents; see above. func TestNotes(t *testing.T) { … } // Build a GOPATH package (depBase) into a shared library that links against the goroot // runtime, another package (dep2) that links against the first, and an // executable that links against dep2. func TestTwoGopathShlibs(t *testing.T) { … } func TestThreeGopathShlibs(t *testing.T) { … } // If gccgo is not available or not new enough, call t.Skip. func requireGccgo(t *testing.T) { … } // Build a GOPATH package into a shared library with gccgo and an executable that // links against it. func TestGoPathShlibGccgo(t *testing.T) { … } // The gccgo version of TestTwoGopathShlibs: build a GOPATH package into a shared // library with gccgo, another GOPATH package that depends on the first and an // executable that links the second library. func TestTwoGopathShlibsGccgo(t *testing.T) { … } var oldTime … var nearlyNew … var stampTime … // resetFileStamps makes "everything" (bin, src, pkg from GOPATH and the // test-specific parts of GOROOT) appear old. func resetFileStamps() { … } // touch changes path and returns a function that changes it back. // It also sets the time of the file, so that we can see if it is rewritten. func touch(t *testing.T, path string) (cleanup func()) { … } // isNew returns if the path is newer than the time stamp used by touch. func isNew(t *testing.T, path string) bool { … } // Fail unless path has been rebuilt (i.e. is newer than the time stamp used by // isNew) func AssertRebuilt(t *testing.T, msg, path string) { … } // Fail if path has been rebuilt (i.e. is newer than the time stamp used by isNew) func AssertNotRebuilt(t *testing.T, msg, path string) { … } func TestRebuilding(t *testing.T) { … } func appendFile(t *testing.T, path, content string) { … } func createFile(t *testing.T, path, content string) { … } func TestABIChecking(t *testing.T) { … } // If a package 'explicit' imports a package 'implicit', building // 'explicit' into a shared library implicitly includes implicit in // the shared library. Building an executable that imports both // explicit and implicit builds the code from implicit into the // executable rather than fetching it from the shared library. The // link still succeeds and the executable still runs though. func TestImplicitInclusion(t *testing.T) { … } // Tests to make sure that the type fields of empty interfaces and itab // fields of nonempty interfaces are unique even across modules, // so that interface equality works correctly. func TestInterface(t *testing.T) { … } // Access a global variable from a library. func TestGlobal(t *testing.T) { … } // Run a test using -linkshared of an installed shared package. // Issue 26400. func TestTestInstalledShared(t *testing.T) { … } // Test generated pointer method with -linkshared. // Issue 25065. func TestGeneratedMethod(t *testing.T) { … } // Test use of shared library struct with generated hash function. // Issue 30768. func TestGeneratedHash(t *testing.T) { … } // Test that packages can be added not in dependency order (here a depends on b, and a adds // before b). This could happen with e.g. go build -buildmode=shared std. See issue 39777. func TestPackageOrder(t *testing.T) { … } // Test that GC data are generated correctly by the linker when it needs a type defined in // a shared library. See issue 39927. func TestGCData(t *testing.T) { … } // Test that we don't decode type symbols from shared libraries (which has no data, // causing panic). See issue 44031. func TestIssue44031(t *testing.T) { … } // Test that we use a variable from shared libraries (which implement an // interface in shared libraries.). A weak reference is used in the itab // in main process. It can cause unreachable panic. See issue 47873. func TestIssue47873(t *testing.T) { … } func TestIssue62277(t *testing.T) { … } // Test that we can build std in shared mode. func TestStd(t *testing.T) { … }