-- -*- lua -*-
local testName = "sh_to_modulefile"

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

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

   runScript = [[

     . $(projectDir)/rt/common_funcs.sh

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

     rm -fr mf _stderr.* _stdout.* err.* out.* .lmod.d s.log
     unset -f fooBar > /dev/null 2> /dev/null

     runLmod --version                                 # 1
     runSh2MF             $(testDir)/tstScript.sh      # 2
     runSh2MF  --to TCL   $(testDir)/tstScript.sh      # 3 
     runSh2MF             $(testDir)/path_both_ends.sh # 4        
     runSh2MF  --from csh $(testDir)/cshScript.csh     # 5
     runSh2MF             $(testDir)/broken.sh         # 6
     runLmod  show wrapperSh/1.0                       # 7
     runLmod  load wrapperSh/1.0                       # 8
     runLmod  show wrapperSh/1.0                       # 9
     runLmod  refresh                                  #10
     runLmod  list                                     #11
     runLmod  --mt                                     #12
     runLmod  unload wrapperSh/1.0                     #13
     runLmod  load   brokenSh/1.0                      #14
     runLmod  load   wrapperSh/1.0                     #15
     runLmod  save                                     #16
     runLmod  restore                                  #18
     runLmod  --mt                                     #19

     unsetMT

     MODULEPATH=$(outputDir)/mf; export MODULEPATH
     mkdir -p $MODULEPATH/A

     buildSh2MF  --to TCL   $(testDir)/tstScript.sh > $MODULEPATH/A/1.0
     runLmod load A                                    #20
     runLmod list                                      #21

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

}
