pfmaptst.gms : Checks files in distribution

Description

Compares the list of existing files with the list of expected files.

Contributor: Lutz

 For changes on all platforms


Small Model of Type : GAMS


Category : GAMS Test library


Main file : pfmaptst.gms

$title 'Checks files in distribution' (GMSPFMAPTEST,SEQ=352)

$ontext
Compares the list of existing files with the list of expected files.

Contributor: Lutz
$offtext

$offlisting
$if not set GOLD $set GOLD 0
*For changes on all platforms
$set ALLPF (AIX,DEG,LEG,SOX,VS8,WEI)
$set JAVPF (    DEG,LEG,SOX,VS8,WEI)
$set ALLNX (                VS8,WEI)
$set ALLUX (AIX,DEG,LEG,SOX        )

alias (*,prd,prda,dir,fil);
set ppp                                Possible platforms /aix,bgp,lnx,sig,sol,sox,vs8,deg,dei,dig,leg,wei/;

*Sets containing input data
set curfil(prd,dir,fil)                Files of current version
    lstall(ppp,prd,dir,fil)            Files of last version containing all platforms
    lstfil(prd,dir,fil)                Files of last version
    curprd(prd)                        All products contained in current version
    lstprd(prd)                        All products contained in last version
*Sets containing expected products/files
    expprd(prd)                        Expected products
    expfil(prd,dir,fil)                Expected files
*Sets containing errors
    nexprd(prd)                        Products being not expected but contained in current version
    misprd(prd)                        Products missing in current version
    drwprd(prd)                        Products dropped wrongly (dropped but not in previous version)
    adwprd(prd)                        Products added wrongly (added but already in previous version)
    nexfil(prd,dir,fil)                Files per product and directory being not expected but contained in current version
    misfil(prd,dir,fil)                Files per product and directory missing in current version
    drwfil(prd,dir,fil)                Files per product and directory dropped wrongly (dropped but not in previous version)
    adwfil(prd,dir,fil)                Files per product and directory added wrongly (added but already in previous version)
    nexfila(prd,dir,fil)               Files per product and directory being not expected but contained in current version (for solver aliases)
    misfila(prd,dir,fil)               Files per product and directory missing in current version (for solver aliases)
    wronga(prd)                        Alias entered for a product which does not exist
*Sets containing expected changes
$onempty
    newprd(ppp,prd)             New products
                                / leg. studio
                                  vs8. studio
                                  wei. studio
                                  (leg,wei). odhcplex
                                  %ALLPF%.PSOptLibrary /
    drpprd(ppp,prd)             Dropped products
                                / (leg,vs8,wei).dicoptd /


$onecho > modlib.txt
'guss2dim.423', 'obstacle.424'
$offecho

$onecho > tstlib.txt
'emp28.742', 'emp29.743', 'emp30.744', 'emp31.745', 'csv2gdx2.746', 'csv2gdx3.747', 'csv2gdx4.748', 'emp32.749', 'csv2gdx5.750', 'csv2gdx6.751'
$offecho

$onecho > emplib.txt
'simpleqvi1.101', 'simpleqvi2.102', 'simpequil3.103'
$offecho

*$onecho > datalib.txt
*$offecho

*$onecho > apilib.txt
*$offecho

$onEchoV > wrapperlib.inc
                               (AIX,LEG,SOX).(%1 . '%2'           .('lib%3lib64.so'))
                                DEG         .(%1 . '%2'           .('lib%3lib64.dylib'))
                                VS8         .(%1 . '%2'           .('%3lib.dll'))
                                WEI         .(%1 . '%2'           .('%3lib64.dll'))
$offEcho

$onEchoV > api.inc
                                %ALLPF% . %1     .('./apifiles/C/api'    .('%2cc.c','%2cc.h')
                                                          './apifiles/Java/api' .('%2.java','%2jni.c')
                                                          './apifiles/Python/api'.('%2cc.i','%2cc.py','%2cc_wrap.c','%2setup.py')
                                                          './apifiles/CSharp/api'.'%2cs.cs'
                                                          './apifiles/Delphi/api'.('%2dcpdef.pas','%2docpdef.pas','%2dopdef.pas','%2dpdef.pas')
                                                          './apifiles/Fortran/api'.('%2f9def.f90','%2f9glu.c','%2f9glu.h','%2ifort32def.def','%2ifort32def.f90','%2ifort32deflib.f90','%2ifort64def.def','%2ifort64def.f90','%2ifort64deflib.f90','%2lfdef.def','%2lfdef.f90','%2lfdeflib.f90')
                                                          './apifiles/VBA/api'  . '%2vba.bas'
                                                          './apifiles/VBnet/api'. '%2vbnet.vb'
                                                          './docs/apis/expert-level'.'%2qdrep.html')
                          (LEG,VS8,WEI) . %1     . './apifiles/Python/api_26'      .('%2cc.py')
                                %ALLNX% . %1     .('./apifiles/Python/api','./apifiles/Python/api_26').'_%2cc.pyd'
                                    LEG . %1     .('./apifiles/Python/api','./apifiles/Python/api_26').'_%2cc.so'
                                    DEG . %1     . './apifiles/Python/api'                            .'_%2cc.so'
                                    VS8 . %1     . './apifiles/Java/api'                              .'%2jni.dll'
                                    WEI . %1     . './apifiles/Java/api'                              .'%2jni64.dll'
                          (AIX,LEG,SOX) . %1     . './apifiles/Java/api'                              .'lib%2jni64.so'
                                    DEG . %1     . './apifiles/Java/api'                              .'lib%2jni64.dylib'
$offEcho

    newfil(ppp,prd,dir,fil)     New files per product and directory /

                                 %ALLPF% .(
                                          PSOptLibrary  . './psoptlib_ml'.(
'BoundaryLP.gms','DED-LP.gms','DED-PB.gms','DED-wind.gms','DED.gms','DEDESS.gms','DEDESSwind.gms','ED.gms','EDsensitivity.gms','EmergencyCentreAllocation.gms','EnergyHub.gms','EnvironmentalED.gms','ESSDCOPFwind.gms','MOED.gms','MultiperiodACOPF24bus.gms','MultiperiodDCOPF24bus.gms','OPF2bus.gms','OPF3bus.gms','OPF5bus.gms','ParetoOptimalFront.gms','PBUC.gms','PMU-cost.gms','PMU-OBI.gms','PMU.gms','psoptlib.glb','RampSenDED.gms','SimpleLP.gms','SimpleMIP.gms','TEP.gms','TransportationOn-Off.gms','UC.gms','WaterEnergy.gms'
)
                                          ModelLibrary  . './gamslib_ml'.(
$include modlib.txt
)
                                          TestLibrary   . './testlib_ml'.(
$include tstlib.txt
)
*                                          DataLibrary   . './datalib_ml'.(
*$include datalib.txt
*)
                                          EmpLibrary    . './emplib_ml'.(
$include emplib.txt
)
*                                          APILibrary    . './apilib_ml'.(
*$include apilib.txt
*)
                                          joatAPI       .('./apifiles/C/api'     .('c4umcc.c', 'c4umcc.h'))
                                         )
                                 %ALLNX%.(
                                           PSOptLibrary . '.' . 'psoptlib.exe'
                                         )
                                 %ALLUX%.(
                                           PSOptLibrary . '.' . 'psoptlib'
                                         )
*                                AIX     .(
*                                         )
                                DEG     .( gams          .'.'.'libgfortran.4.dylib'
                                            gurobi       .'.'.'libgurobi80.so'

scip     .'.'.'libgmsbliss.dylib',    BONMIN   .'.'.'libgmsbliss.dylib',    CBC      .'.'.'libgmsbliss.dylib'
COUENNE  .'.'.'libgmsbliss.dylib',    IPOPT    .'.'.'libgmsbliss.dylib',    OS       .'.'.'libgmsbliss.dylib'
OSISOPLEX.'.'.'libgmsbliss.dylib',    OsiCplex .'.'.'libgmsbliss.dylib',    OsiGurobi.'.'.'libgmsbliss.dylib'
OsiMosek .'.'.'libgmsbliss.dylib',    OsiXpress.'.'.'libgmsbliss.dylib'
BARON.'.'.'libirc.dylib'
                                         )
                                LEG     .(
                                          studio        .'./studio'              .('studio.AppImage')
                                          gurobi        . '.' . 'libgurobi.so.8.0.0'
                                          localsolver . '.' . 'liblocalsolver.so'
                                          xpress      . '.' .('libxprl-2.9.2-x8.4.so', 'libxprs.so.32.01.10')
                                          odhcplex      . '.' .('libheuristic343.so','libcpxcclib64.so','optodhcplex.def')
                                          cplexd        . '.' .('optodhcplex.def')
scip     .'.'.'libgmsbliss.so',    BONMIN   .'.'.'libgmsbliss.so',    CBC      .'.'.'libgmsbliss.so'
COUENNE  .'.'.'libgmsbliss.so',    IPOPT    .'.'.'libgmsbliss.so',    OS       .'.'.'libgmsbliss.so'
OSISOPLEX.'.'.'libgmsbliss.so',    OsiCplex .'.'.'libgmsbliss.so',    OsiGurobi.'.'.'libgmsbliss.so'
OsiMosek .'.'.'libgmsbliss.so',    OsiXpress.'.'.'libgmsbliss.so'
BARON.'.'.'libirc.so'
                                         )
*                                SOX     .(
*                                         )
                                VS8     .(
                                          gamsCPP        .('./apifiles/C++/lib/vs2015'             .('d3dcompiler_47.dll', 'gamscpp.dll', 'gamscpp.exp', 'gamscpp.lib', 'libEGL.dll', 'libGLESV2.dll', 'opengl32sw.dll', 'Qt5Core.dll', 'Qt5Gui.dll', 'Qt5Sql.dll', 'Qt5Svg.dll', 'Qt5Widgets.dll', 'vcredist_x86.exe')
                                                           './apifiles/C++/lib/vs2015/iconengines' . 'qsvgicon.dll'
                                                           './apifiles/C++/lib/vs2015/imageformats'.('qgif.dll', 'qicns.dll', 'qico.dll' , 'qjpeg.dll', 'qsvg.dll', 'qtga.dll' , 'qtiff.dll', 'qwbmp.dll', 'qwebp.dll')
                                                           './apifiles/C++/lib/vs2015/platforms'   . 'qwindows.dll'
                                                           './apifiles/C++/lib/vs2015/sqldrivers'  .('qsqlite.dll', 'qsqlmysql.dll', 'qsqlodbc.dll', 'qsqlpsql.dll'))
                                          studio         . '.'                   . 'studio-x86.zip'
                                         )
                                WEI     .(
                                          gurobi         .'.'.'gurobi80.dll'
                                          cplexd         .'.'.'optodhcplex.def'
                                          odhcplex       .'.'.('heuristic343.dll','cpxcclib64.dll','optodhcplex.def')
                                          gamsCPP        . './apifiles/C++/lib/vs2017/styles'.'qwindowsvistastyle.dll'
                                          studio         . '.'                   . 'studio-x64.zip'
                                         )
                                /

    drpfil(ppp,prd,dir,fil)     Dropped files per product and directory /
                                %ALLNX% .(  gamsAPI.'./apifiles/Java/api'.'gams.jar'
                                         )
                                AIX     .(
                                          gurobi       .'.'. 'libaes75.so'
                                         )
                                DEG     .( 
                                          gams         .'.'. 'libgfortran.3.dylib'
                                          gurobi       .'.'. ('libaes75.so','libgurobi75.so')
                                         )
                                LEG     .(
                                          gurobi       .'.'. ('libaes75.so','libgurobi.so.7.5.2')
                                          localsolver . '.' . 'liblocalsolver70.so'
                                          (antigone,scip). '.' .('libmkl_avx.so', 'libmkl_avx2.so', 'libmkl_avx512.so', 'libmkl_avx512_mic.so', 'libmkl_mc.so', 'libmkl_mc3.so')
                                          xpress         . '.' .('libxprl-2.8.9-x8.4.so', 'libxprs.so.32.01.05')
                                         )
*                                SOX     .(
*                                         )
*                                VS8     .(
*                                         )
                                WEI     .(
                                          gurobi       .'.'. ('aes75.dll','libcurl.dll','gurobi75.dll')
                                         )
                                /
$offempty
;

SET APM(ppp,prda,prd) 'Alias Product Map' /
  (        vs8,deg,leg,wei).COINBONMIN. BONMIN
  (        vs8,deg,leg,wei).BONMINH.    BONMIN
  (        vs8,deg,leg,wei).COINCBC.    CBC
  (        vs8,deg,leg,wei).COINCOUENNE.COUENNE
  (        vs8,deg,leg,wei).COINIPOPT.  IPOPT
  (        vs8,deg,leg,wei).IPOPTH.     IPOPT
  (        vs8,deg,leg,wei).COINOS.     OS
  (        vs8,deg,leg,wei).COINSCIP.   SCIP
  (aix,sox,vs8,deg,leg,wei).CONOPT.     CONOPTD
  (aix,sox,vs8,deg,leg,wei).CONOPT3.    CONOPTD
  (    sox,vs8,deg,leg,wei).LGO.        LGOD
  (aix,sox,vs8,deg,leg,wei).LOGMIP.     JAMS
  (aix,sox,vs8,deg,leg,wei).MILESE.     MILES
  (aix,sox,vs8,deg,leg,wei).MINOS.      MINOS55
  (aix,sox,vs8,deg,leg,wei).MINOS5.     MINOS55
  (aix,sox,vs8,deg,leg,wei).PATH.       PATHC
  (        vs8,deg,leg,wei).SOPLEX.     OSISOPLEX
