Skip to content

Commit

Permalink
Disable core dumps
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Feb 19, 2024
1 parent 1b64cba commit e1f4d2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
20 changes: 2 additions & 18 deletions compare_compilers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# If tokenizing/parsing a Jou file fails, both compilers should fail with the same error message.

set -e
ulimit -c unlimited
ulimit -c 0 # disable core dumps

files=()
actions=()
Expand Down Expand Up @@ -40,13 +40,6 @@ fi
rm -rf tmp/compare_compilers
mkdir -p tmp/compare_compilers

# shellcheck disable=SC2010
if ls | grep -q core$; then
for core in *core; do
mv -v -- "$core" "$core"~
done
fi

YELLOW="\x1b[33m"
GREEN="\x1b[32m"
RED="\x1b[31m"
Expand Down Expand Up @@ -139,19 +132,10 @@ for action in ${actions[@]}; do
fi
else
echo " Compilers behave differently as expected (listed in $error_list_file)"
echo -en ${YELLOW}
rm -vf -- *core | xargs -r echo Core dumped and ignored:
echo -en ${RESET}
fi
else
if $DIFF -u $diff_color tmp/compare_compilers/compiler_written_in_c.txt tmp/compare_compilers/self_hosted.txt; then
# shellcheck disable=SC2010
if ls | grep -q core$; then
echo -e " ${RED}Error: Core dumped.${RESET}"
exit 1
else
echo " Compilers behave the same as expected"
fi
echo " Compilers behave the same as expected"
else
if [ $fix = yes ]; then
append_line $error_list_file $file
Expand Down
2 changes: 1 addition & 1 deletion tests/should_succeed/file.jou
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def write_hello_123() -> None:
f = fopen("tmp/tests/hello.txt", "w")
if f == NULL:
printf("can't write tmp/tests/hello.txt\n")
exit(1) # abort() would make a core dump when comparing compilers
abort()

fputc('h', f)
fputs("ell", f)
Expand Down

0 comments on commit e1f4d2b

Please sign in to comment.