Skip to content

Commit bbc7cb1

Browse files
committed
ts: remove default_modulecmd and expect MODULECMD env var to be set
Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent 0620c53 commit bbc7cb1

File tree

6 files changed

+15
-58
lines changed

6 files changed

+15
-58
lines changed

Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ OPENFOAM_REPOURL := https://github.com/OpenFOAM/OpenFOAM-dev.git
3838

3939
# specific modulecmd script for test
4040
MODULECMDTEST := modulecmd-test.tcl
41+
# if coverage enabled, run tests on instrumented file to create coverage log
42+
ifeq ($(COVERAGE),y)
43+
MODULECMD := $(MODULECMDTEST)_i
44+
else
45+
MODULECMD := $(MODULECMDTEST)
46+
endif
4147

4248
# definitions for enhanced diff tool (to review test results)
4349
ICDIFF_DLSRC := https://raw.githubusercontent.com/jeffkaufman/icdiff/release-2.0.4/
@@ -51,10 +57,9 @@ include Makefile.inc
5157

5258
INSTALL_PREREQ := modulecmd.tcl ChangeLog.gz README script/add.modules \
5359
script/modulecmd
60+
TEST_PREREQ := $(MODULECMD)
5461
ifeq ($(COVERAGE),y)
55-
TEST_PREREQ := $(MODULECMDTEST)_i $(NAGELFAR)
56-
else
57-
TEST_PREREQ := $(MODULECMDTEST)
62+
TEST_PREREQ += $(NAGELFAR)
5863
endif
5964

6065
ifeq ($(libtclenvmodules),y)
@@ -953,17 +958,13 @@ $(MODULECMDTEST)_i: tcl/cache.tcl_i tcl/coll.tcl_i tcl/envmngt.tcl_i \
953958
echo 'source tcl/main.tcl_i' >> $@
954959
chmod +x $@
955960

956-
# if coverage enabled, run tests on instrumented file to create coverage log
957-
ifeq ($(COVERAGE),y)
958-
export MODULECMD = $(MODULECMDTEST)_i
959-
endif
960-
961961
# specific target to build test dependencies
962962
test-deps: $(TEST_PREREQ)
963963

964964
# if coverage enabled create markup file for better read coverage result
965965
test: $(TEST_PREREQ)
966966
TCLSH=$(TCLSH); export TCLSH; \
967+
MODULECMD=$(MODULECMD); export MODULECMD; \
967968
OBJDIR=`pwd -P`; export OBJDIR; \
968969
TESTSUITEDIR=`cd testsuite;pwd -P`; export TESTSUITEDIR; \
969970
runtest --srcdir $$TESTSUITEDIR --objdir $$OBJDIR $(RUNTESTFLAGS) --tool modules $(RUNTESTFILES)

testsuite/config/unix.exp

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,47 +21,6 @@
2121
#
2222
##############################################################################
2323

24-
#
25-
# the default for the modulecmd binary is the one in the upper directory
26-
# if it doesn't exist, look up the search path in order to locate one.
27-
#
28-
29-
proc default_modulecmd {} {
30-
global MODULECMD
31-
global verbose
32-
global env
33-
34-
if ![info exists MODULECMD] then {
35-
if [info exists env(MODULECMD)] {
36-
set MODULECMD $env(MODULECMD)
37-
} elseif [file exists ../modulecmd] then {
38-
set MODULECMD "../modulecmd"
39-
} elseif [file exists ./modulecmd] then {
40-
set MODULECMD "./modulecmd"
41-
# use test-specific modulecmd.tcl script if it exists
42-
} elseif [file exists "./modulecmd-test.tcl"] then {
43-
set MODULECMD "./modulecmd-test.tcl"
44-
# check for modulecmd.tcl before guessing from path
45-
# to give this flavor a chance to be found when modulecmd
46-
# binary is also installed in system default paths
47-
} elseif [file exists "../modulecmd.tcl"] then {
48-
set MODULECMD "../modulecmd.tcl"
49-
} elseif [file exists "./modulecmd.tcl"] then {
50-
set MODULECMD "./modulecmd.tcl"
51-
} else {
52-
set MODULECMD [which modulecmd]
53-
if ![file exists $MODULECMD] then {
54-
fail "No 'modulecmd' found"
55-
exit -1
56-
} elseif { $verbose > 1 } {
57-
send_user "using 'modulecmd' from search path"
58-
}
59-
}
60-
}
61-
62-
}
63-
64-
6524
#
6625
# modulecmd_xxx_ -- run modulecmd
6726
#
@@ -109,8 +68,6 @@ proc modulecmd_xxx_ {command {input noinput}} {
10968
unresolved "internal testsuite error: no module command specified"
11069
}
11170

112-
default_modulecmd
113-
11471
set cmdlist [list $TCLSH $MODULECMD $shell]
11572
# check if asked not to split passed command line
11673
if {[string first "NOCMDSPLIT" $command] == 0} {
@@ -163,8 +120,6 @@ proc modulecmd_xxx_ {command {input noinput}} {
163120
unresolved "internal testsuite error: no module command specified"
164121
}
165122

166-
default_modulecmd
167-
168123
set cmdlist [list exec $TCLSH $MODULECMD $shell]
169124
# check if asked not to split passed command line
170125
if {[string first "NOCMDSPLIT" $command] == 0} {

testsuite/modules.00-init/005-init_ts.exp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ send_user "\tInitializing the testsuite ...\n"
2929
# excepted information to run the testsuite
3030
set TCLSH $env(TCLSH)
3131
send_user "\tTCLSH is '$TCLSH'\n"
32+
set MODULECMD $env(MODULECMD)
33+
send_user "\tMODULECMD is '$MODULECMD'\n"
3234

3335

3436
# Modules release number
@@ -338,9 +340,6 @@ if {[info exists tclsh_version]} {
338340
set pager_dfl_use [expr {[file tail $install_pager] ni {{} cat}}]
339341

340342

341-
default_modulecmd
342-
343-
344343
#
345344
# Regular expressions matching error and warning outputs
346345
#

testsuite/modules.00-init/010-environ.exp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,7 @@ set ORIG_PATH $env(PATH)
196196
setenv_var HOME $env(TESTSUITEDIR)
197197
set ORIG_HOME $env(HOME)
198198

199+
set ORIG_MODULECMD $MODULECMD
200+
199201
unsetenv_var testsuite
200202

testsuite/modules.00-init/170-cwd.exp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if {![info exists env(COVERAGE)] && $os_name ni {cygwin mingw msys}\
4545

4646
# move back to testsuite working directory
4747
cd $ORIG_CWD
48-
unset MODULECMD
48+
set MODULECMD $ORIG_MODULECMD
4949
}
5050

5151
# test pwd error catch in getAbsolutePath for coverage mode by superseding

testsuite/modules.70-maint/090-source.exp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ if {![info exists env(COVERAGE)] && [cmpversion $tclsh_version 8.6] > -1} {
8383

8484
# move back to testsuite working directory
8585
cd $ORIG_CWD
86-
unset MODULECMD
86+
set MODULECMD $ORIG_MODULECMD
8787
}
8888

8989
# test existing modulefile

0 commit comments

Comments
 (0)