1.	Fixed issue in creating SQL query to upload multi test results.
2.	Fixed Debian distro detection.
3.	Added detection of Clear Linux OS.
4.	Reduced timeout for 'dmesg' command.
5.	Replaced write-host with LogMsg function to record logs.
This commit is contained in:
Shital Savekar 2018-04-18 14:21:34 -07:00
Родитель 356bd6a014
Коммит 628187af87
4 изменённых файлов: 20 добавлений и 17 удалений

Просмотреть файл

@ -467,6 +467,7 @@ Function RunTestsOnCycle ($cycleName , $xmlConfig, $Distro, $testIterations )
$dbpassword = $xmlSecrets.secrets.DatabasePassword
$database = $xmlSecrets.secrets.DatabaseName
$dataTableName = "AzureTestResultsMasterTable"
$dbTestName = $($currentTestData.testName)
$SQLQuery = "INSERT INTO $dataTableName (DateTimeUTC,Environment,TestCycle,ExecutionID,TestName,TestResult,ARMImage,OsVHD,KernelVersion,LISVersion,GuestDistro,AzureHost,Location,OverrideVMSize,Networking,LogFile,BuildURL) VALUES "
if ($testMode -eq "multi")
{
@ -478,13 +479,12 @@ Function RunTestsOnCycle ($cycleName , $xmlConfig, $Distro, $testIterations )
$tempResult = $tempResult.Trim().Replace("<br /","").Trim()
$subTestResult = $tempResult.Split(":")[$tempResult.Split(":").Count -1 ].Trim()
$subTestName = $tempResult.Replace("$subTestResult","").Trim().TrimEnd(":").Trim()
$SQLQuery += "('$dbDateTimeUTC','$dbEnvironment','$dbTestCycle','$dbExecutionID','SubTest-$subTestName','$subTestResult','$dbARMImage','$BaseOsVHD','$finalKernelVersion','NA','$GuestDistro','$HostVersion','$dbLocation','$dbOverrideVMSize','$dbNetworking', '$uploadLink', '$env:BUILD_URL`consoleFull')),"
$SQLQuery += "('$dbDateTimeUTC','$dbEnvironment','$dbTestCycle','$dbExecutionID','SubTest-$subTestName','$subTestResult','$dbARMImage','$BaseOsVHD','$finalKernelVersion','NA','$GuestDistro','$HostVersion','$dbLocation','$dbOverrideVMSize','$dbNetworking', '$uploadLink', '$env:BUILD_URL`consoleFull'),"
}
}
}
elseif ( $testMode -eq "single")
{
$dbTestName = $($currentTestData.testName)
$dbTestResult = $testResult
$SQLQuery += "('$dbDateTimeUTC','$dbEnvironment','$dbTestCycle','$dbExecutionID','$dbTestName','$dbTestResult','$dbARMImage','$BaseOsVHD','$finalKernelVersion','NA','$GuestDistro','$HostVersion','$dbLocation','$dbOverrideVMSize','$dbNetworking', '$uploadLink', '$env:BUILD_URL`consoleFull')"
}

Просмотреть файл

