Skip to content

Commit e201184

Browse files
authored
Make settings.py a regular file (#187)
* Settings are no more a symlink - Sphinx versioning does not like it and cannot produce the docs correctly.
1 parent 1b87c0d commit e201184

File tree

4 files changed

+145
-146
lines changed

4 files changed

+145
-146
lines changed

Jenkinsfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
def dirPrefix = 'reframe-ci'
44
def loginBash = '#!/bin/bash -l'
55
def bashScript = 'ci-scripts/ci-runner.bash'
6-
def cscsSettings = 'config/cscs.py'
76
def machinesList = ['daint', 'dom', 'kesch', 'leone', 'monch']
87
def machinesToRun = machinesList
98
def uniqueID
@@ -91,7 +90,6 @@ stage('Unittest') {
9190
checkout scm
9291
sh("""${loginBash}
9392
${moduleDefinition}
94-
ln -sf ../${cscsSettings} reframe/settings.py
9593
bash ${reframeDir}/${bashScript} -f ${reframeDir} -i ''""")
9694
}
9795
}
@@ -134,7 +132,7 @@ stage('Public Test') {
134132
def reframeDir = "${scratch}/${dirPrefix}-dom-${uniqueID}"
135133
dir(reframeDir) {
136134
sh("""${loginBash}
137-
bash ${reframeDir}/$bashScript -f ${reframeDir} -i '' -p""")
135+
bash ${reframeDir}/$bashScript -f ${reframeDir} -i '' -g""")
138136
}
139137
}
140138
currentBuild.result = "SUCCESS"

ci-scripts/ci-runner.bash

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
#!/bin/bash
22

3-
##############################################################################
4-
#
5-
#
6-
# SCRIPT VARIABLES
7-
#
8-
#
9-
##############################################################################
103
scriptname=`basename $0`
114
CI_FOLDER=""
12-
CI_PUBLIC=0
5+
CI_GENERIC=0
136
CI_TUTORIAL=0
147
TERM="${TERM:-xterm}"
158
PROFILE=""
@@ -31,7 +24,7 @@ Usage: $(tput setaf 1)$scriptname$(tput sgr0) $(tput setaf 3)[OPTIONS]$(tput sgr
3124
$(tput setaf 3)-i | --invocation$(tput sgr0) $(tput setaf 1)ARGS$(tput sgr0) invocation for modified user checks. Multiple \`-i' options are multiple invocations
3225
$(tput setaf 3)-l | --load-profile$(tput sgr0) $(tput setaf 1)ARGS$(tput sgr0) sources the given file before any execution of commands
3326
$(tput setaf 3)-m | --module-use$(tput sgr0) $(tput setaf 1)ARGS$(tput sgr0) executes module use of the give folder before loading the regression
34-
$(tput setaf 3)-p | --public-only$(tput sgr0) executes only the public version of the unittests
27+
$(tput setaf 3)-g | --generic-only$(tput sgr0) executes unit tests using the generic configuration
3528
$(tput setaf 3)-t | --tutorial-only$(tput sgr0) executes only the modified/new tutorial tests
3629
$(tput setaf 3)-h | --help$(tput sgr0) prints this help and exits
3730
@@ -68,23 +61,25 @@ run_serial_user_checks()
6861
}
6962

7063

71-
##############################################################################
72-
#
73-
#
74-
# MAIN SCRIPT
75-
#
76-
#
77-
##############################################################################
64+
save_settings()
65+
{
66+
tempfile=$(mktemp)
67+
cp reframe/settings.py $tempfile
68+
echo $tempfile
69+
}
7870

79-
#
80-
# Getting the machine name from the cmd line arguments
81-
#
71+
restore_settings()
72+
{
73+
saved=$1
74+
cp $saved reframe/settings.py
75+
/bin/rm $saved
76+
}
8277

83-
#
84-
# GNU Linux version
85-
#
86-
shortopts="h,p,t,f:,i:,l:,m:"
87-
longopts="help,public-only,tutorial-only,folder:,invocation:,load-profile:,module-use:"
78+
79+
### Main script ###
80+
81+
shortopts="h,g,t,f:,i:,l:,m:"
82+
longopts="help,generic-only,tutorial-only,folder:,invocation:,load-profile:,module-use:"
8883

8984
eval set -- $(getopt -o ${shortopts} -l ${longopts} \
9085
-n ${scriptname} -- "$@" 2> /dev/null)
@@ -113,9 +108,9 @@ while [ $# -ne 0 ]; do
113108
-m | --module-use)
114109
shift
115110
MODULEUSE="$1" ;;
116-
-p | --public-only)
111+
-g | --generic-only)
117112
shift
118-
CI_PUBLIC=1 ;;
113+
CI_GENERIC=1 ;;
119114
-t | --tutorial-only)
120115
shift
121116
CI_TUTORIAL=1 ;;
@@ -162,19 +157,19 @@ module list
162157
cd ${CI_FOLDER}
163158
echo "Running regression on $(hostname) in ${CI_FOLDER}"
164159

165-
if [ $CI_PUBLIC -eq 1 ]; then
160+
if [ $CI_GENERIC -eq 1 ]; then
166161
# Run unit tests for the public release
167-
ln -sf ../config/generic.py reframe/settings.py
168-
169-
echo "================================="
170-
echo "Running public release unit tests"
171-
echo "================================="
162+
echo "========================================"
163+
echo "Running unit tests with generic settings"
164+
echo "========================================"
172165
checked_exec ./test_reframe.py
173166
checked_exec ! ./bin/reframe.py --system=generic -l 2>&1 | \
174167
grep -- '--- Logging error ---'
175168
elif [ $CI_TUTORIAL -eq 1 ]; then
176169
# Run tutorial checks
177-
ln -sf ../tutorial/config/settings.py reframe/settings.py
170+
settings_orig=$(save_settings)
171+
cp tutorial/config/settings.py reframe/settings.py
172+
178173
# Find modified or added tutorial checks
179174
tutorialchecks=( $(git log --name-status --oneline --no-merges -1 | \
180175
awk '/^[AM]/ { print $2 } /^R0[0-9][0-9]/ { print $3 }' | \
@@ -186,20 +181,25 @@ elif [ $CI_TUTORIAL -eq 1 ]; then
186181
tutorialchecks_path="${tutorialchecks_path} -c ${check}"
187182
done
188183

189-
echo "===================="
184+
echo "========================"
190185
echo "Modified tutorial checks"
191-
echo "===================="
186+
echo "========================"
192187
echo ${tutorialchecks_path}
193188

194189
for i in ${!invocations[@]}; do
195190
run_tutorial_checks ${tutorialchecks_path} ${invocations[i]}
196191
done
197192
fi
193+
194+
restore_settings $settings_orig
198195
else
199196
# Performing the unittests
200197
echo "=================="
201198
echo "Running unit tests"
202199
echo "=================="
200+
settings_orig=$(save_settings)
201+
cp config/cscs.py reframe/settings.py
202+
203203
checked_exec ./test_reframe.py
204204

205205
# Find modified or added user checks
@@ -226,5 +226,7 @@ else
226226
run_serial_user_checks ${userchecks_path} ${invocations[i]}
227227
done
228228
fi
229+
230+
restore_settings $settings_orig
229231
fi
230232
exit $CI_EXITCODE

config/generic.py

Lines changed: 0 additions & 107 deletions
This file was deleted.

reframe/settings.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

reframe/settings.py

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#
2+
# Regression settings
3+
#
4+
5+
6+
class ReframeSettings:
7+
_reframe_module = 'reframe'
8+
_job_poll_intervals = [1, 2, 3]
9+
_job_submit_timeout = 60
10+
_checks_path = ['checks/']
11+
_checks_path_recurse = True
12+
_site_configuration = {
13+
'systems': {
14+
# Generic system used also in unit tests
15+
'generic': {
16+
'descr': 'Generic example system',
17+
18+
# Adjust to your system's hostname
19+
'hostnames': ['localhost'],
20+
'partitions': {
21+
'login': {
22+
'scheduler': 'local',
23+
'modules': [],
24+
'access': [],
25+
'environs': ['builtin-gcc'],
26+
'descr': 'Login nodes'
27+
}
28+
}
29+
}
30+
},
31+
32+
'environments': {
33+
'*': {
34+
'builtin': {
35+
'type': 'ProgEnvironment',
36+
'cc': 'cc',
37+
'cxx': '',
38+
'ftn': '',
39+
},
40+
41+
'builtin-gcc': {
42+
'type': 'ProgEnvironment',
43+
'cc': 'gcc',
44+
'cxx': 'g++',
45+
'ftn': 'gfortran',
46+
}
47+
}
48+
}
49+
}
50+
51+
_logging_config = {
52+
'level': 'DEBUG',
53+
'handlers': {
54+
'reframe.log': {
55+
'level': 'DEBUG',
56+
'format': '[%(asctime)s] %(levelname)s: '
57+
'%(check_info)s: %(message)s',
58+
'append': False,
59+
},
60+
61+
# Output handling
62+
'&1': {
63+
'level': 'INFO',
64+
'format': '%(message)s'
65+
},
66+
'reframe.out': {
67+
'level': 'INFO',
68+
'format': '%(message)s',
69+
'append': False,
70+
}
71+
}
72+
}
73+
74+
@property
75+
def version(self):
76+
return self._version
77+
78+
@property
79+
def reframe_module(self):
80+
return self._reframe_module
81+
82+
@property
83+
def job_poll_intervals(self):
84+
return self._job_poll_intervals
85+
86+
@property
87+
def job_submit_timeout(self):
88+
return self._job_submit_timeout
89+
90+
@property
91+
def checks_path(self):
92+
return self._checks_path
93+
94+
@property
95+
def checks_path_recurse(self):
96+
return self._checks_path_recurse
97+
98+
@property
99+
def site_configuration(self):
100+
return self._site_configuration
101+
102+
@property
103+
def logging_config(self):
104+
return self._logging_config
105+
106+
107+
settings = ReframeSettings()

0 commit comments

Comments
 (0)