Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions scripts/bootstrap_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,32 @@ is_from_github_actions=$1

process_and_compare() {
local config="$1"
cargo run --bin rustylr -- "$rustylr_path/rusty_lr_parser/src/parser/parser.rs" out.tab.rs $config > /dev/null
cargo run --quiet --bin rustylr -- "$rustylr_path/rusty_lr_parser/src/parser/parser.rs" out.tab.rs $config > /dev/null
mv out.tab.rs "$rustylr_path/rusty_lr_parser/src/parser/parser_expanded.rs"
cargo run --bin rustylr -- "$rustylr_path/rusty_lr_parser/src/parser/parser.rs" out.tab.rs $config > /dev/null
cargo run --quiet --bin rustylr -- "$rustylr_path/rusty_lr_parser/src/parser/parser.rs" out.tab.rs $config > /dev/null
compare_files "$rustylr_path/rusty_lr_parser/src/parser/parser_expanded.rs" out.tab.rs
if [ $? -ne 0 ]; then
exit 1
fi
cargo test
if [ $? -ne 0 ]; then
local test_out=$(mktemp)
cargo test --quiet > "$test_out" 2>&1
local status=$?
if [ $status -ne 0 ]; then
cat "$test_out"
echo "Error: cargo test failed with config '$config'"
rm "$test_out"
exit 1
fi
rm "$test_out"
}

echo "RustyLR path: $rustylr_path"


# to briefly see the difference of the generated parser in the PR, run for the sample calculator and json parsers
cargo run --bin rustylr -- "$rustylr_path/example/calculator/src/parser.rs" "$rustylr_path/scripts/diff/calculator_new.rs" > /dev/null
cargo run --bin rustylr -- "$rustylr_path/example/calculator_u8/src/parser.rs" "$rustylr_path/scripts/diff/calculator_u8_new.rs" > /dev/null
cargo run --bin rustylr -- "$rustylr_path/example/json/src/parser.rs" "$rustylr_path/scripts/diff/json_new.rs" > /dev/null
cargo run --quiet --bin rustylr -- "$rustylr_path/example/calculator/src/parser.rs" "$rustylr_path/scripts/diff/calculator_new.rs" > /dev/null
cargo run --quiet --bin rustylr -- "$rustylr_path/example/calculator_u8/src/parser.rs" "$rustylr_path/scripts/diff/calculator_u8_new.rs" > /dev/null
cargo run --quiet --bin rustylr -- "$rustylr_path/example/json/src/parser.rs" "$rustylr_path/scripts/diff/json_new.rs" > /dev/null
if [ "$is_from_github_actions" = "true" ]; then
diff "$rustylr_path/scripts/diff/calculator.rs" "$rustylr_path/scripts/diff/calculator_new.rs" >/dev/null
if [ $? -ne 0 ]; then
Expand Down Expand Up @@ -103,9 +108,14 @@ echo "Normal configuration"
process_and_compare ""
mv out.tab.rs "$rustylr_path/rusty_lr_parser/src/parser/parser_expanded.rs"

cargo test --bin glr
if [ $? -ne 0 ]; then
test_out=$(mktemp)
cargo test --quiet --bin glr > "$test_out" 2>&1
status=$?
if [ $status -ne 0 ]; then
cat "$test_out"
rm "$test_out"
exit 1
fi
rm "$test_out"

echo "All tests passed."
Loading
Loading