tests/thirdparty: fix and run as github workflow (#198)
As part of fixing failing third-party tests, this PR significantly rearchitects their specification and execution. Third-party tests are now specified in a much more flexible format allowing more customization on a per-package level. In addition, third-party tests are now used to auto-generate a Github Actions workflow to perform the tests in parallel. This not only gives faster feedback on PRs, but will also allow us to more quickly narrow down on which packages are failing. An additional workflow also confirms that local execution of third-party tests is consistent with the Github Actions version. This workflow only runs when tests/thirdparty itself is changed.
This commit is contained in:
committed by
GitHub
parent
b935256fa5
commit
8ff8e3b751
@@ -13,8 +13,11 @@ import (
|
||||
// any errors to be stored so they can be checked at the end, rather than having
|
||||
// error checks obscuring the code generation.
|
||||
type Generator struct {
|
||||
buf bytes.Buffer
|
||||
err error
|
||||
buf bytes.Buffer
|
||||
level int // current indentation level
|
||||
indent string // indentation string
|
||||
pending bool // if there's a pending indentation
|
||||
err error // saved error from printing
|
||||
}
|
||||
|
||||
// Raw provides direct access to the underlying output stream.
|
||||
@@ -22,11 +25,38 @@ func (g *Generator) Raw() io.Writer {
|
||||
return &g.buf
|
||||
}
|
||||
|
||||
// SetIndentString sets the string used for one level of indentation. Use
|
||||
// Indent() and Dedent() to control indent level.
|
||||
func (g *Generator) SetIndentString(indent string) {
|
||||
g.indent = indent
|
||||
}
|
||||
|
||||
// Indent increments the indent level.
|
||||
func (g *Generator) Indent() {
|
||||
g.level++
|
||||
}
|
||||
|
||||
// Dedent decrements the indent level.
|
||||
func (g *Generator) Dedent() {
|
||||
g.level--
|
||||
}
|
||||
|
||||
// Linef prints formatted output terminated with a new line.
|
||||
func (g *Generator) Linef(format string, args ...interface{}) {
|
||||
g.Printf(format, args...)
|
||||
g.NL()
|
||||
}
|
||||
|
||||
// Printf prints to the internal buffer.
|
||||
func (g *Generator) Printf(format string, args ...interface{}) {
|
||||
if g.err != nil {
|
||||
return
|
||||
}
|
||||
if g.pending {
|
||||
indent := strings.Repeat(g.indent, g.level)
|
||||
format = indent + format
|
||||
g.pending = false
|
||||
}
|
||||
_, err := fmt.Fprintf(&g.buf, format, args...)
|
||||
g.AddError(err)
|
||||
}
|
||||
@@ -34,6 +64,7 @@ func (g *Generator) Printf(format string, args ...interface{}) {
|
||||
// NL prints a new line.
|
||||
func (g *Generator) NL() {
|
||||
g.Printf("\n")
|
||||
g.pending = true
|
||||
}
|
||||
|
||||
// Comment writes comment lines prefixed with "// ".
|
||||
|
||||
Reference in New Issue
Block a user