@@ -48,6 +48,13 @@ section_id_stack=()
4848section_counter=0
4949section_indent=" "
5050
51+ # Helper function to print errors in red
52+ print_error ()
53+ {
54+ local error_msg=" ${1} "
55+ echo -e " \e[31m[Error]: ${error_msg} \e[0m"
56+ }
57+
5158# GitLab CI collapsible section helpers with nesting support
5259section_start ()
5360{
175182
176183 if [[ -z ${spec} ]]
177184 then
178- echo " [Error]: SPEC is undefined, aborting..."
185+ section_end
186+ print_error " SPEC is undefined, aborting..."
179187 exit 1
180188 fi
181189
@@ -226,13 +234,13 @@ then
226234 hostconfig_path=${hostconfigs[0]}
227235 elif [[ ${# hostconfigs[@]} == 0 ]]
228236 then
229- echo " [Error]: No result for: ${project_dir} /*.cmake"
230- echo " [Error]: Spack generated host-config not found."
237+ print_error " No result for: ${project_dir} /*.cmake"
238+ print_error " Spack generated host-config not found."
231239 exit 1
232240 else
233- echo " [Error]: More than one result for: ${project_dir} /*.cmake"
234- echo " [Error]: ${hostconfigs[@]} "
235- echo " [Error]: Please specify one with HOST_CONFIG variable"
241+ print_error " More than one result for: ${project_dir} /*.cmake"
242+ print_error " ${hostconfigs[@]} "
243+ print_error " Please specify one with HOST_CONFIG variable"
236244 exit 1
237245 fi
238246else
290298 ${project_dir}
291299 then
292300 section_end
293- echo " [Error]: CMake configuration failed, dumping output..."
301+ print_error " CMake configuration failed, dumping output..."
294302 section_start " cmake_config_verbose" " Verbose CMake Configuration"
295303 if ! $cmake_exe \
296304 -C ${hostconfig_path} \
312320 if ! $cmake_exe --build . -j ${core_counts[$truehostname]}
313321 then
314322 section_end
315- echo " [Error]: Compilation failed, building with verbose output..."
323+ print_error " Compilation failed, building with verbose output..."
316324 section_start " build_verbose" " Verbose Rebuild" " collapsed"
317325 $cmake_exe --build . --verbose -j 1
318326 section_end
322330 if ! $cmake_exe --install .
323331 then
324332 section_end
325- echo " [Error]: Installation failed."
333+ print_error " Installation failed."
326334 exit 1
327335 fi
328336 section_end
335343
336344 if [[ ! -d ${build_dir} ]]
337345 then
338- echo " [Error]: Build directory not found : ${build_dir} " && exit 1
346+ print_error " Build directory not found : ${build_dir} "
347+ exit 1
339348 fi
340349
341350 cd ${build_dir}
360369 no_test_str=" No tests were found!!!"
361370 if [[ " $( tail -n 1 tests_output.txt) " == " ${no_test_str} " ]]
362371 then
363- echo " [Error]: No tests were found" && exit 1
372+ section_end
373+ print_error " No tests were found"
374+ exit 1
364375 fi
365376
366377 tree Testing
369380
370381 if grep -q " Errors while running CTest" ./tests_output.txt
371382 then
372- echo " [Error]: Failure(s) while running CTest" && exit 1
383+ section_end
384+ print_error " Failure(s) while running CTest"
385+ exit 1
373386 fi
374387 section_end
375388
@@ -381,17 +394,23 @@ then
381394 else
382395 if [[ ! -d ${install_dir} ]]
383396 then
384- echo " [Error]: Install directory not found : ${install_dir} " && exit 1
397+ section_end
398+ print_error " Install directory not found : ${install_dir} "
399+ exit 1
385400 fi
386401
387402 cd ${install_dir} /examples/umpire/using-with-cmake
388403 mkdir build && cd build
389404 if ! $cmake_exe -C ../host-config.cmake ..; then
390- echo " [Error]: Running $cmake_exe for using-with-cmake test" && exit 1
405+ section_end
406+ print_error " Running $cmake_exe for using-with-cmake test"
407+ exit 1
391408 fi
392409
393410 if ! make; then
394- echo " [Error]: Running make for using-with-cmake test" && exit 1
411+ section_end
412+ print_error " Running make for using-with-cmake test"
413+ exit 1
395414 fi
396415 section_end
397416 fi
0 commit comments