Skip to content

Commit ab37b23

Browse files
committed
Run examples in full verification
1 parent 4db623c commit ab37b23

3 files changed

Lines changed: 41 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,11 @@ Local verification:
441441

442442
```sh
443443
bash scripts/check.sh
444+
RSSCRIPT_FULL_TESTS=1 bash scripts/check.sh
445+
bash scripts/run_examples.sh
444446
```
445447

446-
CI sets `RSSCRIPT_FULL_TESTS=1` so the same script runs full `cargo test --workspace`.
448+
CI sets `RSSCRIPT_FULL_TESTS=1` so the same script runs full `cargo test --workspace` and executes every `examples/*.rss` file through `rss run`.
447449

448450
---
449451

scripts/check.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ cargo check --manifest-path tests/generated/runnable/Cargo.toml
1414

1515
if [[ "${RSSCRIPT_FULL_TESTS:-0}" == "1" ]]; then
1616
cargo test --workspace
17+
bash scripts/run_examples.sh
1718
else
1819
cargo test --workspace --no-run
1920
fi

scripts/run_examples.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
cd "$ROOT"
6+
7+
cleanup_example_artifacts() {
8+
rm -f \
9+
rsscript-buffer-consume.txt \
10+
rsscript-cache-image-input.bin \
11+
rsscript-cache-image-output.bin \
12+
rsscript-config-first.txt \
13+
rsscript-config-second.txt \
14+
rsscript-csv-example.csv \
15+
rsscript-file-copy-input.txt \
16+
rsscript-file-copy-output.txt \
17+
rsscript-image-input.bin \
18+
rsscript-image-output.bin \
19+
rsscript-rules-first.txt \
20+
rsscript-rules-second.txt
21+
}
22+
23+
cleanup_example_artifacts
24+
trap cleanup_example_artifacts EXIT
25+
26+
shopt -s nullglob
27+
examples=(examples/*.rss)
28+
29+
if [[ "${#examples[@]}" == "0" ]]; then
30+
echo "no examples found" >&2
31+
exit 1
32+
fi
33+
34+
for example in "${examples[@]}"; do
35+
echo "run $example"
36+
cargo run --quiet -- run "$example"
37+
done

0 commit comments

Comments
 (0)