diff options
author | Fabricio Voznika <fvoznika@google.com> | 2020-08-12 14:21:04 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-08-12 14:23:29 -0700 |
commit | 00b684ea7fd96beb32d1517dd06c5d736621ff70 (patch) | |
tree | f972b8f8e3d2eefaff253bddba175a5441a577c8 /test/runner/gtest | |
parent | d797f2666629737920b39a2fbac369ce5853dc35 (diff) |
Limit the scope when deleting test log directory on success
The code was deleting logs for all tests when a single test
passed. Change it to delete only the logs relevant to the
test at hand.
Also fixed the benchmark lookup code, which was always generating
a single empty benchmark entry if there were not benchmarks.
PiperOrigin-RevId: 326311477
Diffstat (limited to 'test/runner/gtest')
-rw-r--r-- | test/runner/gtest/gtest.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/runner/gtest/gtest.go b/test/runner/gtest/gtest.go index 869169ad5..e4445e01b 100644 --- a/test/runner/gtest/gtest.go +++ b/test/runner/gtest/gtest.go @@ -146,10 +146,13 @@ func ParseTestCases(testBin string, benchmarks bool, extraArgs ...string) ([]Tes return nil, fmt.Errorf("could not enumerate gtest benchmarks: %v\nstderr\n%s", err, exitErr.Stderr) } - out = []byte(strings.Trim(string(out), "\n")) + benches := strings.Trim(string(out), "\n") + if len(benches) == 0 { + return t, nil + } // Parse benchmark output. - for _, line := range strings.Split(string(out), "\n") { + for _, line := range strings.Split(benches, "\n") { // Strip comments. line = strings.Split(line, "#")[0] @@ -163,6 +166,5 @@ func ParseTestCases(testBin string, benchmarks bool, extraArgs ...string) ([]Tes benchmark: true, }) } - return t, nil } |