Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Dec 3, 2023
1 parent e563148 commit a8e9f0a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
- uses: actions/checkout@v3
- run: sudo apt install -y llvm-${{ matrix.llvm-version }}-dev clang-${{ matrix.llvm-version }} make valgrind
- run: LLVM_CONFIG=llvm-config-${{ matrix.llvm-version }} make
- run: ./runtests.sh --verbose './jou ${{ matrix.opt-level }} %s'
- run: ./runtests.sh --verbose './jou ${{ matrix.opt-level }} --verbose %s'
- run: ./runtests.sh --verbose 'jou ${{ matrix.opt-level }} %s'
- run: ./runtests.sh --verbose 'jou ${{ matrix.opt-level }} --verbose %s'
# Valgrinding is slow. Do it only when this file or something in the compiler has been modified.
- name: Figure out if we need to run tests with valgrind
id: check-need-valgrind
Expand All @@ -35,7 +35,7 @@ jobs:
echo doit=no >> $GITHUB_OUTPUT
fi
- if: ${{ steps.check-need-valgrind.outputs.doit == 'yes' }}
run: ./runtests.sh --verbose --valgrind './jou ${{ matrix.opt-level }} %s'
run: ./runtests.sh --verbose --valgrind 'jou ${{ matrix.opt-level }} %s'
# valgrind+verbose isn't meaningful: test script would ignore valgrind output
- run: make clean
- name: Check that "make clean" deleted all files not committed to Git
Expand Down
3 changes: 2 additions & 1 deletion compare_compilers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ for arg in "$@"; do
done

if [ ${#files[@]} = 0 ]; then
mapfile -t files < <( find stdlib examples tests -name '*.jou' | sort )
# TODO: do not skip Advent Of Code files
mapfile -t files < <( find stdlib examples tests -name '*.jou' | grep -v aoc2023 | sort )
fi
if [ ${#actions[@]} = 0 ]; then
actions=(tokenize parse run)
Expand Down
2 changes: 2 additions & 0 deletions examples/aoc2023/day01/part1.jou
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ def main() -> int:
result += 10*(*first - '0')
result += *last - '0'

fclose(f)

printf("%d\n", result) # Output: 54630
return 0
2 changes: 2 additions & 0 deletions examples/aoc2023/day01/part2.jou
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@ def main() -> int:
result += 10*parse_prefix_digit(first)
result += parse_prefix_digit(last)

fclose(f)

printf("%d\n", result) # Output: 54770
return 0
2 changes: 2 additions & 0 deletions examples/aoc2023/day02/part1.jou
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ def main() -> int:
if game_is_possible(&id_end[1]):
result += game_id

fclose(f)

printf("%d\n", result) # Output: 1853
return 0
2 changes: 2 additions & 0 deletions examples/aoc2023/day02/part2.jou
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,7 @@ def main() -> int:
game = parse_game(&id_end[1])
result += game.get_power()

fclose(f)

printf("%d\n", result) # Output: 72706
return 0
19 changes: 9 additions & 10 deletions runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,15 @@ function run_test()
fi

show_run $joufile
if diff --text -u --color=always \
<(cd $dir; generate_expected_output $joufile $correct_exit_code | tr -d '\r') \
<(
export PATH="$PWD:$PATH"
cd $dir
ulimit -v 500000 2>/dev/null
bash -c "$command; echo Exit code: \$?" 2>&1 | post_process_output $joufile | tr -d '\r'
) \
&>> $diffpath
then
if diff --text -u --color=always <(
cd $dir
generate_expected_output $joufile $correct_exit_code | tr -d '\r'
) <(
export PATH="$PWD:$PATH"
cd $dir
ulimit -v 500000 2>/dev/null
bash -c "$command; echo Exit code: \$?" 2>&1 | post_process_output $joufile | tr -d '\r'
) &>> $diffpath; then
show_ok $joufile
rm -f $diffpath
else
Expand Down

0 comments on commit a8e9f0a

Please sign in to comment.