Skip to content

Commit

Permalink
PR: naming, script args
Browse files Browse the repository at this point in the history
Removed underscore from consts
Removed unneeded constants
Added flag to test-lcow-uvm script to change boot type from vhd to
initrd.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
  • Loading branch information
helsaawy committed Jun 7, 2022
1 parent fdba25d commit 250caae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
24 changes: 15 additions & 9 deletions scripts/Test-LCOW-UVM.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ex: .\scripts\Test-LCOW-UVM.ps1 -vb -Action Bench -BootFilesPath C:\ContainerPlat\LinuxBootFiles\ -MountGCSTest -Count 2 -Benchtime '3s'
#ex: .\scripts\Test-LCOW-UVM.ps1 -vb -Action Bench -BootFilesPath C:\ContainerPlat\LinuxBootFiles\ -MountGCSTest -Count 2 -Benchtime '3s'
# benchstat via `go install golang.org/x/perf/cmd/benchstat@latest`

[CmdletBinding()]
Expand Down Expand Up @@ -35,18 +35,24 @@ param (
$OutDirectory = '.\test\results',

# uvm parameters

[string]
$BootFilesPath = 'C:\ContainerPlat\LinuxBootFiles',

[ValidateSet('vhd', 'initrd')]
[string]
$BootFSType = 'vhd',

[switch]
$DisableTimeSync,

# gcs test/container options

[string]
$RootfsMount = '/run/rootfs',
$ContainerRootFSMount = '/run/rootfs',

[string]
$RootfsPath = (Join-Path $BootFilesPath 'rootfs.vhd'),
# $RootfsPath = "C:\ContainerPlatData\root\io.containerd.snapshotter.v1.windows-lcow\snapshots\2\layer.vhd",
$ContainerRootFSPath = (Join-Path $BootFilesPath 'rootfs.vhd'),

[string]
$GCSTestMount = '/run/bin',
Expand All @@ -66,7 +72,7 @@ Import-Module ( Join-Path $PSScriptRoot Testing.psm1 ) -Force
$CodePath = Resolve-Path $CodePath
$OutDirectory = Resolve-Path $OutDirectory
$BootFilesPath = Resolve-Path $BootFilesPath
$RootfsPath = Resolve-Path $RootfsPath
$ContainerRootFSPath = Resolve-Path $ContainerRootFSPath
$GCSTestPath = Resolve-Path $GCSTestPath

$shell = ( $Action -eq 'Shell' )
Expand All @@ -75,7 +81,7 @@ if ( $shell ) {
$cmd = 'ash'
} else {
$date = Get-Date
$waitfiles = "$RootfsMount"
$waitfiles = "$ContainerRootFSMount"
$gcspath = 'gcstest'
if ( $MountGCSTest ) {
$waitfiles += ",$GCSTestMount"
Expand Down Expand Up @@ -106,17 +112,17 @@ if ( $shell ) {
-Feature $Feature `
-Verbose:$Verbose

$testcmd += " `'-rootfs-path=$RootfsMount`' "
$testcmd += " `'-rootfs-path=$ContainerRootFSMount`' "
$cmd = $pre + $testcmd
}

$boot = '.\bin\tools\uvmboot.exe -gcs lcow ' + `
'-fwd-stdout -fwd-stderr -output-handling stdout ' + `
"-boot-files-path $BootFilesPath " + `
'-root-fs-type vhd ' + `
"-root-fs-type $BootFSType " + `
'-kernel-file vmlinux ' + `
"-security-policy=`"`" " + `
"-mount `"$RootfsPath,$RootfsMount`" "
"-mount `"$ContainerRootFSPath,$ContainerRootFSMount`" "

if ( $MountGCSTest ) {
$boot += "-share `"$GCSTestPath,$GCSTestMount`" "
Expand Down
11 changes: 4 additions & 7 deletions test/gcs/helper_conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ import (
)

const (
_network = "unix"
_sockPathFmt = "/tmp/gcs.%d"

_dialRetries = 4
_dialWait = 50 * time.Millisecond
dialRetries = 4
dialWait = 50 * time.Millisecond
)

// port numbers to assign to connections
Expand All @@ -38,12 +35,12 @@ type PipeTransport struct{}
var _ transport.Transport = &PipeTransport{}

func (t *PipeTransport) Dial(port uint32) (c transport.Connection, err error) {
for i := 0; i < _dialRetries; i++ {
for i := 0; i < dialRetries; i++ {
c, err = getFakeSocket(port)

switch {
case errors.Is(err, unix.ENOENT): // socket hasn't been created
time.Sleep(_dialWait)
time.Sleep(dialWait)
continue
}
break
Expand Down

0 comments on commit 250caae

Please sign in to comment.