Commit Graph

314 Commits

Author SHA1 Message Date
d6bf22343d parser/gotest: Move event processing into reportBuilder 2022-08-13 20:48:36 +01:00
0fc43a220a internal/gojunitreport: Refactor testFileConfig to drop else block 2022-08-13 20:48:36 +01:00
ddf6b16828 Replace += 1 with ++ 2022-08-13 20:48:31 +01:00
fbfb33add1 junit: Use consistent receiver name 2022-08-13 20:47:42 +01:00
5616b5e921 Add missing godoc on exported types 2022-08-11 00:47:46 +01:00
066da07a49 Add go1.19 and remove go1.17 from workflow 2022-08-03 23:43:25 +01:00
d75fb6d4c3 parser/gotest: Remove unused runErrors field from reportBuilder 2022-07-20 14:29:24 +01:00
01f2cdde22 parser/gotest: Use the new LimitedLineReader in the gotest parser 2022-07-18 23:02:22 +01:00
3e3223a05b parser/gotest: Create LimitedLineReader 2022-07-18 22:38:36 +01:00
80a51f2ed0 parser/gotest: Move const declaration to top of file 2022-07-18 22:37:49 +01:00
3d712f2417 junit: Don't include File attribute when it's empty 2022-07-07 00:19:59 +01:00
03010d4a32 junit: Add File attribute to testsuite
Closes #113
2022-07-07 00:18:30 +01:00
88ec9224c5 Fix broken pkg.go.dev links in README 2022-07-02 22:00:11 +01:00
fca6708da0 Add v2.0.0 changelog to README 2022-07-02 14:21:31 +01:00
dfab75c90e Update install from source instructions in README
Refs #136
2022-07-01 23:16:44 +01:00
7fde4641ac Use ioutil package for compatibility with Go 1.13
We specify 1.13 in go.mod, so we should make sure it can be built and
tested on that version. Let's keep using the ioutil package for now,
since it was only deprecated from 1.16.
v2.0.0
2022-07-01 22:53:57 +01:00
19190fdfd3 Add min supported and two most recent Go versions to workflow 2022-07-01 22:47:55 +01:00
63e0c8be15 junit: Improve test coverage of junit.CreateFromReport 2022-06-26 14:55:54 +01:00
f643780c47 parser/gotest: Add tests for internal package collector 2022-06-26 14:23:58 +01:00
079e5ce7ea parser/gotest: Add support for parsing lines longer than 64K
The gotest parser used a bufio.Scanner to read its input, which
prevented us from reading lines larger than 64K.

In order to support reading larger lines, bufio.Scanner has been
replaced with bufio.Reader. The maximum line size has been increased to
4MiB and instead of returning an error when reading lines that exceed
the maximum size, we truncate that line and continue parsing.

Fixes #135
2022-06-26 00:45:06 +01:00
7875e13422 parser/gotest: Move NewParser function below Parser struct 2022-06-26 00:43:55 +01:00
8648745762 parser/gotest: Don't ignore output when there were no tests
In some cases we may have captured some output for a package that didn't
have any tests. We should include it in the generated report as it may
contain useful information.
2022-06-26 00:43:05 +01:00
d84b41a3f9 Update gitub.com/google/go-cmp dependency to v0.5.8 2022-06-15 23:46:40 +01:00
da6551b8c0 gtr,parser/gotest: Remove gtr.Benchmark and use gtr.Test for all tests 2022-06-15 23:46:40 +01:00
dc591b8731 junit: Remove benchmark specific code from package junit
The junit package shouldn't need to know anything about benchmarks and
gtr.Benchmark will be removed in a future commit. Instead, it will be
the responsibility of the gotest parser to represent benchmarks using
gtr.Test.
2022-06-15 23:46:40 +01:00
46e0aed494 gtr: Also look at failures in benchmarks when creating a package
When we encounter a failure but there was not failing test, we create a
failing dummy test in the report. This is to prevent the failure from
being overlooked.

