studio01.gms : Test Studio Startup

Description

This test starts and stops GAMS Studio and checks if that works without
any problems (which could be caused by missing libraries, for example).

Contributor: Lutz Westermann, January 2020


Small Model of Type : GAMS


Category : GAMS Test library


Main file : studio01.gms

$title Test Studio Startup (STUDIO01,SEQ=809)

$onText
This test starts and stops GAMS Studio and checks if that works without
any problems (which could be caused by missing libraries, for example).

Contributor: Lutz Westermann, January 2020
$offText


$if not "%system.buildcode%"=="WEI" $abort.noError Works on Windows 64 bit only
$ifE %gams.ide%=1          $abort.noError This needs to be started from a terminal


$if "%system.ComputerName%"=="KERMIT" $abort.noError Skipping test on kermit (headless)
$if "%system.ComputerName%"=="RIZZO" $abort.noError Skipping test on rizzo (headless)
$if "%sysEnv.GITLAB_CI%"=="true" $abort.noError Skipping test inside GitLab CI runner (headless)

$onEcho > startStudio.ps1
$studio_path = "%gams.sysdir%studio\studio.exe"

"&'$studio_path'" | Invoke-Expression | Out-Null

Start-Sleep 1

$studio_pid = Get-Process studio -ErrorAction SilentlyContinue | Format-Table -HideTableHeaders Id | Out-String
$studio_pid = $studio_pid.Trim()

if ([string]::isNullOrEmpty($studio_pid)) {
    "GAMS Studio could not be started. Please review the Studio package manually!"
    exit(1)
}
$offEcho

$onEcho > kill-studio.ps1
$studio_pid = Get-Process studio -ErrorAction SilentlyContinue | Format-Table -HideTableHeaders Id | Out-String

$studio_pid = $studio_pid.Trim()

if ([string]::isNullOrEmpty($studio_pid)) {
    "No GAMS Studio found!"
    exit(1)
} else {
    Stop-Process -Force $studio_pid
}
$offEcho

$call.checkErrorLevel PowerShell -executionpolicy bypass .\startStudio.ps1
$call sleep 2

$log >>> Starting kill-studio.ps1
$call.checkErrorLevel PowerShell -executionpolicy bypass .\kill-studio.ps1