Skip to content

Commit e385556

Browse files
committed
Install mock scontrol only when the real one is not there
1 parent cf08b62 commit e385556

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/test_pmix_hook.bats

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@ EOS
3434
export PATH=${TMP_BIN_DIR}:${PATH}
3535
fi
3636

37+
# Derive SlurmdSpoolDir and TmpFS paths
38+
scontrol show config | awk '/^SlurmdSpoolDir|^TmpFS/ {print $3}' | \
39+
{ read -r SLURMD_SPOOL_DIR; read -r SLURM_TMPFS; } || :
40+
3741
# Prepare mock PMIx directories
3842
SLURM_JOB_UID=0
3943
SLURM_JOB_ID=1
4044
SLURM_STEP_ID=2
41-
PMIX_DIR=/tmp/spool/slurmd/pmix.${SLURM_JOB_ID}.${SLURM_STEP_ID}
45+
PMIX_DIR=$SLURMD_SPOOL_DIR/pmix.${SLURM_JOB_ID}.${SLURM_STEP_ID}
4246
mkdir -p ${PMIX_DIR}
4347

4448
# Export test environment variables
@@ -70,7 +74,7 @@ teardown() {
7074
}
7175

7276
@test "pmix_hook binds directory (nofail spmix_appdir)" {
73-
SPMIX_APPDIR_UID_DIR=/tmp/spmix_appdir_${SLURM_JOB_UID}_${SLURM_JOB_ID}.${SLURM_STEP_ID}
77+
SPMIX_APPDIR_UID_DIR=${SLURM_TMPFS}/spmix_appdir_${SLURM_JOB_UID}_${SLURM_JOB_ID}.${SLURM_STEP_ID}
7478
rm -rf ${SPMIX_APPDIR_UID_DIR} || true
7579
export SLURM_JOB_UID=${SLURM_JOB_UID}
7680

@@ -83,7 +87,7 @@ teardown() {
8387
}
8488

8589
@test "pmix_hook binds directory (with SLURM_JOB_UID)" {
86-
SPMIX_APPDIR_UID_DIR=/tmp/spmix_appdir_${SLURM_JOB_UID}_${SLURM_JOB_ID}.${SLURM_STEP_ID}
90+
SPMIX_APPDIR_UID_DIR=${SLURM_TMPFS}/spmix_appdir_${SLURM_JOB_UID}_${SLURM_JOB_ID}.${SLURM_STEP_ID}
8791
mkdir -p ${SPMIX_APPDIR_UID_DIR}
8892
chown $(whoami) ${SPMIX_APPDIR_UID_DIR}
8993
export SLURM_JOB_UID=${SLURM_JOB_UID}
@@ -100,7 +104,7 @@ teardown() {
100104
}
101105

102106
@test "pmix_hook binds directory (no SLURM_JOB_UID)" {
103-
SPMIX_APPDIR_NO_UID_DIR=/tmp/spmix_appdir_${SLURM_JOB_ID}.${SLURM_STEP_ID}
107+
SPMIX_APPDIR_NO_UID_DIR=${SLURM_TMPFS}/spmix_appdir_${SLURM_JOB_ID}.${SLURM_STEP_ID}
104108
mkdir -p ${SPMIX_APPDIR_NO_UID_DIR}
105109
chown $(whoami) ${SPMIX_APPDIR_NO_UID_DIR}
106110
unset SLURM_JOB_UID

0 commit comments

Comments
 (0)