diff --git a/helpers/automode-startup-script.ps1 b/helpers/automode-startup-script.ps1 index e9558ab..7f0914d 100644 --- a/helpers/automode-startup-script.ps1 +++ b/helpers/automode-startup-script.ps1 @@ -152,21 +152,23 @@ class AutoModeResumeFailedException: System.Exception { # The main functionality try { + $startDate = Get-Date + $formatDate = Get-Date -Format 'yyyy-MM-dd HH:mm:ss' + $curTimeStamp = Get-Date -UFormat %s -Millisecond 0 + + # Limit the maximum time between when the test was started and when the resume script was started + $limitTimestamp = $curTimeStamp - $maxTimeLimit + + Write-Text('') Write-Text('┌────────────────────────────────────────────┐') Write-Text('│ CoreCycler Auto Mode Recovery Script │') Write-Text('└────────────────────────────────────────────┘') Write-Text('') + Write-Text($formatDate) Write-Text('Recovering from an unexpected exit (crash/reboot)') Write-Text('') - $startDate = Get-Date - $curTimeStamp = Get-Date -UFormat %s -Millisecond 0 - - # Limit the maximum time between when the test was started and when the resume script was started - $limitTimestamp = $curTimeStamp - $maxTimeLimit - - # We need to be admin to use the Auto Test Mode $weAreAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) @@ -180,7 +182,7 @@ try { if (!(Test-Path $autoModeFile -PathType Leaf)) { Write-Text('The .automode file does not exist!') Write-Text('The file is needed to be able to continue the testing process, aborting.') - Write-Text('(' + $autoModeFile + ')') + Write-Text('(Looking for: ' + $autoModeFile + ')') Write-Text('') Remove-StartupTask @@ -248,7 +250,10 @@ try { # Start the script now - Start-Process -FilePath 'cmd.exe' -ArgumentList @('/C', ('"' + $scriptRoot + '\Run CoreCycler.bat"'), $coreTested) + Write-Text('Command:') + Write-Text('Start-Process -PassThru -FilePath ''cmd.exe'' -ArgumentList @(''/C'', (''"' + $scriptRoot + '\Run CoreCycler.bat"''), ' + $coreTested + ')') + + $process = Start-Process -PassThru -FilePath 'cmd.exe' -ArgumentList @('/C', ('"' + $scriptRoot + '\Run CoreCycler.bat"'), $coreTested) } # Don't throw an error diff --git a/script-corecycler.ps1 b/script-corecycler.ps1 index adf7660..f9571e7 100644 --- a/script-corecycler.ps1 +++ b/script-corecycler.ps1 @@ -2,7 +2,7 @@ .AUTHOR sp00n .VERSION - 0.10.0.0alpha4 + 0.10.0.0alpha5 .DESCRIPTION Sets the affinity of the selected stress test program process to only one core and cycles through all the cores which allows to test the stability of @@ -23,7 +23,7 @@ param( # Our current version -$version = '0.10.0.0alpha4' +$version = '0.10.0.0alpha5' # This defines the strict mode @@ -4644,7 +4644,7 @@ function Initialize-AutomaticTestMode { # This flag indicates that the .automode file existed and the startup scheduled task was run # So we had a crash while the script was running - if ($CoreFromAutoMode -and $CoreFromAutoMode -gt -1) { + if (-not [String]::IsNullOrWhiteSpace($CoreFromAutoMode) -and [Int]$CoreFromAutoMode -gt -1) { Write-Debug('The CoreFromAutoMode variable was passed from the command line: ' + $CoreFromAutoMode) # The setting for the automatic resume must also be activated @@ -9238,7 +9238,7 @@ function Test-AutomaticTestModeIncrease { } } - Write-ColorText('Increasing the ' + $autoModeDescription + ' value' + $forCore + ' from ' + $oldValueStr + ' to ' + $newValueStr) Yellow + Write-ColorText('Modifying the ' + $autoModeDescription + ' value' + $forCore + ' from ' + $oldValueStr + ' to ' + $newValueStr) Yellow if ($newValue -eq $maxValue) { Write-ColorText('This is the maximum set ' + $autoModeDescription + ' value, there will be no further increases') Yellow @@ -11747,7 +11747,7 @@ try { # Add the previously tested core from before the reboot if we're in Automatic Test Mode with resume - if ($useAutomaticTestModeWithResume -and $CoreFromAutoMode -gt 0) { + if ($useAutomaticTestModeWithResume -and $CoreFromAutoMode -gt -1) { Write-Text('') Write-ColorText('Apparently the computer crashed in the last run while testing core ' + $CoreFromAutoMode) Red Write-ColorText('Trying to resume the test process') Red @@ -11842,7 +11842,7 @@ try { $coreTestOrderArray = [System.Collections.ArrayList]::new() # If we had added a core from CoreFromAutoMode, we will need to push it to the front here again - if ($useAutomaticTestModeWithResume -and $CoreFromAutoMode -gt 0) { + if ($useAutomaticTestModeWithResume -and $CoreFromAutoMode -gt -1) { [Void] $coreTestOrderArray.Add($CoreFromAutoMode) } @@ -11875,7 +11875,7 @@ try { [System.Collections.ArrayList] $coreTestOrderArray = @(@($coreTestOrderArray) | Sort-Object { Get-Random }) # If we had added a core from CoreFromAutoMode, we will need to push it to the front here again - if ($useAutomaticTestModeWithResume -and $CoreFromAutoMode -gt 0) { + if ($useAutomaticTestModeWithResume -and $CoreFromAutoMode -gt -1) { [Void] $coreTestOrderArray.Insert(0, $CoreFromAutoMode) } }