embpy09.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: Lutz Westermann, June 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : embpy09.gms

$title Test Embedded Code after restart (EMBPY09,SEQ=866)

$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: Lutz Westermann, June 2021
$offtext


$log --- Using Python library %sysEnv.GMSPYTHONLIB%


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

$onEcho > emb.gms
embeddedCode Python:
pass
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 Py script should be written to scratch dir