]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "all: test adjustments for the iOS builder"
authorElias Naur <elias.naur@gmail.com>
Wed, 1 Feb 2017 18:54:03 +0000 (19:54 +0100)
committerElias Naur <elias.naur@gmail.com>
Sat, 4 Mar 2017 00:01:14 +0000 (00:01 +0000)
This reverts commit 467109bf56fb560d1fd8a27c6184dbfe4f64ffef.

Replaced by a improved strategy later in the CL relation chain.

Change-Id: Ib90813b5a6c4716b563c8496013d2d57f9c022b8
Reviewed-on: https://go-review.googlesource.com/36066
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

misc/ios/go_darwin_arm_exec.go
src/compress/bzip2/bzip2_test.go
src/go/doc/doc_test.go
src/go/parser/performance_test.go
src/os/os_test.go

index 493820315fee16a432d7a7d7ef535189edbc5d29..fce71a0597c576e9f5ee65622d6ade97f6ccfbe2 100644 (file)
@@ -525,11 +525,13 @@ func copyLocalData(dstbase string) (pkgpath string, err error) {
 
        // Copy timezone file.
        //
-       // Apps have the zoneinfo.zip in the root of their app bundle,
+       // Typical apps have the zoneinfo.zip in the root of their app bundle,
        // read by the time package as the working directory at initialization.
+       // As we move the working directory to the GOROOT pkg directory, we
+       // install the zoneinfo.zip file in the pkgpath.
        if underGoRoot {
                err := cp(
-                       dstbase,
+                       filepath.Join(dstbase, pkgpath),
                        filepath.Join(cwd, "lib", "time", "zoneinfo.zip"),
                )
                if err != nil {
index 95fb18958561b311a6d545cdc4cb976f34ab6cf4..a6c3080db3efe5f49467b28e703aed888e560b02 100644 (file)
@@ -204,6 +204,12 @@ func TestMTF(t *testing.T) {
        }
 }
 
+var (
+       digits = mustLoadFile("testdata/e.txt.bz2")
+       twain  = mustLoadFile("testdata/Mark.Twain-Tom.Sawyer.txt.bz2")
+       random = mustLoadFile("testdata/random.data.bz2")
+)
+
 func benchmarkDecode(b *testing.B, compressed []byte) {
        // Determine the uncompressed size of testfile.
        uncompressedSize, err := io.Copy(ioutil.Discard, NewReader(bytes.NewReader(compressed)))
@@ -221,18 +227,6 @@ func benchmarkDecode(b *testing.B, compressed []byte) {
        }
 }
 
-func BenchmarkDecodeDigits(b *testing.B) {
-       digits := mustLoadFile("testdata/e.txt.bz2")
-       b.ResetTimer()
-       benchmarkDecode(b, digits)
-}
-func BenchmarkDecodeTwain(b *testing.B) {
-       twain := mustLoadFile("testdata/Mark.Twain-Tom.Sawyer.txt.bz2")
-       b.ResetTimer()
-       benchmarkDecode(b, twain)
-}
-func BenchmarkDecodeRand(b *testing.B) {
-       random := mustLoadFile("testdata/random.data.bz2")
-       b.ResetTimer()
-       benchmarkDecode(b, random)
-}
+func BenchmarkDecodeDigits(b *testing.B) { benchmarkDecode(b, digits) }
+func BenchmarkDecodeTwain(b *testing.B)  { benchmarkDecode(b, twain) }
+func BenchmarkDecodeRand(b *testing.B)   { benchmarkDecode(b, random) }
index 82e63100d4764d68516070e2e0e7fec2ac314011..ad8ba5378f3f13f7db193b5416bebb4439d0c18c 100644 (file)
@@ -25,7 +25,7 @@ var files = flag.String("files", "", "consider only Go test files matching this
 
 const dataDir = "testdata"
 
-var templateTxt *template.Template
+var templateTxt = readTemplate("template.txt")
 
 func readTemplate(filename string) *template.Template {
        t := template.New(filename)
@@ -96,9 +96,6 @@ func test(t *testing.T, mode Mode) {
        if err != nil {
                t.Fatal(err)
        }
-       if templateTxt == nil {
-               templateTxt = readTemplate("template.txt")
-       }
 
        // test packages
        for _, pkg := range pkgs {
index b2e1c11e9d538ed6c317e07740ce03c0d64f7866..f2732c0e2b18d142c121d98bf22de920f4b57eef 100644 (file)
@@ -10,12 +10,17 @@ import (
        "testing"
 )
 
-func BenchmarkParse(b *testing.B) {
-       src, err := ioutil.ReadFile("parser.go")
+var src = readFile("parser.go")
+
+func readFile(filename string) []byte {
+       data, err := ioutil.ReadFile(filename)
        if err != nil {
-               b.Fatal(err)
+               panic(err)
        }
-       b.ResetTimer()
+       return data
+}
+
+func BenchmarkParse(b *testing.B) {
        b.SetBytes(int64(len(src)))
        for i := 0; i < b.N; i++ {
                if _, err := ParseFile(token.NewFileSet(), "", src, ParseComments); err != nil {
index a03aeb84dcd1f6bd6e1a098875e8d405799424b5..a88ba548212677c4acfd04339639d7901500d865 100644 (file)
@@ -55,15 +55,12 @@ var sysdir = func() *sysDir {
        case "darwin":
                switch runtime.GOARCH {
                case "arm", "arm64":
-                       /// At this point the test harness has not had a chance
-                       // to move us into the ./src/os directory, so the
-                       // current working directory is the root of the app.
                        wd, err := syscall.Getwd()
                        if err != nil {
                                wd = err.Error()
                        }
                        return &sysDir{
-                               wd,
+                               filepath.Join(wd, "..", ".."),
                                []string{
                                        "ResourceRules.plist",
                                        "Info.plist",