@@ -132,56 +132,42 @@ else
132132fi
133133
134134# Configure ReFrame, see https://www.eessi.io/docs/test-suite/installation-configuration
135- export RFM_CONFIG_FILES=$TOPDIR /reframe_config_bot.py
136- export RFM_CONFIG_FILE_TEMPLATE=$TOPDIR /reframe_config_bot.py.tmpl
135+ # RFM_CONFIG_FILES _has_ to be set by the site hosting the bot, so that it knows where to find the ReFrame
136+ # config file that matches the bot config. See https://gitlab.com/eessi/support/-/issues/114#note_2293660921
137+ if [ -z " $RFM_CONFIG_FILES " ]; then
138+ if [ -z " ${shared_fs_path} " ]; then
139+ fatal_error " Environment variable 'shared_fs_path' was expected, but was not set"
140+ fi
141+ # Try to find a config file at $shared_fs_path/reframe_config.py
142+ export RFM_CONFIG_FILES=" ${shared_fs_path} /reframe_config.py"
143+ if [ ! -f " ${RFM_CONFIG_FILES} " ]; then
144+ # If we haven't found the ReFrame config, print an informative error
145+ err_msg=" Please put a ReFrame configuration file in ${shared_fs_path} /reframe_config.py"
146+ err_msg=" ${err_msg} or set RFM_CONFIG_FILES in the environment of this bot instance to point to a valid"
147+ err_msg=" ${err_msg} ReFrame configuration file that matches the bot config."
148+ err_msg=" ${err_msg} For more information, see https://gitlab.com/eessi/support/-/issues/114#note_2293660921"
149+ fatal_error " ${err_msg} "
150+ fi
151+ fi
137152export RFM_CHECK_SEARCH_PATH=$TESTSUITEPREFIX /eessi/testsuite/tests
138153export RFM_CHECK_SEARCH_RECURSIVE=1
139154export RFM_PREFIX=$PWD /reframe_runs
140155
141- echo " Configured reframe with the following environment variables:"
142- env | grep " RFM_"
143-
144- # The /sys inside the container is not the same as the /sys of the host
145- # We want to extract the memory limit from the cgroup on the host (which is typically set by SLURM).
146- # Thus, bot/test.sh bind-mounts the host's /sys/fs/cgroup into /hostsys/fs/cgroup
147- # and that's the prefix we use to extract the memory limit from
148- cgroup_v1_mem_limit=" /hostsys/fs/cgroup/memory/$( < /proc/self/cpuset) /memory.limit_in_bytes"
149- cgroup_v2_mem_limit=" /hostsys/fs/cgroup/$( < /proc/self/cpuset) /memory.max"
150- if [ -f " $cgroup_v1_mem_limit " ]; then
151- echo " Getting memory limit from file $cgroup_v1_mem_limit "
152- cgroup_mem_bytes=$( cat " $cgroup_v1_mem_limit " )
153- elif [ -f " $cgroup_v2_mem_limit " ]; then
154- echo " Getting memory limit from file $cgroup_v2_mem_limit "
155- cgroup_mem_bytes=$( cat " $cgroup_v2_mem_limit " )
156- if [ " $cgroup_mem_bytes " = ' max' ]; then
157- # In cgroupsv2, the memory.max file may contain 'max', meaning the group can use the full system memory
158- # Here, we get the system memory from /proc/meminfo. Units are supposedly always in kb, but lets match them too
159- cgroup_mem_kilobytes=$( grep -oP ' MemTotal:\s+\K\d+(?=\s+kB)' /proc/meminfo)
160- if [[ $? -ne 0 ]] || [[ -z " $cgroup_mem_kilobytes " ]]; then
161- fatal_error " Failed to get memory limit from /proc/meminfo"
162- fi
163- cgroup_mem_bytes=$(( "$cgroup_mem_kilobytes "* 1024 ))
164- fi
165- else
166- fatal_error " Both files ${cgroup_v1_mem_limit} and ${cgroup_v2_mem_limit} couldn't be found. Failed to get the memory limit from the current cgroup"
156+ # Get the correct partition name
157+ REFRAME_PARTITION_NAME=${EESSI_SOFTWARE_SUBDIR// \/ / _}
158+ if [ ! -z " $EESSI_ACCELERATOR_TARGET " ]; then
159+ REFRAME_PARTITION_NAME=${REFRAME_PARTITION_NAME} _${EESSI_ACCELERATOR_TARGET// \/ / _}
167160fi
168- if [[ $? -eq 0 ]]; then
169- # Convert to MiB
170- cgroup_mem_mib=$(( "$cgroup_mem_bytes "/ (1024 * 1024 )) )
171- else
172- fatal_error " Failed to get the memory limit in bytes from the current cgroup"
173- fi
174- echo " Detected available memory: ${cgroup_mem_mib} MiB"
161+ echo " Constructed partition name based on EESSI_SOFTWARE_SUBDIR and EESSI_ACCELERATOR_TARGET: ${REFRAME_PARTITION_NAME} "
175162
176- cp ${RFM_CONFIG_FILE_TEMPLATE} ${RFM_CONFIG_FILES}
177- echo " Replacing memory limit in the ReFrame config file with the detected CGROUP memory limit: ${cgroup_mem_mib} MiB"
178- sed -i " s/__MEM_PER_NODE__/${cgroup_mem_mib} /g" $RFM_CONFIG_FILES
179- RFM_PARTITION=" ${SLURM_JOB_PARTITION} "
180- echo " Replacing partition name in the template ReFrame config file: ${RFM_PARTITION} "
181- sed -i " s/__RFM_PARTITION__/${RFM_PARTITION} /g" $RFM_CONFIG_FILES
163+ # Set the reframe system name, including partition
164+ export RFM_SYSTEM=" BotBuildTests:${REFRAME_PARTITION_NAME} "
165+
166+ echo " Configured reframe with the following environment variables:"
167+ env | grep " RFM_"
182168
183169# Make debugging easier by printing the final config file:
184- echo " Final config file (after replacements) :"
170+ echo " ReFrame config file used :"
185171cat " ${RFM_CONFIG_FILES} "
186172
187173# Workaround for https://github.com/EESSI/software-layer/pull/467#issuecomment-1973341966
@@ -217,7 +203,18 @@ else
217203 fatal_error " Failed to extract names of tests to run: ${REFRAME_NAME_ARGS} "
218204 exit ${test_selection_exit_code}
219205fi
220- export REFRAME_ARGS=" --tag CI --tag 1_node --nocolor ${REFRAME_NAME_ARGS} "
206+ # Allow people deploying the bot to overrwide this
207+ if [ -z " $REFRAME_SCALE_TAG " ]; then
208+ REFRAME_SCALE_TAG=" --tag 1_node"
209+ fi
210+ if [ -z " $REFRAME_CI_TAG " ]; then
211+ REFRAME_CI_TAG=" --tag CI"
212+ fi
213+ # Allow bot-deployers to add additional args through the environment
214+ if [ -z " $REFRAME_ADDITIONAL_ARGS " ]; then
215+ REFRAME_ADDITIONAL_ARGS=" "
216+ fi
217+ export REFRAME_ARGS=" ${REFRAME_CI_TAG} ${REFRAME_SCALE_TAG} ${REFRAME_ADDITIONAL_ARGS} --nocolor ${REFRAME_NAME_ARGS} "
221218
222219# List the tests we want to run
223220echo " Listing tests: reframe ${REFRAME_ARGS} --list"
0 commit comments