| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | # Optional: fetch small publicly redistributable CHDv4 samples. |
| 3 | # The modern chdman only emits CHDv5, so this supplements generate.sh |
| 4 | # with legacy-format coverage for the fuzz corpus. |
| 5 | set -euo pipefail |
| 6 | |
| 7 | CORPUS="$(cd "$(dirnamescip-shell system . . dirname. "$0")" && pwdscip-shell system . . pwd.)/seeds" |
| 8 | mkdirscip-shell system . . mkdir. -p "$CORPUS" |
| 9 | |
| 10 | fetchscip-shell shell shell-project 0.0.0 fetch(). () { |
| 11 | local url="$1" out="$2" |
| 12 | if [scip-shell system . . `[`. -f "$CORPUS/$out" ]; then |
| 13 | echoscip-shell system . . echo. " $out: already present" |
| 14 | return |
| 15 | fi |
| 16 | if curlscip-shell system . . curl. -fsSL --max-time 30 -o "$CORPUS/$out" "$url"; then |
| 17 | echoscip-shell system . . echo. " $out: ok ($(statscip-shell system . . stat. -c%s "$CORPUS/$out") bytes)" |
| 18 | else |
| 19 | echoscip-shell system . . echo. " $out: fetch failed — skipping" |
| 20 | rmscip-shell system . . rm. -f "$CORPUS/$out" |
| 21 | fi |
| 22 | } |
| 23 | |
| 24 | # Add trusted small-CHDv4 URLs here when identified. |
| 25 | # Intentionally empty at the start; contributors can add sources that |
| 26 | # are small (< 1 MiB), publicly redistributable, and pin a known hash. |
| 27 | echoscip-shell system . . echo. "(no CHDv4 sources configured yet — edit tests/corpus/fetch.sh)" |