-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdl-tests.sh
More file actions
executable file
·51 lines (42 loc) · 1.79 KB
/
Copy pathdl-tests.sh
File metadata and controls
executable file
·51 lines (42 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Initially generated by: Claude Sonnet 4.6
#
# Downloads the official Appel Tiger test cases from Princeton and places
# them under test/fixtures/tiger/ relative to this script's location.
# Also applies the errata corrections that affect the test files themselves.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
FIXTURE_DIR="${SCRIPT_DIR}/src/test/fixtures/tiger"
BASE_URL="https://www.cs.princeton.edu/~appel/modern/testcases"
echo "==> Creating fixture directory: ${FIXTURE_DIR}"
mkdir -p "${FIXTURE_DIR}"
# ── Download individual .tig files ─────────────────────────────────────────
# The tar/zip on Princeton's site bundles the entire compiler skeleton, not
# just the test cases. Fetching the .tig files individually is cleaner.
NUMBERED_TESTS=$(seq 1 49)
NAMED_TESTS="queens merge"
echo "==> Downloading numbered test cases (test1.tig – test49.tig)..."
for n in ${NUMBERED_TESTS}; do
dest="${FIXTURE_DIR}/test${n}.tig"
if [[ -f "${dest}" ]]; then
echo " [skip] test${n}.tig already exists"
else
curl -fsSL --retry 3 "${BASE_URL}/test${n}.tig" -o "${dest}"
echo " [ok] test${n}.tig"
fi
done
echo "==> Downloading named test cases (queens.tig, merge.tig)..."
for name in ${NAMED_TESTS}; do
dest="${FIXTURE_DIR}/${name}.tig"
if [[ -f "${dest}" ]]; then
echo " [skip] ${name}.tig already exists"
else
curl -fsSL --retry 3 "${BASE_URL}/${name}.tig" -o "${dest}"
echo " [ok] ${name}.tig"
fi
done
echo ""
echo "==> All test files are in ${FIXTURE_DIR}"
echo " Total files: $(ls "${FIXTURE_DIR}"/*.tig 2>/dev/null | wc -l | tr -d ' ')"
echo ""
echo " If you ever need to refresh, delete the fixture directory and re-run."