Skip to content

Commit 07081a0

Browse files
authored
Merge pull request #1 from jandelgado/add_integration_test
add integration test
2 parents 8acbd4d + c10b832 commit 07081a0

File tree

6 files changed

+50
-9
lines changed

6 files changed

+50
-9
lines changed

.github/workflows/test_and_build.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,21 @@ jobs:
4848
- name: upload artifacts
4949
uses: actions/upload-artifact@master
5050
with:
51-
name: binaries
51+
name: bin
5252
path: bin/
53+
54+
inttest:
55+
name: End-to-end integration test
56+
needs: build
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout code
60+
uses: actions/checkout@v1
61+
- name: Download binary from build stage
62+
uses: actions/download-artifact@v1
63+
with:
64+
name: bin
65+
- name: Run test
66+
run: |
67+
chmod 755 bin/gcov2lcov
68+
make inttest

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*~
22
*.exe
33
bin/
4-
*.out
4+
coverage.out
5+
coverage.lcov

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
# makefile for gcov2lcov
2+
.PHONY: build test inttest
3+
14
build:
25
go build -o bin/gcov2lcov .
36

47
test:
58
go test ./... -coverprofile coverage.out
69
go tool cover -func coverage.out
10+
11+
inttest:
12+
./bin/gcov2lcov -infile testdata/coverage.out -outfile coverage.lcov
13+
diff testdata/coverage_expected.lcov coverage.lcov
14+

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# gcov2lcov
22

3-
Convert golang test coverage to lcov format (which can be uploaded to
4-
coveralls).
3+
Convert golang test coverage to lcov format (which can for example be uploaded
4+
to coveralls).
55

6-
See [gcov2lcov-action](https://github.com/jandelgado/gcov2lcov-action)
7-
for an github action which uses this tool.
6+
See [gcov2lcov-action](https://github.com/jandelgado/gcov2lcov-action)
7+
for a github action which uses this tool.
88

99
## Credits
1010

@@ -23,19 +23,21 @@ Usage of ./gcov2lcov:
2323

2424
### Example
2525

26-
```
26+
```sh
2727
$ go test -coverprofile=coverage.out && \
2828
gcov2lcov -inputfile=coverage.out -outfile=coverage.lcov
2929
```
3030

3131
## Build and Test
3232

33-
Run `make test` or `make build`.
33+
* `make test` to run unit tests
34+
* `make build` to build binary in `bin/` directory
35+
* `make inttest` to run unit integration test
3436

3537
## Author
3638

3739
Jan Delgado
3840

39-
## License
41+
## License
4042

4143
MIT

testdata/coverage.out

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mode: set
2+
github.com/jandelgado/gcov2lcov/main.go:45.44,49.38 4 1
3+
github.com/jandelgado/gcov2lcov/main.go:58.2,58.32 1 1

testdata/coverage_expected.lcov

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
TN:
2+
SF:main.go
3+
DA:45,1
4+
DA:46,1
5+
DA:47,1
6+
DA:48,1
7+
DA:49,1
8+
DA:58,1
9+
LF:6
10+
LH:6
11+
end_of_record

0 commit comments

Comments
 (0)