test vmware workstation version checking
This commit is contained in:
parent
a4518f8ac8
commit
07421b4433
|
@ -66,14 +66,17 @@ func workstationVerifyVersion(version string) error {
|
|||
if err := cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
return workstationTestVersion(version, stderr.String())
|
||||
}
|
||||
|
||||
func workstationTestVersion(wanted, versionOutput string) error {
|
||||
versionRe := regexp.MustCompile(`(?i)VMware Workstation (\d+)\.`)
|
||||
matches := versionRe.FindStringSubmatch(stderr.String())
|
||||
matches := versionRe.FindStringSubmatch(versionOutput)
|
||||
if matches == nil {
|
||||
return fmt.Errorf(
|
||||
"Could not find VMware WS version in output: %s", stderr.String())
|
||||
"Could not find VMware WS version in output: %s", wanted)
|
||||
}
|
||||
log.Printf("Detected VMware WS version: %s", matches[1])
|
||||
|
||||
return compareVersions(matches[1], version, "Workstation")
|
||||
return compareVersions(matches[1], wanted, "Workstation")
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// +build !windows
|
||||
|
||||
package common
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestWorkstationVersion_ws14(t *testing.T) {
|
||||
input := `VMware Workstation Information:
|
||||
VMware Workstation 14.1.1 build-7528167 Release`
|
||||
if err := workstationTestVersion("10", input); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue