-- -*- lua -*-
local testName = "itac"

testdescript = {
   owner   = "rtm",
   product = "modules",
   description = [[
	 Test between
   ]],
   keywords = {testName },

   active = 1,
   testName = testName,
   job_submit_method = "INTERACTIVE",

   runScript = [[

     . $(projectDir)/rt/common_funcs.sh

     unsetMT
     initStdEnvVars
     numStep=0
     COUNT=0
     ORIG_HOME=`(cd $HOME; /bin/pwd)`
     HOME=`/bin/pwd`


     rm -fr _stderr.* _stdout.* err.* out.* .lmod.d mf

     mkdir mf
     (cd $(testDir)/mf; tar cf - . | (cd $(outputDir)/mf; tar xpf - ))
     export MODULEPATH_ROOT=$(outputDir)/mf
     export MODULEPATH=$MODULEPATH_ROOT/Core


     runLmod --version               # 1
     runLmod load intel mv2          # 2
     mkdir -p .lmod.d/.cache
     buildSpiderT $MODULEPATH > .lmod.d/.cache/spiderT.lua
     mkdir mf/Core/itac
     cp $(testDir)/ITAC-1.0.lua mf/Core/itac/1.0.lua
     runLmod --ignore_cache avail    # 3
     runLmod avail                   # 4
     runLmod show itac               # 5
     runLmod load itac               # 6
     runLmod unload mv2              # 7
     runLmod list                    # 8

     HOME=$ORIG_HOME
     cat _stdout.[0-9][0-9][0-9] > _stdout.orig
     joinBase64Results  -bash  _stdout.orig _stdout.new
     cleanUp _stdout.new out.txt

     cat _stderr.[0-9][0-9][0-9] > _stderr.orig
     cleanUp _stderr.orig err.txt

     rm -f results.csv
     wrapperDiff --csv results.csv $(testDir)/out.txt out.txt
     wrapperDiff --csv results.csv $(testDir)/err.txt err.txt
     testFinish -r $(resultFn) -t $(runtimeFn) results.csv
   ]],


   blessScript = [[
         # perform what is needed
   ]],

   tests = {
      { id='t1'},
   },

}
