gamsincr02.gms : Test GAMS incrementalMode limitations

Description

Call "gams" executable with IncrementalMode=1 expecting some errors.

Contributor: Lutz Westermann, June 2024

  Preparation


Small Model of Type : GAMS


Category : GAMS Test library


Main file : gamsincr02.gms

$title Test GAMS incrementalMode limitations (GAMSINCR02,SEQ=957)

$onText
Call "gams" executable with IncrementalMode=1 expecting some errors.

Contributor: Lutz Westermann, June 2024
$offText

* Preparation
$echo * Dummy > dummy.gms
$onEchoV > checkrc.gms
Scalar rc /
$include %fnrc%
/;
Scalar expectedRc / 7 /;
$ifE %system.licenseLevel%==9 expectedRc=0;
abort$(rc<>expectedRc) 'unexpected return code';
$offEcho

$call rm -rf scratch
$call mkdir scratch
$call.checkErrorLevel gams dummy lo=%gams.lo% procdir=scratch > %system.NullFile%

$call cat scratch/gmsprm* > pf.txt
$echo Input=fail.gms     >> pf.txt
$echo pf.txt > stdin.txt
$echo stop  >> stdin.txt

$set license
$if not empty %gams.license%
$set license license="%gams.license%"

$onEcho > fail.gms
$onText
Random text
$offText
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
$onEmbeddedCode Python:
pass
$offEmbeddedCode
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
EmbeddedCode Python:
pass
endEmbeddedCode
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
if(1>0,
  Display 'Colin was here';
);
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
Set i /i1/;
loop(i,
  Display 'Colin was here';
);
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
Scalar c /0/;
while(c<1,
  Display 'Colin was here';
  c=c+1;
);
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
Scalar c;
for(c=1 to 2,
  Display 'Colin was here';
);
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
Scalar c /0/;
repeat(
  Display 'Colin was here';
  c=c+1;
  until c>0 );
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
$call sleep 1
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
$call.async sleep 1
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
$hiddenCall sleep 1
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
Set       I         /i1 * i6/;
Parameter A(I)      /i1=+Inf, i2=-Inf, i3=Eps, i4= 10, i5=30, i6=20/;
Parameter AIndex(i) 'permutation index';

* sort symbol; result in parameter AIndex
$callTool.checkErrorLevel 'alg.Rank A AIndex';
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
Set       I         /i1 * i6/;
Parameter A(I)      /i1=+Inf, i2=-Inf, i3=Eps, i4= 10, i5=30, i6=20/;
Parameter AIndex(i) 'permutation index';

* sort symbol; result in parameter AIndex
$hiddenCallTool.checkErrorLevel 'alg.Rank A AIndex';
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
File fx;
put fx 'Colin was here again';
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
File fx;
putClose fx 'Colin was here again';
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
put_utility 'log' / 'Colin was here again';
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
$echo *Comment > inc.inc
$include inc.inc
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
$echo *Comment > inc.inc
$batInclude inc.inc
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
* No good test case to actually run this
$ifE %system.licenseLevel%==9 $exit

$sysInclude anything
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
Set       I         /i1 * i6/;
Parameter A(I)      /i1=+Inf, i2=-Inf, i3=Eps, i4= 10, i5=30, i6=20/;
Parameter AIndex(i) 'permutation index';

* sort symbol; result in parameter AIndex
$libInclude rank A I AIndex
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%

$onEcho > fail.gms
set i / 1 /, ii(i);
ii(i) = yes; ii(i) = yes; ii(i) = yes; ii(i) = yes;
$offEcho

$call.checkErrorLevel gams nothing incrementalMode=1 %license% < stdin.txt
$call.checkErrorLevel gams checkrc lo=%gams.lo% --fnrc=pf.txt.rc %license%