File: 005-init_ts.exp

package info (click to toggle)
modules 5.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,036 kB
  • sloc: exp: 79,659; sh: 6,142; tcl: 5,900; makefile: 1,493; ansic: 474; python: 265; csh: 202; perl: 47; ruby: 44; lisp: 13
file content (129 lines) | stat: -rw-r--r-- 2,876 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:          lint.00-init/%M%
#   Revision:      %I%
#   First Edition: 2022/08/26
#   Last Mod.:     %U%, %G%
#
#   Authors:       Xavier Delaruelle, xavier.delaruelle@cea.fr
#
#   Description:   Testuite testsequence
#   Command:
#   Sub-Command:
#
#   Comment: %C{
#     Defines all patterns used further in the testsuite
#   }C%
#
##############################################################################

proc report {msg} {
   if {$::verbose} {
      send_user "\t$msg\n"
   }
}

report {Initializing the testsuite ...}

#
# file list to test per language
#

set lint_files(sh) [list\
   init/profile.sh\
   init/sh\
   doc/example/compiler-etc-dependencies/example-sessions/common_code.sh\
]

set lint_files(bash) [list\
   init/bash_completion\
   init/bash\
]

set lint_files(ksh) [list\
   init/ksh\
]

set lint_files(tcl) [list\
   init/tcl\
]

# list generated or source files to skip
set skip_files [list\
   modulecmd-test.tcl\
   lib/configure\
   lib/config.status\
   lib/config.guess\
   init/ksh.in\
   init/sh.in\
   init/bash.in\
   init/bash_completion.in\
   init/profile.sh.in\
   init/tcl.in\
   script/modulecmd.in\
   script/add.modules.in\
]

# fetch files in directories not to scan in depth
set scan_files [glob -types f * testsuite/*]

# scan directories to find files to scan
set scan_dirs [list\
   script\
   init\
   lib\
   share\
   testsuite/bin\
   doc/example\
]
lappend scan_files {*}[exec find {*}$scan_dirs -type f]

# check files to find file to lint
foreach fpath $scan_files {
   if {$fpath ni $skip_files} {
      switch -glob -- [exec file -b $fpath] {
         {POSIX shell script*} {
            lappend lint_files(sh) $fpath
         }
         {Bourne-Again shell script*} {
            lappend lint_files(bash) $fpath
         }
         {*tclsh script*} - {Tcl/Tk script*} {
            lappend lint_files(tcl) $fpath
         }
      }
   }
}

foreach lang [array names lint_files] {
   report "$lang files to lint:\n\t\t[join $lint_files($lang) \n\t\t]"
}

# specific lint options for some files
array set file_lint_opts [list\
   init/ksh {-e SC2089,SC2090}\
   init/bash {-e SC2089,SC2090}\
   init/sh {-e SC2089,SC2090}\
   init/bash_completion {-e SC2207}\
   script/add.modules {-e SC2162}\
   testsuite/bin/install_test_sh {-e SC1090,SC3037,SC3044}\
]

proc set_linter_opts {fpath} {
   if {![info exists ::ORIG_linter_opts]} {
      set ::ORIG_linter_opts $::linter_opts
   }
   if {[info exists ::file_lint_opts($fpath)]} {
      set ::linter_opts $::file_lint_opts($fpath)
   } else {
      set ::linter_opts $::ORIG_linter_opts
   }
}

# clean up temporary variables used
unset fpath
unset lang

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