Debian Codegraph @

.gitlab/scripts/baseline

raw
1 #!/bin/bash
2
3 # Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
4 # at the Lawrence Livermore National Laboratory. All Rights reserved. See files
5 # LICENSE and NOTICE for details. LLNL-CODE-806117.
6 #
7 # This file is part of the MFEM library. For more information and source code
8 # availability visit https://mfem.org.
9 #
10 # MFEM is free software; you can redistribute it and/or modify it under the
11 # terms of the BSD-3 license. We welcome feedback and contributions, see file
12 # CONTRIBUTING.md for details.
13
14 # locals
15 glob_err=${BASELINE_TEST}.err
16 base=${BASELINE_TEST}-${SYS_TYPE}
17 if [[ "${MACHINE_NAME}" == "dane" ]]; then
18 base="${BASELINE_TEST}-${MACHINE_NAME}"
19 fi
20 base_diff=${base}.diff
21 base_patch=${base}.patch
22 base_out=${base}.out
23 artifacts_path=${CI_PROJECT_DIR}/${ARTIFACTS_DIR}
24
25 # prepare
26 cd ${BUILD_ROOT} || \
27 { echo "Invalid BUILD_ROOT=$BUILD_ROOT"; exit 1; }
28 ln -snf ${CI_PROJECT_DIR} mfem
29 cd tests
30 [[ -d _${BASELINE_TEST} ]] && rm -rf _${BASELINE_TEST}
31 mkdir _${BASELINE_TEST} && cd _${BASELINE_TEST}
32
33 # run
34 if [[ "${MACHINE_NAME}" == "dane" ]]; then
35 salloc --nodes=1 -t 60 --exclusive --reservation=ci ../runtest ../../mfem "${BASELINE_TEST} ${TPLS_DIR}"
36 elif [[ ${MACHINE_NAME} == "corona" ]]; then
37 salloc --nodes=1 -t 60 -p pbatch ../runtest ../../mfem "${BASELINE_TEST} ${TPLS_DIR}"
38 else
39 echo "Unknown machine: MACHINE_NAME=$MACHINE_NAME"
40 exit 1
41 fi
42 status="$?"
43
44 # post
45 mkdir ${artifacts_path}
46
47 if [[ -f ${BASELINE_TEST}.out ]]; then
48 cp ${BASELINE_TEST}.out ${artifacts_path}
49 fi
50 if [[ -s ${glob_err} ]]; then
51 echo "ERROR during ${BASELINE_TEST} execution"
52 echo "Here is the ${glob_err} file content"
53 cat ${glob_err}
54 cp ${glob_err} ${artifacts_path}/${glob_err}
55 status=1
56 fi
57 if [[ -f ${base_patch} ]]; then
58 echo "${BASELINE_TEST}: Differences found, patch generated"
59 cp ${base_patch} ${artifacts_path}/${base_patch}
60 elif [[ -f ${base_out} ]]; then
61 echo "${BASELINE_TEST}: Differences found, replacement file generated"
62 cp ${base_out} ${artifacts_path}/${base_out}
63 fi
64 # base_diff won't even exist if there is no difference.
65 if [[ -f ${base_diff} ]]; then
66 echo "${BASELINE_TEST}: Relevant differences (filtered diff) ..."
67 cat ${base_diff}
68 cp ${base_diff} ${artifacts_path}/${base_diff}
69 status=1
70 fi
71 if [[ $status -eq 0 ]]; then
72 echo "${BASELINE_TEST}: PASSED"
73 else
74 echo "${BASELINE_TEST}: FAILED"
75 fi
76 exit $status