Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8cf2584ce5 |
@@ -19,6 +19,10 @@ type File struct {
|
|||||||
Binary string
|
Binary string
|
||||||
Sources string
|
Sources string
|
||||||
|
|
||||||
|
// MaxOutput caps captured stdout/stderr per test (bytes). Zero means use the
|
||||||
|
// runner default. Raise it for suites whose expected output is large.
|
||||||
|
MaxOutput int64
|
||||||
|
|
||||||
NormalizeCRLF bool
|
NormalizeCRLF bool
|
||||||
TrimTrailingWS bool
|
TrimTrailingWS bool
|
||||||
|
|
||||||
|
|||||||
@@ -307,6 +307,17 @@ func (p *Parser) parseFile() (*File, error) {
|
|||||||
}
|
}
|
||||||
f.MemoryLimit = n
|
f.MemoryLimit = n
|
||||||
|
|
||||||
|
case "max_output":
|
||||||
|
p.advance()
|
||||||
|
if _, err := p.expect(TOKEN_ASSIGN); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
n, err := p.parseSize()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
f.MaxOutput = n
|
||||||
|
|
||||||
case "group":
|
case "group":
|
||||||
g, err := p.parseGroup(f.Timeout, f.MemoryLimit)
|
g, err := p.parseGroup(f.Timeout, f.MemoryLimit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -37,6 +37,24 @@ group("g") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestParseMaxOutput(t *testing.T) {
|
||||||
|
src := `
|
||||||
|
build "make"
|
||||||
|
max_output = 64M
|
||||||
|
group("g") {
|
||||||
|
weight = 1.0
|
||||||
|
test("t") { stdout = "ok\n" }
|
||||||
|
}
|
||||||
|
`
|
||||||
|
f, _, err := Parse(src)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("parse: %v", err)
|
||||||
|
}
|
||||||
|
if f.MaxOutput != 64*1024*1024 {
|
||||||
|
t.Errorf("MaxOutput = %d, want %d", f.MaxOutput, 64*1024*1024)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestParsePatternStageAllMode(t *testing.T) {
|
func TestParsePatternStageAllMode(t *testing.T) {
|
||||||
src := `
|
src := `
|
||||||
build "make"
|
build "make"
|
||||||
|
|||||||
@@ -488,8 +488,12 @@ func (r *Runner) runTest(t *dsl.Test) *TestResult {
|
|||||||
cmd.Stdin = strings.NewReader(*t.Stdin)
|
cmd.Stdin = strings.NewReader(*t.Stdin)
|
||||||
}
|
}
|
||||||
|
|
||||||
stdout := &cappedBuffer{limit: MaxOutputBytes}
|
outLimit := MaxOutputBytes
|
||||||
stderr := &cappedBuffer{limit: MaxOutputBytes}
|
if r.file.MaxOutput > 0 {
|
||||||
|
outLimit = int(r.file.MaxOutput)
|
||||||
|
}
|
||||||
|
stdout := &cappedBuffer{limit: outLimit}
|
||||||
|
stderr := &cappedBuffer{limit: outLimit}
|
||||||
cmd.Stdout = stdout
|
cmd.Stdout = stdout
|
||||||
cmd.Stderr = stderr
|
cmd.Stderr = stderr
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user