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 "%sysenv.MSYS2_PATH_TYPE%"=="inherit" $abort.NoError Skipping test on headless MSYS2 system in Docker

$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