Commit 651bebee authored by F-WRunTime's avatar F-WRunTime

Updating to fix most shellcheck findings. Kontrol commands do not run properly...

Updating to fix most shellcheck findings. Kontrol commands do not run properly when the variable is quoted
parent 7f0c60e1
...@@ -31,37 +31,37 @@ export KONTROL_RELEASE=${KONTROLRC} ...@@ -31,37 +31,37 @@ export KONTROL_RELEASE=${KONTROLRC}
############# #############
kontrol_build() { kontrol_build() {
notif "Kontrol Build" notif "Kontrol Build"
docker_exec kontrol build \ docker_exec kontrol build \
--verbose \ --verbose \
--require "${lemmas}" \ --require ${lemmas} \
--module-import "${module}" \ --module-import ${module} \
"${rekompile}" ${rekompile}
} }
kontrol_prove() { kontrol_prove() {
notif "Kontrol Prove" notif "Kontrol Prove"
docker_exec kontrol prove \ docker_exec kontrol prove \
--max-depth "${max_depth}" \ --max-depth ${max_depth} \
--max-iterations "${max_iterations}" \ --max-iterations ${max_iterations} \
--smt-timeout "${smt_timeout}" \ --smt-timeout ${smt_timeout} \
--bmc-depth "${bmc_depth}" \ --bmc-depth ${bmc_depth} \
--workers "${workers}" \ --workers ${workers} \
"${reinit}" \ ${reinit} \
"${bug_report}" \ ${bug_report} \
"${break_on_calls}" \ ${break_on_calls} \
"${auto_abstract}" \ ${auto_abstract} \
"${tests}" \ ${tests} \
"${use_booster}" ${use_booster}
} }
start_docker () { start_docker () {
docker run \ docker run \
--name "${CONTAINER_NAME}" \ --name "${CONTAINER_NAME}" \
--rm \ --rm \
--interactive \ --interactive \
--detach \ --detach \
--env FOUNDRY_PROFILE="${FOUNDRY_PROFILE}" \ --env FOUNDRY_PROFILE="${FOUNDRY_PROFILE}" \
--workdir /home/user/workspace \ --workdir /home/user/workspace \
runtimeverificationinc/kontrol:ubuntu-jammy-"${KONTROL_RELEASE}" runtimeverificationinc/kontrol:ubuntu-jammy-"${KONTROL_RELEASE}"
# Copy test content to container # Copy test content to container
...@@ -70,34 +70,40 @@ start_docker () { ...@@ -70,34 +70,40 @@ start_docker () {
} }
docker_exec () { docker_exec () {
docker exec --workdir /home/user/workspace ${CONTAINER_NAME} "$@" docker exec --workdir /home/user/workspace ${CONTAINER_NAME} "${@}"
} }
dump_log_results(){ dump_log_results(){
trap clean_docker ERR
notif "Something went wrong. Running cleanup..." notif "Something went wrong. Running cleanup..."
blank_line
notif "Creating Tar of Proof Results" notif "Creating Tar of Proof Results"
docker exec ${CONTAINER_NAME} tar -czvf results.tar.gz kout/proofs docker exec ${CONTAINER_NAME} tar -czvf results.tar.gz kout/proofs
RESULTS_LOG="results-$(date +'%Y-%m-%d-%H-%M-%S').tar.gz"
notif "Copying Tests Results to Host" notif "Copying Tests Results to Host"
docker cp ${CONTAINER_NAME}:/home/user/workspace/results.tar.gz "${RESULTS_LOG}"
if [ -f "${RESULTS_LOG}" ]; then
cp kontrol-results_*.tar.gz kontrol-results_latest.tar.gz
else
notif "Results Log: ${RESULTS_LOG} not found, did not pull from container."
fi
blank_line blank_line
docker cp ${CONTAINER_NAME}:/home/user/workspace/results.tar.gz ./kontrol-results_"$(date +'%Y-%m-%d-%H-%M-%S')".tar.gz
cp kontrol-results_*.tar.gz kontrol-results_latest.tar.gz notif "Dump RUN Logs"
RUN_LOG="run-kontrol-$(date +'%Y-%m-%d-%H-%M-%S').log"
notif "Dump Logs" docker logs ${CONTAINER_NAME} > "${RUN_LOG}"
LOG_FILE="run-kontrol-$(date +'%Y-%m-%d-%H-%M-%S').log"
docker logs ${CONTAINER_NAME} > "${LOG_FILE}"
} }
clean_docker(){ clean_docker(){
notif "Stopping Docker Container" notif "Stopping Docker Container"
docker stop ${CONTAINER_NAME} docker stop ${CONTAINER_NAME}
blank_line blank_line
} }
# Define the function to run on failure # Define the function to run on failure
on_failure() { on_failure() {
dump_log_results dump_log_results
clean_docker clean_docker
...@@ -151,6 +157,15 @@ tests+="--match-test CounterTest.test_SetNumber " ...@@ -151,6 +157,15 @@ tests+="--match-test CounterTest.test_SetNumber "
############# #############
# RUN TESTS # # RUN TESTS #
############# #############
# Is old docker container running?
if [ "$(docker ps -q -f name=${CONTAINER_NAME})" ]; then
# Stop old docker container
notif "Stopping old docker container"
clean_docker
blank_line
fi
start_docker start_docker
kontrol_build kontrol_build
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment