Skip to content

Commit

Permalink
Remove unused variables; fix return values
Browse files Browse the repository at this point in the history
  • Loading branch information
dc-mak committed Jul 30, 2024
1 parent dcfd8d5 commit 803a70c
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions runtime-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ function echo_and_err() {
exit 1
}

[ $# -eq 0 ] || echo_and_err "USAGE: $0"

RUNTIME_PREFIX="$OPAM_SWITCH_PREFIX/lib/cn/runtime"
[ -d "${RUNTIME_PREFIX}" ] || echo_and_err "Could not find CN's runtime directory (looked at: '${RUNTIME_PREFIX}')"

Expand All @@ -25,9 +27,10 @@ function exits_with_code() {

if [ $result -eq $expected_exit_code ]; then
printf "\033[32mPASS\033[0m\n"
return 0
else
printf "\033[31mFAIL\033[0m (Unexpected return code: $result)\n"
failures=$(( $failures + 1 ))
return 1
fi
}

Expand All @@ -43,29 +46,22 @@ BUGGY=("src/examples/abs_mem_struct.c")

SHOULD_FAIL=("src/examples/read.broken.c" "src/examples/slf14_basic_succ_using_incr_attempt.broken.c")

SUCCEEDED=""
FAILED=""

for FILE in ${SUCCESS}; do
if exits_with_code "${FILE}" 0; then
SUCCEEDED+=" ${FILE}"
else
if ! exits_with_code "${FILE}" 0; then
FAILED+=" ${FILE}"
fi
done

for FILE in ${SHOULD_FAIL}; do
if exits_with_code "${FILE}" 1; then
SUCCEEDED+=" ${FILE}"
else
if ! exits_with_code "${FILE}" 1; then
FAILED+=" ${FILE}"
fi
done

for FILE in ${BUGGY}; do
if exits_with_code "${FILE}" 1; then
SUCCEEDED+=" ${FILE}"
else
if ! exits_with_code "${FILE}" 1; then
FAILED+=" ${FILE}"
fi
done
Expand Down

0 comments on commit 803a70c

Please sign in to comment.