Skip to content

Commit b9feeeb

Browse files
committed
script for testing the compat layer with reframe
1 parent 92b6192 commit b9feeeb

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

test_compatibility_layer.sh

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#!/bin/bash
2+
3+
EESSI_REPO_DIR=${EESSI_CVMFS_REPO:-/cvmfs/software.eessi.io}
4+
EESSI_VERSION=${EESSI_VERSION:-2023.06}
5+
EESSI_ARCH=${EESSI_CPU_FAMILY:-$(uname -m)}
6+
EESSI_OS=${EESSI_OS_TYPE:-linux}
7+
8+
display_help() {
9+
echo "usage: $0 [OPTIONS]"
10+
echo "OPTIONS:"
11+
echo " -a | --arch ARCHITECTURE"
12+
echo " Architecture of compatibility layer to be tested"
13+
echo " [default: \$EESSI_CPU_FAMILY or current host's architecture]"
14+
echo ""
15+
echo " -g | --storage DIRECTORY"
16+
echo " directory space on host machine (used for"
17+
echo " temporary data) [default: 1. TMPDIR, 2. /tmp]"
18+
echo ""
19+
echo " -h | --help"
20+
echo " display this usage information"
21+
echo ""
22+
echo " -o | --os"
23+
echo " Operating system of compatibility to be tested"
24+
echo " [default: \$EESSI_OS_TYPE or linux]"
25+
echo ""
26+
echo " -r | --repository REPO"
27+
echo " CVMFS repository [default: \$EESSI_CVMFS_REPO or software.eessi.io]"
28+
echo " Note that this has to be mounted as /cvmfs/${REPOSITORY}!"
29+
echo ""
30+
echo " -v | --version VERSION"
31+
echo " version of EESSI stack to be tested [default: \$EESSI_VERSION or 2023.06]"
32+
echo ""
33+
echo " --verbose"
34+
echo " increase verbosity of output [default: not set]"
35+
echo
36+
}
37+
38+
POSITIONAL_ARGS=()
39+
40+
while [[ $# -gt 0 ]]; do
41+
case $1 in
42+
-a|--arch)
43+
EESSI_ARCH="$2"
44+
shift 2
45+
;;
46+
-g|--storage)
47+
STORAGE="$2"
48+
shift 2
49+
;;
50+
-h|--help)
51+
display_help
52+
exit 0
53+
;;
54+
-o|--os)
55+
EESSI_OS="$2"
56+
shift 2
57+
;;
58+
-r|--repository)
59+
EESSI_REPO_DIR="/cvmfs/$2"
60+
shift 2
61+
;;
62+
-v|--version)
63+
EESSI_VERSION="$2"
64+
shift 2
65+
;;
66+
--verbose)
67+
VERBOSE="-vvv"
68+
shift 1
69+
;;
70+
-*|--*)
71+
fatal_error "Unknown option: $1" "${CMDLINE_ARG_UNKNOWN_EXITCODE}"
72+
;;
73+
*) # No more options
74+
POSITIONAL_ARGS+=("$1") # save positional arg
75+
shift
76+
;;
77+
esac
78+
done
79+
80+
set -- "${POSITIONAL_ARGS[@]}"
81+
82+
83+
COMPAT_LAYER_PREFIX="${EESSI_REPO_DIR}/versions/${EESSI_VERSION}/compat/${EESSI_OS}/${EESSI_ARCH}"
84+
if [ ! -d ${COMPAT_LAYER_PREFIX} ]; then
85+
echo "Directory ${COMPAT_LAYER_PREFIX} does not exist, please provide a correct path, version, and architecture."
86+
exit 1
87+
fi
88+
if [ ! -f ${COMPAT_LAYER_PREFIX}/startprefix ]; then
89+
echo "Cannot find a startprefix file in ${COMPAT_LAYER_PREFIX}!"
90+
exit 1
91+
fi
92+
93+
# We assume that this script is located in a directory containing a full checkout of the git repo,
94+
# and verify this by checking for the existance of the ReFrame test script.
95+
SCRIPT_DIR=$(dirname $(realpath $0))
96+
if [ ! -f "${SCRIPT_DIR}/test/compat_layer.py" ]; then
97+
echo "ReFrame test script compat_layer.py cannot be found!"
98+
echo "Make sure to run this script from a directory containing a the compatibility-layer git repository."
99+
exit 1
100+
fi
101+
102+
if [ -z ${EESSI_TMPDIR} ];
103+
then
104+
EESSI_TMPDIR=$(mktemp -t -d eessi.XXXXXXXXXX)
105+
fi
106+
107+
echo "Using ${EESSI_TMPDIR} as temporary directory."
108+
109+
if ! command -v "reframe" &>/dev/null; then
110+
echo "ReFrame command not found, trying to install it to a temporary directory..."
111+
pip3 install --ignore-installed -t ${EESSI_TMPDIR}/reframe reframe-hpc
112+
export PYTHONPATH=${EESSI_TMPDIR}/reframe
113+
export PATH="${EESSI_TMPDIR}/reframe/bin/:${PATH}"
114+
fi
115+
116+
echo "Trying to run 'reframe --version' as sanity check..."
117+
if ! reframe --version; then
118+
echo "Cannot run ReFrame, giving up. Please install it manually and add it to your \$PATH."
119+
exit 1
120+
fi
121+
122+
echo "Running the tests with: ${EESSI_TMPDIR}/reframe/bin/reframe -r -v -c ${SCRIPT_DIR}/test/compat_layer.py"
123+
export EESSI_REPO_DIR EESSI_VERSION EESSI_ARCH EESSI_OS
124+
export RFM_PREFIX=$PWD/reframe_runs
125+
${EESSI_TMPDIR}/reframe/bin/reframe --nocolor -r -v -c ${SCRIPT_DIR}/test/compat_layer.py
126+

0 commit comments

Comments
 (0)