$title 'API Quality Assurance Test' (TESTAPI,SEQ=2) $onText This model runs all models included in the API Library. Contributor: Lutz Westermann, October 2014 $offText * Do not do anything on Testers $if %runAsTester%==1 $exit set tests / Cex1 Cex2 CPPex1*CPPex3 CPPtrseq DCex1 DOex1 DPex1 DOex2 Fex1 Fex2 gdxperf JAlias JBenders JClad JCutstock JDomainCheck Jex1 Jex2 JInterrupt JSpecialValues Jtrseq JTsp JWarehouse CSex1 CSex2 CSCalcInverse CStrseq CSAlias CSBenders CSClad CSCutstock CSDomainChecking CSNUnit CSSpecialValues CSTsp CSInterrupt CSWarehouse Pex1 Pex2 Pgamstransfer Pgams_engine Pneos Ptrseq PAlias PBenders PClad PCutstock PDomainChecking PInterrupt PWarehouse PTsp PSpecialValues VBex1 VBex2 VBtrseq / suite / C 'C and CPP' D 'Delphi' F 'Fortran' J 'Java' N '.Net' P 'Python' / st(suite, tests) / C.(Cex1, Cex2, CPPex1* CPPex3) D.(DCex1, DOex1, DPex1, DOex2 ) F.(Fex1, Fex2) J.(JAlias, JBenders, JCutstock, JDomainCheck, Jex1, Jex2, JInterrupt, Jtrseq $if not set demosize ,JWarehouse, JTsp, JSpecialValues, JClad ) N.(CSex1, CSex2, CSCalcInverse, CStrseq, CSAlias, CSBenders, CSCutstock, CSDomainChecking, CSInterrupt, CSSpecialValues $if not set demosize ,CSTsp ,CSWarehouse, CSClad $if not %system.filesys% == UNIX ,CSNUnit ,VBex1, VBex2, VBtrseq, CPPtrseq ) P.(Pex1, Pex2, Pgamstransfer, Pgams_engine, Pneos, Ptrseq, PAlias, PBenders, PCutstock, PDomainChecking, PInterrupt, gdxperf $if not set demosize ,PWarehouse, PTsp, PSpecialValues, PClad ) / pfsuite(*,suite) / (dac,deg,lag,leg,wei).(C,F,J,N,P) /; $onEmpty set skip(tests) List of skips / * We know that these ones fail * These should be temporary skips $if %system.buildcode% == DEG JClad 'pstree/kill problem, #2824' $if %system.buildcode% == DEG CPPex3 'some issues on Pete (because of old OS?), devel/gams-cpp#69' /; $offEmpty $set FLAGS lo=%GAMS.lo% $if set demosize $set FLAGS %FLAGS% --demosize=1 $if not set TEST $goTo checksuite SET runtests(tests) / %TEST% /; $if errorfree $goTo TEST_OK $clearError $log The test model(s) specified (--TEST=%TEST%) are not all valid $abort $label checksuite $if not set SUITE $goTo alltests SET tsuite(suite) / %SUITE% /; $if errorfree $goTo SUITE_OK $clearError $log The suite(s) specified (--SUITE=%SUITE%) are not all valid $abort $label SUITE_OK SET runtests(tests); runtests(tests) = sum{st(tsuite,tests),yes}; $goTo TEST_OK $label alltests SET runtests(tests); runtests(tests) = yes; $label TEST_OK scalar tot / 0 /, err / 0 /, cnt / 0 /; file fall / 'all_api.gms' / ferr / 'failures_api.gms' / rmme / 'rmme.gms' / log / '' / fx; putclose fall '* These are the tests we ran' /; putclose ferr '* These are the tests that failed' /; fall.ap = 1; ferr.ap = 1; $if not set PREFIX $set PREFIX %system.buildcode% $set DIRNAME "'%PREFIX%_api_' tests.tl:0 " loop(runtests(tests)$(sum(pfsuite('%system.buildcode%',suite)$st(suite,tests),1) and not skip(tests)), tot = tot + 1; put_utility fx 'shell' / 'rm -rf ' %DIRNAME%; put_utility fx 'shell' / 'mkdir ' %DIRNAME%; put_utility fx 'shell' / 'cd ' %DIRNAME% ' && apilib ' tests.tl:0 ' && gams ' tests.tl:0 ' %FLAGS% > stdout.txt 2>stderr.txt'; if(errorlevel, err = err + 1; putclose ferr '$call =gams testapi --test=' tests.tl:0 ' %FLAGS% --dir='%DIRNAME% /; else put_utility fx 'shell' / 'rm -rf ' %DIRNAME%; ); putclose fall '$call =gams testapi --test=' tests.tl:0 ' %FLAGS% --dir='%DIRNAME% /; ); putclose ferr '*Total tests: ', tot:0:0, ' Failed tests: ', err:0:0 ; put log; if {(err > 0), put 'There were errors: ', err:0:0, ' out of ', tot:0:0, ' tests failed.' /; put 'See the file failures_api.gms to reproduce the failed runs'/; put 'You have some failures. See failures_api.gms for details.'; else put 'Congratulations! All ', tot:0:0, ' tests passed.'/; }; put 'See the file all_api.gms to reproduce all the runs'/;