The case where the output contained a failing benchmark was not handled
correctly, resulting in a dummy test failure being added to the report
unnecessarily.
2022-06-13 00:47:28 +01:00
d05abd4130 junit: Include output in JUnit report for skipped and failed benchmarks 2022-06-13 00:34:20 +01:00
f1ad02b733 junit: Use the standard duration formatting for benchmark durations
Benchmark durations were originally formatted with higher precision
because they contained just the NsPerOp field. Now that we're
approximating the total duration they are more accurate and don't need
as many decimals.
2022-06-12 23:02:01 +01:00
1d905e0b1c gtr: Improve accuracy of benchmark duration calculation
The NsPerOp was previously casted to a time.Duration (int64) before
multiplying it with the number of iterations. This has been fixed by
doing the casting after the multiplication. The resulting duration
should be a bit more accurate.
2022-06-12 22:56:04 +01:00
9a1666d75c gtr,junit: Move Benchmark duration calculation to gtr package 2022-06-12 22:54:12 +01:00
cb055227b7 parser/gotest: Improve gotest output handling
The reportBuilder has been updated to use the ordered output collector
to keep track of go test output. This makes it possible to include
benchmark output in the generated report and makes sure that output is
preserved when deleting subtest parents from the report.
2022-06-08 23:01:01 +01:00
5331b9b8d6 parser/gotest: Create output collector that preserves the line order 2022-06-08 23:01:01 +01:00
d2480a6059 parser/gotest: Skip ID 0 when searching for existing tests or benchmarks 2022-06-08 23:01:01 +01:00
2f7bf7c3bc parser/gotest: Set unique Test, Benchmark and Error ID's
This will be used later to collect and store output for the right tests.
2022-06-08 23:01:01 +01:00
5d691c7896 testdata: Regenerate benchmark test data and add logging 2022-06-08 23:01:01 +01:00
b95e18cd5c gtr: Add ID fields to Test, Benchmark and Error structs
This can optionally be used to uniquely individual tests, benchmarks or
errors.
2022-06-08 23:01:01 +01:00
c87388ae59 parser/gotest,junit: Move benchmark grouping to parser/gotest package
Having multiple benchmarks for a single name is something specific to
the gotest output, so grouping benchmarks by name is not something that
belongs in the junit package.
2022-06-08 23:01:01 +01:00
f33a746c85 junit: Simplify the formatOutput function
This function was used in the past to perform some operations on the
individual output lines before joining them together. However, now it's
only used to combine the collection of lines into a single output
string.
2022-06-08 23:01:01 +01:00
395886ab94 Revert "internal: make timestampFunc private"
This reverts commit dcbbd9fb22 and fixes
testdata/generate-golden-reports.go.
2022-05-22 20:56:39 +01:00
84074a188c parser/gotest: remove debugging printf from reportBuilder 2022-05-22 00:50:12 +01:00
9ad16898a8 Add -subtest-mode flag to configure SubtestMode 2022-05-22 00:44:20 +01:00
1b7027fde7 parser/gotest: add SubtestMode to configure how to deal with subtests 2022-05-22 00:32:17 +01:00
6c038bc425 parser/gotest: never reset nextID in report builder to ensure unique ids 2022-05-21 23:29:24 +01:00
01f41237f7 parser/gotest: continue with next item when we find a test or benchmark 2022-05-21 23:19:41 +01:00
0655053883 junit: Move testcase creation from tests and benchmarks to functions 2022-05-21 23:06:44 +01:00
b4847b2e36 internal: move gotest.Options creation into separate function
The gotest and gojson parsers use the same options (for now). To avoid
duplication the list of parser options is created in a separate
function.
2022-05-21 22:44:38 +01:00
dcbbd9fb22 internal: make timestampFunc private 2022-05-21 22:42:36 +01:00
b5d2695c26 parser/gotest: return a separate bool instead of a negative id in find* 2022-05-21 22:26:00 +01:00
f97910c4b9 parser/gotest: Make reportBuilder options private 2022-05-21 22:16:55 +01:00
ae7e71c599 parser/gotest: rename Id -> ID 2022-05-21 18:48:07 +01:00