##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:       install.00-init/%M%
#   Revision:       %I%
#   First Edition:  2017/05/06
#   Last Mod.:      %U%, %G%
#
#   Authors:        Xavier Delaruelle, xavier.delaruelle@cea.fr
#
#   Description:    Test procedures
#   Command:
#   Sub-Command:
#
#   Comment:    %C{
#           Defines the testprocedures for probing the outputs
#           on stdout and stderr of the test target
#       }C%
#
##############################################################################


#
# Test subprocedures
#

proc _test_sub {test_shell cmd} {
   global comp_output
   global comp_error
   global comp_exit
   global shell
   global autoinit_mode
   global verbose

   set comp_output ""
   set comp_error ""
   set comp_exit ""

   if { ![info exists test_shell] || ![info exists cmd] } {
      unresolved "$cmd ($test_shell) internal error"
   }

   # enable autoinit initialization when asked
   set shell_args [split $test_shell ":"]
   if { [llength $shell_args] == 2 && [lindex $shell_args 0] eq "autoinit" } {
      set autoinit_mode 1
      set test_shell [lindex $shell_args 1]
   } else {
      set autoinit_mode 0
   }

   set shell $test_shell
   install_test_xxx_ "$cmd"

   if { $verbose > 1 } {
      set ol [string length $comp_output]
      set oe [string length $comp_error]
      send_user "OUT\[$ol\]: '$comp_output'#>\n"
      send_user "ERR\[$oe\]: '$comp_error'#>\n"
      send_user "EXIT: '$comp_exit'#>\n"
   }
}

# vim:set tabstop=3 shiftwidth=3 expandtab autoindent:
