-- -*- lua -*-
local testName = "meta"

testdescript = {
   owner   = "rtm",
   product = "modules",
   description = [[
	 meta: test module searching when comparing meta versus regular
   ]],
   keywords = {testName },

   active   = true,
   testName = testName,
   job_submit_method = "INTERACTIVE",

   runScript = [[

     . $(projectDir)/rt/common_funcs.sh

     unsetMT
     initStdEnvVars
     export MODULEPATH=$(testDir)/mf0/Core:$(testDir)/mf1/Core:$(testDir)/mf2/Core

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

     runLmod --version                             # 1
     runLmod avail                                 # 2

     runLmod load settarg                          # 3
     runLmod load targ                             # 4
     runLmod list                                  # 5

     runLmod purge                                 # 6
     unsetMT
     MODULEPATH=$(testDir)/MF_FOO/A:$(testDir)/MF_FOO/B

     runLmod avail                                 # 7
     runLmod load Foo                              # 8
     runLmod list                                  # 9
     runLmod load Foo/1.0                          #10
     runLmod list                                  #11

     runLmod purge                                 #12
     unsetMT
     MODULEPATH=$(testDir)/MF_FOO/B:$(testDir)/MF_FOO/A

     runLmod avail                                 #13
     runLmod load Foo                              #14
     runLmod list                                  #15
     runLmod load Foo/1.0                          #16
     runLmod list                                  #17

     runLmod purge                                 #18
     unsetMT
     MODULEPATH=$(testDir)/MF_FOO/A:$(testDir)/MF_FOO/B

     export LMOD_MODULERCFILE=$testDir/dot.modulerc.lua
     runLmod avail                                 #19
     runLmod load Foo                              #20
     runLmod list                                  #21
     runBase runSpiderCmd -o spiderT $MODULEPATH   #22


     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'},
   },

}
