]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: adjust expectations of test for issue 18902
authorDavid Chase <drchase@google.com>
Mon, 30 Oct 2017 15:39:29 +0000 (11:39 -0400)
committerDavid Chase <drchase@google.com>
Mon, 30 Oct 2017 20:27:09 +0000 (20:27 +0000)
The test for #18902 reads the assembly stream to be sure
that the line number does not change too often (this is an
indication that debugging the code will be unpleasant and
that the compiler is probably getting line numbers "wrong").

It checks that it is getting "enough" input, but the
compiler has gotten enough better since the test was written
that it now fails for lack of enough input.  The old
threshould was 200 instructions, the new one is 150 (the
minimum observed input is on arm64 with 184 instructions).

Fixes #22494.

Change-Id: Ibba7e9ff4ab6a7be369e5dd5859d150b7db94653
Reviewed-on: https://go-review.googlesource.com/74357
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
test/fixedbugs/issue18902.go

index f5bca16a3240bb7e2f40eda6ed93f18bbaf0cece..9b85503eca8b5937bc7e5a5ac58d16f0ae0e8100 100644 (file)
@@ -56,7 +56,10 @@ func main() {
        cmd.Stderr = &buf
        cmd.Env = os.Environ()
 
-       updateEnv(&cmd.Env, "GOARCH", testarch)
+       if testarch != "" {
+               updateEnv(&cmd.Env, "GOARCH", testarch)
+               updateEnv(&cmd.Env, "GOOS", "linux") // Simplify multi-arch testing
+       }
 
        err := cmd.Run()
        if err != nil {
@@ -89,8 +92,9 @@ func main() {
                i = strings.Index(line, beforeLineNumber)
                if i < 0 {
                        // Done reading lines
-                       if scannedCount < 200 { // When test was written, 251 lines observed on amd64
-                               fmt.Printf("Scanned only %d lines, was expecting more than 200", scannedCount)
+                       const minLines = 150
+                       if scannedCount <= minLines { // When test was written, 251 lines observed on amd64; arm64 now obtains 184
+                               fmt.Printf("Scanned only %d lines, was expecting more than %d\n", int(scannedCount), minLines)
                                return
                        }
                        // Note: when test was written, before changes=92, after=50 (was 62 w/o rematerialization NoXPos in *Value.copyInto())