embgms09.gms : Test Embedded Code after restart

Description

This test ensures that embedded code can be started as very first action
after restarting from a restart file and that the correct scratch dir is
used when continuing from a restart file.

Contributor: Michael Bussieck, January 2022


Small Model of Type : GAMS


Category : GAMS Test library


Main file : embgms09.gms

$title Test Embedded Code after restart (EMBGMS09,SEQ=932)

$onText
This test ensures that embedded code can be started as very first action
after restarting from a restart file and that the correct scratch dir is
used when continuing from a restart file.

Contributor: Michael Bussieck, January 2022
$offText


$onEcho > disp.gms
Display 'hello';
$offEcho

$onEcho > emb.gms
embeddedCode GAMS:
display 'hello world';
endEmbeddedCode 
$offEcho

$call.checkErrorLevel 'gams disp.gms lo=%GAMS.lo% s=1'
$call.checkErrorLevel 'gams emb.gms lo=%GAMS.lo% r=1'

* Make sure, that the temporary Python script used with execution time embedded code
* is in the scratch dir used at execution time, not compile time
$call.checkErrorLevel 'rm -rf gams*.put'
$call.checkErrorLevel 'mkdir subDir'
$call.checkErrorLevel 'cp emb.gms subDir%system.dirSep%emb.gms'

$call.checkErrorLevel 'cd subDir && gams emb.gms lo=%GAMS.lo% s=..%system.dirSep%11 a=c'
$call.checkErrorLevel 'rm -rf subDir'
$call.checkErrorLevel 'gams disp.gms lo=%GAMS.lo% r=11'

$if exist gams1.put $abort GAMS script should be written to scratch dir