Skip to content

cmd/compile: new codegen test harness too verbose in case of failure #24216

@ALTree

Description

@ALTree

(I know it's not finished, but recording here since I'm poking at it).

The new code generation harness introduced in CL 97355 (and refined in subsequent CL) is more verbose than the current one in case of failures. The main issue is that the whole disasm output is dumped to file. Take the following test (func f is supposed to fail):

// asmcheck

package codegen

func f(x float64) float64 {
	// amd64:"NOPE"
	return x + 1
}

func g(x float64) float64 {
	// amd64:"ADD"
	return x + 2
}

func h(x float64) float64 {
	// amd64:"ADD"
	return x + 3
}

The FAIL message dumps the whole file's disasm to std, including

  1. the disassembly of all the functions in the file, including g and h, where we don't have any failure
  2. a long tail of dwarf info and friends. (small sample):
go.info."".f SDWARFINFO size=55
	0x0000 02 22 22 2e 66 00 00 00 00 00 00 00 00 00 00 00  ."".f...........
	0x0010 00 00 00 00 00 00 01 9c 00 00 00 00 01 0e 78 00  ..............x.
	0x0020 00 05 00 00 00 00 01 9c 0e 7e 72 31 00 01 05 00  .........~r1....
	0x0030 00 00 00 02 91 08 00                             .......
	rel 6+8 t=1 "".f+0
	rel 14+8 t=1 "".f+25
	rel 24+4 t=29 gofile../home/alberto/go/test/codegen/intrinsics.go+0
	rel 34+4 t=28 go.info.float64+0
	rel 47+4 t=28 go.info.float64+0

The current test harness only prints the disasm of the function included in the failing check, making the failure message much more easier to read.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions