Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run test suite based on pr366 #70

Open
wants to merge 69 commits into
base: 2023.06-software.eessi.io
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
6cc2e3e
first version of bot/test.sh script
truib Oct 14, 2023
9a32dc6
scripts to run tests after a build job has finished
truib Oct 15, 2023
17cfd02
small adjustments to test script
truib Oct 15, 2023
0f3646e
Second attempt at having the bot run the test suite, now based on Tho…
Feb 5, 2024
e8c91eb
Merge upstream into old feature branch based on pr366
Feb 5, 2024
34fca15
Make a very simple change to an easystack file so we are able to trig…
Feb 5, 2024
3faae9d
Make scripts executable
Feb 6, 2024
081e2b1
Check for existence of SLURM output first
Feb 6, 2024
9b6fa73
Clarify return messages from the bot
Feb 6, 2024
cb48b36
Use EESSI_SOFTWARE_PATH instead of EASYBUILD_INSTALLPATH to set the m…
Feb 6, 2024
d1a0219
Do git clone in a seperate script, so that that can be run in the pre…
Feb 6, 2024
86d5d3d
Should use the one from current dir
Feb 6, 2024
7861aec
Remove quotes, see if that helps
Feb 6, 2024
a7b5ee1
Apparently, we need to remove curly braces too
Feb 6, 2024
f50e463
Make sure this actually gets reported as failure, as the ReFrame runt…
Feb 6, 2024
f67df9b
Fix the actual issue: make sure that two arguments are interpreted se…
Feb 6, 2024
3394851
See if we can make check-test formatting more fancy
Feb 6, 2024
8e5682a
Replace the env var for the result file
Feb 6, 2024
6cf0cf9
Add missing functions
Feb 6, 2024
7fe24e1
Remove artefacts from reporting
Feb 6, 2024
afc309a
Add a reason for the failure
Feb 6, 2024
b84e487
Fixed missing bracket
Feb 6, 2024
ef7bc01
Add reporting of the ReFrame result
Feb 6, 2024
867681a
Add missing bracket. Again
Feb 6, 2024
47e30ca
Add some echo for debugging
Feb 6, 2024
1bdadf8
more debugging output
Feb 6, 2024
5152f5e
Lets try some nicer formatting with headers etc. See if this actually…
Feb 6, 2024
ea38c66
Inverse check, it was incorrect
Feb 6, 2024
8edb6ff
Remove debugging output
Feb 6, 2024
26bd2cb
Correct the regex pattern to account for the fact that the slurm outp…
Feb 6, 2024
416b72d
Corrected typo
Feb 6, 2024
1990093
Trigger failure in the workflow on purpose, to show what that looks like
Feb 6, 2024
4b98856
Change order of checking error codes. If the ReFrame tests ran and we…
Feb 6, 2024
0f26142
Make sure we don't overwrite the grepped result from failures
Feb 7, 2024
94e0bb5
Fix plural/singular typo
Feb 7, 2024
9e7ac1c
Be a bit more expressive about what we are doing
Feb 7, 2024
3a52bde
Change to dedicated config file for testing by the bot in the build job
Feb 7, 2024
159e384
Make it verbose, see if we can see why autodetect fails
Feb 7, 2024
b92044e
Add ReFrame config template. Not that four template variables need to…
Feb 7, 2024
02b0e31
Use template config file and make replacements based on lscpu
Feb 7, 2024
58c4cfa
Fix incorrect variable name
Feb 7, 2024
2fc121e
Missing comma
Feb 7, 2024
db08f4f
Corrected typo
Feb 7, 2024
6b3a6cc
Remove verbose flags
Feb 7, 2024
a70b4f1
Pick name without spaces, to avoid issues with directories
Feb 7, 2024
ce24e6d
Pick more meaningful name for SLURM variable, namely SLURM_OUTPUT_FOUND
Feb 8, 2024
9881c2a
Correct erroneous status
Feb 8, 2024
1446055
Rename CoDeList variable to comment_details_list
Feb 8, 2024
f80c0eb
Remove commented section, it is not relevant
Feb 8, 2024
ff5baac
Update run_tests.sh
casparvl Feb 8, 2024
4adae18
Fix mistake in replacing SLURM with SLURM_OUTPUT_FOUND
Feb 8, 2024
848e387
Merge branch 'run_test_suite_based_on_pr366' of github.com:casparvl/s…
Feb 8, 2024
9e6955f
Change name of the template for the ReFrame config file to make clear…
Feb 8, 2024
08a7fd8
Fix typo in variable
Feb 8, 2024
8b5bde5
No longer needed
Feb 8, 2024
5d383eb
Added header, rephrased some comments
Feb 8, 2024
cdf7971
Fix headers
Feb 8, 2024
79a9ad3
Load default ReFrame version
Feb 8, 2024
2f280e4
Point to docs for ReFrame config
Feb 8, 2024
e5d60b9
Fix silly mistake: I was overwriting the ReFrame config file with eve…
Feb 8, 2024
b5c60cc
See if @boegel is correct and if we don't actually need ANY software …
Feb 8, 2024
69d6d2e
Add escape character to star, so that the regex pattern prints correc…
Feb 14, 2024
2dd048e
Add the list(SCALES.keys()) feature (though technically we could limi…
Feb 15, 2024
0492b9e
Try the original regex patterns, capturing spaces more specifically, …
Feb 15, 2024
8746a33
fix minor bug + add debug output
truib Feb 17, 2024
2e23bf0
list loaded modules and available Python modules
truib Feb 17, 2024
d56a9cd
run test suite in prefix env
truib Feb 17, 2024
359a457
source init script instead of running in compat layer
truib Feb 17, 2024
642a416
EESSI_CVMFS_REPO already contains '/cvmfs'
truib Feb 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions bot/check-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ job_dir=${PWD}
job_out="slurm-${SLURM_JOB_ID}.out"
[[ ${VERBOSE} -ne 0 ]] && echo ">> searching for job output file(s) matching '"${job_out}"'"
if [[ -f ${job_out} ]]; then
SLURM=1
SLURM_OUTPUT_FOUND=1
[[ ${VERBOSE} -ne 0 ]] && echo " found slurm output file '"${job_out}"'"
else
SLURM=0
SLURM_OUTPUT_FOUND=0
[[ ${VERBOSE} -ne 0 ]] && echo " Slurm output file '"${job_out}"' NOT found"
fi

ERROR=-1
if [[ ${SLURM} -eq 1 ]]; then
if [[ ${SLURM_OUTPUT_FOUND} -eq 1 ]]; then
GP_error='ERROR: '
grep_out=$(grep -v "^>> searching for " ${job_dir}/${job_out} | grep "${GP_error}")
[[ $? -eq 0 ]] && ERROR=1 || ERROR=0
Expand All @@ -116,7 +116,7 @@ if [[ ${SLURM} -eq 1 ]]; then
fi

FAILED=-1
if [[ ${SLURM} -eq 1 ]]; then
if [[ ${SLURM_OUTPUT_FOUND} -eq 1 ]]; then
GP_failed='FAILED: '
grep_out=$(grep -v "^>> searching for " ${job_dir}/${job_out} | grep "${GP_failed}")
[[ $? -eq 0 ]] && FAILED=1 || FAILED=0
Expand All @@ -126,7 +126,7 @@ if [[ ${SLURM} -eq 1 ]]; then
fi

MISSING=-1
if [[ ${SLURM} -eq 1 ]]; then
if [[ ${SLURM_OUTPUT_FOUND} -eq 1 ]]; then
GP_req_missing=' required modules missing:'
grep_out=$(grep -v "^>> searching for " ${job_dir}/${job_out} | grep "${GP_req_missing}")
[[ $? -eq 0 ]] && MISSING=1 || MISSING=0
Expand All @@ -136,7 +136,7 @@ if [[ ${SLURM} -eq 1 ]]; then
fi

NO_MISSING=-1
if [[ ${SLURM} -eq 1 ]]; then
if [[ ${SLURM_OUTPUT_FOUND} -eq 1 ]]; then
GP_no_missing='No missing installations'
grep_out=$(grep -v "^>> searching for " ${job_dir}/${job_out} | grep "${GP_no_missing}")
[[ $? -eq 0 ]] && NO_MISSING=1 || NO_MISSING=0
Expand All @@ -147,7 +147,7 @@ fi

TGZ=-1
TARBALL=
if [[ ${SLURM} -eq 1 ]]; then
if [[ ${SLURM_OUTPUT_FOUND} -eq 1 ]]; then
GP_tgz_created="\.tar\.gz created!"
grep_out=$(grep -v "^>> searching for " ${job_dir}/${job_out} | grep "${GP_tgz_created}" | sort -u)
if [[ $? -eq 0 ]]; then
Expand All @@ -171,7 +171,7 @@ fi

job_result_file=_bot_job${SLURM_JOB_ID}.result

if [[ ${SLURM} -eq 1 ]] && \
if [[ ${SLURM_OUTPUT_FOUND} -eq 1 ]] && \
[[ ${ERROR} -eq 0 ]] && \
[[ ${FAILED} -eq 0 ]] && \
[[ ${MISSING} -eq 0 ]] && \
Expand Down Expand Up @@ -334,35 +334,35 @@ echo -n "comment_description = " >> ${job_result_file}

comment_summary="${comment_summary_fmt/__SUMMARY__/${summary}}"

# first construct comment_details_list, abbreviated CoDeList
# first construct comment_details_list, abbreviated comment_details_list
# then use it to set comment_details
CoDeList=""
comment_details_list=""

success_msg="job output file <code>${job_out}</code>"
failure_msg="no job output file <code>${job_out}</code>"
CoDeList=${CoDeList}$(add_detail ${SLURM} 1 "${success_msg}" "${failure_msg}")
comment_details_list=${comment_details_list}$(add_detail ${SLURM_OUTPUT_FOUND} 1 "${success_msg}" "${failure_msg}")

success_msg="no message matching <code>${GP_error}</code>"
failure_msg="found message matching <code>${GP_error}</code>"
CoDeList=${CoDeList}$(add_detail ${ERROR} 0 "${success_msg}" "${failure_msg}")
comment_details_list=${comment_details_list}$(add_detail ${ERROR} 0 "${success_msg}" "${failure_msg}")

success_msg="no message matching <code>${GP_failed}</code>"
failure_msg="found message matching <code>${GP_failed}</code>"
CoDeList=${CoDeList}$(add_detail ${FAILED} 0 "${success_msg}" "${failure_msg}")
comment_details_list=${comment_details_list}$(add_detail ${FAILED} 0 "${success_msg}" "${failure_msg}")

success_msg="no message matching <code>${GP_req_missing}</code>"
failure_msg="found message matching <code>${GP_req_missing}</code>"
CoDeList=${CoDeList}$(add_detail ${MISSING} 0 "${success_msg}" "${failure_msg}")
comment_details_list=${comment_details_list}$(add_detail ${MISSING} 0 "${success_msg}" "${failure_msg}")

success_msg="found message(s) matching <code>${GP_no_missing}</code>"
failure_msg="no message matching <code>${GP_no_missing}</code>"
CoDeList=${CoDeList}$(add_detail ${NO_MISSING} 1 "${success_msg}" "${failure_msg}")
comment_details_list=${comment_details_list}$(add_detail ${NO_MISSING} 1 "${success_msg}" "${failure_msg}")

success_msg="found message matching <code>${GP_tgz_created}</code>"
failure_msg="no message matching <code>${GP_tgz_created}</code>"
CoDeList=${CoDeList}$(add_detail ${TGZ} 1 "${success_msg}" "${failure_msg}")
comment_details_list=${comment_details_list}$(add_detail ${TGZ} 1 "${success_msg}" "${failure_msg}")

comment_details="${comment_details_fmt/__DETAILS_LIST__/${CoDeList}}"
comment_details="${comment_details_fmt/__DETAILS_LIST__/${comment_details_list}}"


# first construct comment_artefacts_list, abbreviated CoArList
Expand Down
188 changes: 186 additions & 2 deletions bot/check-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,192 @@ job_dir=${PWD}
job_out="slurm-${SLURM_JOB_ID}.out"
job_test_result_file="_bot_job${SLURM_JOB_ID}.test"

# Check that job output file is found
[[ ${VERBOSE} -ne 0 ]] && echo ">> searching for job output file(s) matching '"${job_out}"'"
if [[ -f ${job_out} ]]; then
SLURM_OUTPUT_FOUND=1
[[ ${VERBOSE} -ne 0 ]] && echo " found slurm output file '"${job_out}"'"
else
SLURM_OUTPUT_FOUND=0
[[ ${VERBOSE} -ne 0 ]] && echo " Slurm output file '"${job_out}"' NOT found"
fi


# ReFrame prints e.g.
#[----------] start processing checks
#[ RUN ] GROMACS_EESSI %benchmark_info=HECBioSim/Crambin %nb_impl=cpu %scale=2_nodes %module_name=GROMACS/2021.3-foss-2021a /d597cff4 @snellius:rome+default
#[ RUN ] GROMACS_EESSI %benchmark_info=HECBioSim/Crambin %nb_impl=cpu %scale=2_nodes %module_name=GROMACS/2021.3-foss-2021a /d597cff4 @snellius:genoa+default
#[ RUN ] GROMACS_EESSI %benchmark_info=HECBioSim/Crambin %nb_impl=cpu %scale=1_cpn_2_nodes %module_name=GROMACS/2021.3-foss-2021a /f4194106 @snellius:genoa+default
#[ FAIL ] (1/3) GROMACS_EESSI %benchmark_info=HECBioSim/Crambin %nb_impl=cpu %scale=2_nodes %module_name=GROMACS/2021.3-foss-2021a /d597cff4 @snellius:genoa+default
#==> test failed during 'sanity': test staged in '/scratch-shared/casparl/reframe_output/staging/snellius/genoa/default/GROMACS_EESSI_d597cff4'
#[ OK ] (2/3) GROMACS_EESSI %benchmark_info=HECBioSim/Crambin %nb_impl=cpu %scale=2_nodes %module_name=GROMACS/2021.3-foss-2021a /d597cff4 @snellius:rome+default
#P: perf: 8.441 ns/day (r:0, l:None, u:None)
#[ FAIL ] (3/3) GROMACS_EESSI %benchmark_info=HECBioSim/Crambin %nb_impl=cpu %scale=1_cpn_2_nodes %module_name=GROMACS/2021.3-foss-2021a /f4194106 @snellius:genoa+default
#==> test failed during 'sanity': test staged in '/scratch-shared/casparl/reframe_output/staging/snellius/genoa/default/GROMACS_EESSI_f4194106'
#[----------] all spawned checks have finished
#[ FAILED ] Ran 3/3 test case(s) from 2 check(s) (2 failure(s), 0 skipped, 0 aborted)

# We will grep for the last and final line, since this reflects the overall result
# Specifically, we grep for FAILED, since this is also what we print if a step in the test script itself fails
FAILED=-1
if [[ ${SLURM_OUTPUT_FOUND} -eq 1 ]]; then
GP_failed='\[\s*FAILED\s*\].*Ran .* test case'
grep_reframe_failed=$(grep -v "^>> searching for " ${job_dir}/${job_out} | grep "${GP_failed}")
[[ $? -eq 0 ]] && FAILED=1 || FAILED=0
# have to be careful to not add searched for pattern into slurm out file
[[ ${VERBOSE} -ne 0 ]] && echo ">> searching for '"${GP_failed}"'"
[[ ${VERBOSE} -ne 0 ]] && echo "${grep_reframe_failed}"
fi

# Here, we grep for 'ERROR:', which is printed if a fatal_error is encountered when executing the test step
# I.e. this is an error in execution of the run_tests.sh itself, NOT in running the actual tests
ERROR=-1
if [[ ${SLURM_OUTPUT_FOUND} -eq 1 ]]; then
GP_error='ERROR: '
grep_out=$(grep -v "^>> searching for " ${job_dir}/${job_out} | grep "${GP_error}")
[[ $? -eq 0 ]] && ERROR=1 || ERROR=0
# have to be careful to not add searched for pattern into slurm out file
[[ ${VERBOSE} -ne 0 ]] && echo ">> searching for '"${GP_error}"'"
[[ ${VERBOSE} -ne 0 ]] && echo "${grep_out}"
fi

SUCCESS=-1
# Grep for the success pattern, so we can report the amount of tests run
if [[ ${SLURM_OUTPUT_FOUND} -eq 1 ]]; then
GP_success='\[\s*PASSED\s*\].*Ran .* test case'
grep_reframe_success=$(grep -v "^>> searching for " ${job_dir}/${job_out} | grep "${GP_success}")
[[ $? -eq 0 ]] && SUCCESS=1 || SUCCESS=0
# have to be careful to not add searched for pattern into slurm out file
[[ ${VERBOSE} -ne 0 ]] && echo ">> searching for '"${GP_success}"'"
[[ ${VERBOSE} -ne 0 ]] && echo "${grep_reframe_success}"
fi

if [[ ! -z ${grep_reframe_failed} ]]; then
grep_reframe_result=${grep_reframe_failed}
else
grep_reframe_result=${grep_reframe_success}
fi

echo "[TEST]" > ${job_test_result_file}
echo "comment_description = <em>(no tests yet)</em>" >> ${job_test_result_file}
echo "status = SUCCESS" >> ${job_test_result_file}
if [[ ${SLURM_OUTPUT_FOUND} -eq 0 ]]; then
summary=":cry: FAILURE"
reason="Job output file not found, cannot check test results."
status="FAILURE"
# Should come before general errors: if SUCCESS==1, it indicates the test suite ran succesfully
# regardless of other things that might have gone wrong
elif [[ ${SUCCESS} -eq 1 ]]; then
summary=":grin: SUCCESS"
reason=""
status="SUCCESS"
# Should come before general errors: if FAILED==1, it indicates the test suite ran
# otherwise the pattern wouldn't have been there
elif [[ ${FAILED} -eq 1 ]]; then
summary=":cry: FAILURE"
reason="EESSI test suite produced failures."
status="FAILURE"
elif [[ ${ERROR} -eq 1 ]]; then
summary=":cry: FAILURE"
reason="EESSI test suite was not run, test step itself failed to execute."
status="FAILURE"
else
summary=":grin: FAILURE"
reason="Failed for unknown reason"
status="FAILURE"
fi


echo "[TEST]" > ${job_test_result_file}
echo -n "comment_description = " >> ${job_test_result_file}

# Use template for writing PR comment with details
# construct and write complete PR comment details: implements third alternative
comment_template="<details>__SUMMARY_FMT__<dl>__REASON_FMT____REFRAME_FMT____DETAILS_FMT__</dl></details>"
comment_success_item_fmt=":white_check_mark: __ITEM__"
comment_failure_item_fmt=":x: __ITEM__"

# Initialize comment_description
comment_description=${comment_template}

# Now, start replacing template items one by one
comment_summary_fmt="<summary>__SUMMARY__ _(click triangle for details)_</summary>"
comment_summary="${comment_summary_fmt/__SUMMARY__/${summary}}"
comment_description=${comment_description/__SUMMARY_FMT__/${comment_summary}}


# Only add if there is a reason (e.g. no reason for successful runs)
if [[ ! -z ${reason} ]]; then
comment_reason_fmt="<dt>_Reason_</dt><dd>__REASONS__</dd>"
reason_details="${comment_reason_fmt/__REASONS__/${reason}}"
comment_description=${comment_description/__REASON_FMT__/${reason_details}}
else
comment_description=${comment_description/__REASON_FMT__/""}
fi

# Only add if there is a reframe summary (e.g. no reframe summary if reframe wasn't launched succesfully)
echo "ReFrame result:"
echo "${grep_reframe_result}"
if [[ ! -z ${grep_reframe_result} ]]; then
comment_reframe_fmt="<dt>_ReFrame Summary_</dt><dd>__REFRAME_SUMMARY__</dd>"
reframe_summary=${comment_reframe_fmt/__REFRAME_SUMMARY__/${grep_reframe_result}}
comment_description=${comment_description/__REFRAME_FMT__/${reframe_summary}}
else
comment_description=${comment_description/__REFRAME_FMT__/""}
fi

# Declare functions
function print_br_item() {
format="${1}"
item="${2}"
echo -n "${format//__ITEM__/${item}}<br/>"
}

function success() {
format="${comment_success_item_fmt}"
item="$1"
print_br_item "${format}" "${item}"
}

function failure() {
format="${comment_failure_item_fmt}"
item="$1"
print_br_item "${format}" "${item}"
}

function add_detail() {
actual=${1}
expected=${2}
success_msg="${3}"
failure_msg="${4}"
if [[ ${actual} -eq ${expected} ]]; then
success "${success_msg}"
else
failure "${failure_msg}"
fi
}

# first construct comment_details_list, abbreviated comment_details_list
# then use it to set comment_details
comment_details_list=""

success_msg="job output file <code>${job_out}</code>"
failure_msg="no job output file <code>${job_out}</code>"
comment_details_list=${comment_details_list}$(add_detail ${SLURM_OUTPUT_FOUND} 1 "${success_msg}" "${failure_msg}")

success_msg="no message matching <code>${GP_error}</code>"
failure_msg="found message matching <code>${GP_error}</code>"
comment_details_list=${comment_details_list}$(add_detail ${ERROR} 0 "${success_msg}" "${failure_msg}")

# Add an escape character to every *, for it to be printed correctly in the comment on GitHub
GP_failed="${GP_failed//\*/\\*}"
success_msg="no message matching <code>""${GP_failed}""</code>"
failure_msg="found message matching <code>""${GP_failed}""</code>"
comment_details_list=${comment_details_list}$(add_detail ${FAILED} 0 "${success_msg}" "${failure_msg}")

comment_details_fmt="<dt>_Details_</dt><dd>__DETAILS_LIST__</dd>"
comment_details="${comment_details_fmt/__DETAILS_LIST__/${comment_details_list}}"
comment_description=${comment_description/__DETAILS_FMT__/${comment_details}}

# Actually writing the comment description to the result file
echo "${comment_description}" >> ${job_test_result_file}

exit 0
Loading