@ -446,7 +446,7 @@ function EnableSRIOVInAllVMs($allVMData)
if ($sriovOutput -imatch "DATAPATH_SWITCHED_TO_VF")
{
$AfterIfConfigStatus = $null
$AfterIfConfigStatus = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username $user -password $password -command "dmesg" -runAsSudo
$AfterIfConfigStatus = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username $user -password $password -command "dmesg" -runMaxAllowedTime 30 -runAsSudo
if ($AfterIfConfigStatus -imatch "Data path switched to VF")
{
LogMsg "Data path already switched to VF in $($vmData.RoleName)"
@ -455,7 +455,7 @@ function EnableSRIOVInAllVMs($allVMData)
else
{
LogErr "Data path not switched to VF in $($vmData.RoleName)"
$bondError += 1
$bondError += 1
}
}
else

Просмотреть файл

@ -1701,23 +1701,22 @@ Function isAllSSHPortsEnabled($DeployedServices)
$IPPORT = $IPPORT.Split(":")
$testIP = $IPPORT[0]
$testPort = $IPPORT[1]
Write-Host "Connecting to $TestIP : $testPort" -NoNewline
$out = Test-TCP -testIP $TestIP -testport $testPort
if ($out -ne "True")
{
Write-Host " : Failed"
{
LogMsg "Connecting to $TestIP : $testPort : Failed"
$WaitingForConnect = $WaitingForConnect + 1
}
else
{
Write-Host " : Connected"
LogMsg "Connecting to $TestIP : $testPort : Connected"
}
}
if($WaitingForConnect -gt 0)
{
$timeout = $timeout + 1
Write-Host "$WaitingForConnect VM(s) still awaiting to open SSH port.." -NoNewline
Write-Host "Retry $timeout/100"
LogMsg "$WaitingForConnect VM(s) still awaiting to open SSH port.."
LogMsg "Retry $timeout/100"
sleep 3
$retValue = "False"
}
@ -6085,7 +6084,7 @@ Function PerformIOTestOnDisk($testVMObject, [string]$attachedDisk, [string]$disk
$mountPoint = "/mnt/datadisk"
LogMsg "Performing I/O operations on $attachedDisk.."
$LogPath = "$LogDir\VerifyIO$($attachedDisk.Replace('/','-')).txt"
$dmesgBefore = RunLinuxCmd -username $testVMUsername -password $testVMPassword -ip $testVMVIP -port $testVMSSHport -command "dmesg" -runAsSudo
$dmesgBefore = RunLinuxCmd -username $testVMUsername -password $testVMPassword -ip $testVMVIP -port $testVMSSHport -command "dmesg" -runMaxAllowedTime 30 -runAsSudo
#CREATE A MOUNT DIRECTORY
$out = RunLinuxCmd -username $testVMUsername -password $testVMPassword -ip $testVMVIP -port $testVMSSHport -command "mkdir -p $mountPoint" -runAsSudo
$partitionNumber=1
@ -6105,7 +6104,7 @@ Function PerformIOTestOnDisk($testVMObject, [string]$attachedDisk, [string]$disk
LogMsg "umount failed. Trying umount -l"
$out = RunLinuxCmd -username $testVMUsername -password $testVMPassword -ip $testVMVIP -port $testVMSSHport -command "umount -l $mountPoint" -runAsSudo
}
$dmesgAfter = RunLinuxCmd -username $testVMUsername -password $testVMPassword -ip $testVMVIP -port $testVMSSHport -command "dmesg" -runAsSudo
$dmesgAfter = RunLinuxCmd -username $testVMUsername -password $testVMPassword -ip $testVMVIP -port $testVMSSHport -command "dmesg" -runMaxAllowedTime 30 -runAsSudo
$addedLines = $dmesgAfter.Replace($dmesgBefore,$null)
LogMsg "Kernel Logs : $($addedLines.Replace('[32m','').Replace('','').Replace('',''))" -LinuxConsoleOuput
$retValue = "PASS"

Просмотреть файл

@ -16,12 +16,16 @@ if [ -f /etc/redhat-release ] ; then
elif [ -f /etc/SuSE-release ] ; then
echo "/etc/SuSE-release detected"
cat /etc/os-release | grep ^PRETTY_NAME | sed 's/"//g' | sed 's/PRETTY_NAME=//g' > `hostname`-distroVersion.txt
elif [[ "$release" =~ "UBUNTU" ]] || [[ "$release" =~ "Ubuntu" ]] ; then
elif [[ "$release" =~ "UBUNTU" ]] || [[ "$release" =~ "Ubuntu" ]] || [[ "$release" =~ "Debian" ]]; then
NAME=`cat /etc/os-release | grep ^NAME= | sed 's/"//g' | sed 's/NAME=//g'`
VERSION=`cat /etc/os-release | grep ^VERSION= | sed 's/"//g' | sed 's/VERSION=//g'`
echo "$NAME $VERSION" > `hostname`-distroVersion.txt
elif [[ "$release" =~ "Debian" ]] ; then
cat /etc/os-release | grep "ID=" | sed 's/ID=//g' > `hostname`-distroVersion.txt
elif [ -e /usr/share/clear/version ]; then
NAME=`cat /usr/lib/os-release | grep ^PRETTY_NAME | sed 's/"//g' | sed 's/PRETTY_NAME=//g'`
VERSION=`cat /usr/lib/os-release | grep ^VERSION= | sed 's/"//g' | sed 's/VERSION=//g'`
echo "$NAME $VERSION" > `hostname`-distroVersion.txt
else
echo "unknown" > `hostname`-distroVersion.txt
echo $release > `hostname`-unknownDistro.txt
fi
exit 0
exit 0