mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +01:00
Add coverage for integration test to checker
This commit is contained in:
parent
85447c20b7
commit
7a1d26e3fd
2 changed files with 30 additions and 2 deletions
|
|
@ -353,12 +353,12 @@ func check(err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func realMain(args []string) {
|
||||||
var opts options
|
var opts options
|
||||||
|
|
||||||
parser := flags.NewParser(&opts, flags.Default)
|
parser := flags.NewParser(&opts, flags.Default)
|
||||||
|
|
||||||
args, err := parser.Parse()
|
args, err := parser.ParseArgs(args)
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
if opts.Version {
|
if opts.Version {
|
||||||
|
|
@ -407,3 +407,7 @@ func main() {
|
||||||
check(p.process(arg))
|
check(p.process(arg))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
realMain(os.Args[1:])
|
||||||
|
}
|
||||||
|
|
|
||||||
24
cmd/csaf_uploader/main_test.go
Normal file
24
cmd/csaf_uploader/main_test.go
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// call realMain() with Args that skip over params used by "go test"
|
||||||
|
// allow calls like
|
||||||
|
// go test -c -vet=off -covermode=atomic -o csaf_uploader.debug
|
||||||
|
// ./csaf_uploader.debug -test.coverprofile=/tmp/csaf_uploader-itest-${EPOCHREALTIME}.cov -- --insecure ....
|
||||||
|
func TestMain(t *testing.T) {
|
||||||
|
var endOfTestParams int
|
||||||
|
for i, a := range os.Args[1:] {
|
||||||
|
if a == "--" {
|
||||||
|
endOfTestParams = i + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if endOfTestParams == 0 {
|
||||||
|
t.Skip("skipping integration test, no `--` parameter found")
|
||||||
|
}
|
||||||
|
realMain(os.Args[endOfTestParams+1:])
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue