-- -*- lua -*-
local testName = "depends_on"

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

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

   runScript = [[

     . $(projectDir)/rt/common_funcs.sh

     unsetMT
     initStdEnvVars
     export MODULEPATH=$(testDir)/mf/Core

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

     runLmod --version                         # 1
     runLmod load A X                          # 2
     runLmod list                              # 3
     runLmod unload X                          # 4
     runLmod list                              # 5
     runLmod unload A                          # 6
     runLmod load X Y                          # 7
     runLmod list                              # 8
     runLmod save                              # 9
     runLmod unload X                          #10
     runLmod list                              #11
     runLmod unload Y                          #12
     runLmod list                              #13
     runLmod load X                            #14
     runLmod unload A                          #15
     runLmod restore                           #16
     runLmod unload A                          #17
     runLmod purge                             #18
     runLmod load Y                            #19
     runLmod list                              #20
     runLmod save                              #21
     runLmod restore                           #22
     runLmod unload Y                          #23
     runLmod list                              #24
     runLmod load Z                            #25
     runLmod load bar/1.0                      #26
     runLmod load foo                          #27
     runLmod list                              #28
     runLmod purge                             #29
     runLmod load bar/1.2                      #30
     runLmod load foo                          #31
     runLmod list                              #32

     
     runLmod purge                             #33
     unsetMT
     export MODULEPATH=$(testDir)/mf/Core2
     export LMOD_PIN_VERSIONS=yes
     runLmod load  SomeSoftware OtherSoftware  #34
     runLmod list                              #35

     runLmod purge                             #36
     unsetMT
     export MODULEPATH=$(testDir)/mf/Core3
     unset LMOD_PIN_VERSIONS
     runLmod load  A                           #37
     runLmod list                              #38

     runLmod purge                             #39
     unsetMT
     export MODULEPATH=$(testDir)/mf/Core4
     runLmod load python/3.9.6                 #40
     runLmod load ipykernel/2022a              #41
     runLmod list                              #42

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

}