/;

SET prdAlias(prda) 'Aliases of Products';
option prdAlias < APM;

$call rm -f apilib.txt datalib.txt emplib.txt modlib.txt tstlib.txt wrapperlib.inc api.inc

$gdxin "%gams.sysdir%gmspfmap"
$load curfil=pfmap

$gdxin allpfmap
$load lstall=pfmap

$if %GOLD% == 1 $goto mkallpf

lstfil(prd,dir,fil)=lstall('%system.buildcode%',prd,dir,fil);

option curprd<curfil, lstprd<lstfil;

* Skiplist
$onempty
set sPrd(prd)   'Products to be skipped' /
                (GAMSDOTNET, GAMSJAVA, GAMSPYTHON)      'These are skipped in mkpfmap, see #2579'
                Documents                               'too many files and changing too often'
                /;
$offempty

expprd(prd)$(not prdAlias(prd)) = lstprd(prd) and not drpprd('%system.buildcode%',prd) or newprd('%system.buildcode%',prd);
expfil(prd,dir,fil)$(not prdAlias(prd)) = lstfil(prd,dir,fil) and not (drpfil('%system.buildcode%',prd,dir,fil) or drpprd('%system.buildcode%',prd)) or newfil('%system.buildcode%',prd,dir,fil);

nexprd(curprd)$(not prdAlias(curprd) and not sPrd(curprd)) = not expprd(curprd);
misprd(expprd)$(not prdAlias(expprd) and not sPrd(expprd)) = not curprd(expprd);
drwprd(prd)$(not prdAlias(prd) and not sPrd(prd))          = drpprd('%system.buildcode%',prd) and not lstprd(prd);
adwprd(prd)$(not prdAlias(prd) and not sPrd(prd)   )       = newprd('%system.buildcode%',prd) and     lstprd(prd);

nexfil(curfil(prd,dir,fil))$(not prdAlias(prd) and not sPrd(prd)) = not expfil(curfil);
misfil(expfil(prd,dir,fil))$(not prdAlias(prd) and not sPrd(prd)) = not curfil(expfil);
drwfil(prd,dir,fil)$(not prdAlias(prd) and not sPrd(prd))         = drpfil('%system.buildcode%',prd,dir,fil) and not lstfil(prd,dir,fil);
adwfil(prd,dir,fil)$(not prdAlias(prd) and not sPrd(prd))         = newfil('%system.buildcode%',prd,dir,fil) and     lstfil(prd,dir,fil);

nexfila(prdAlias,dir,fil) = curfil(prdAlias,dir,fil) and not sum(APM('%system.buildcode%',prdAlias,prd)$(not sPrd(prd)),expfil(prd,dir,fil));
* This is slow, use loop instead
* misfila(prdAlias,dir,fil) = (not curfil(prdAlias,dir,fil)) and sum(APM('%system.buildcode%',prdAlias,prd)$(not sPrd(prd)),expfil(prd,dir,fil));
set fa(dir,fil),fo(dir,fil);
loop(APM('%system.buildcode%',prda,prd)$(not sPrd(prd)),
  fa(dir,fil) = curfil(prda,dir,fil);
  fo(dir,fil) = expfil(prd,dir,fil);
  misfila(prda,dir,fil) = not fa(dir,fil) and fo(dir,fil);
);
wronga(prdAlias) = sum(APM('%system.buildcode%',prdAlias,prd)$(not sPrd(prd)),1) and (sum(APM('%system.buildcode%',prdAlias,expprd),1)=0);

option nexfil:0:0:3,misfil:0:0:3,drwfil:0:0:3,adwfil:0:0:3,nexfila:0:0:3,misfila:0:0:3,wronga:0:0:3;

abort$(card(nexprd) + card(misprd) + card(drwprd) + card(adwprd) + card(nexfil) + card(misfil) + card(drwfil) + card(adwfil) + card(nexfila) + card(misfila) + card(wronga))
      nexprd, misprd, drwprd, adwprd, nexfil, misfil, drwfil, adwfil, nexfila, misfila, wronga;
$exit
$label mkallpf
set curall(ppp,prd,dir,fil)     Files of current version containing all platforms;
curall(ppp,prd,dir,fil) = lstall(ppp,prd,dir,fil) and not (drpfil(ppp,prd,dir,fil) or drpprd(ppp,prd)) or newfil(ppp,prd,dir,fil);
execute_unload 'allpfmap' curall=pfmap;