-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Escape all literal dollar signs (#3)
* Escape all literal dollar signs Signed-off-by: Bolun Thompson <bolunthompson@ucla.edu> * add libdash tests to shasta * fix: don't escape singular $ signs * Add github action to run tests * Refactor: download libdash only for tests * fix workflow * add clean libdash_tests * refactor test action * fix os * remove submodule * fix gh action typo * add: install deps in test runner makefile * Move setup test outside of Makefile Prevents calling test setup every time the tests are run. --------- Signed-off-by: Bolun Thompson <bolunthompson@ucla.edu>
- Loading branch information
1 parent
838e706
commit a85f998
Showing
7 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Test | ||
on: | ||
pull_request_target: | ||
types: [assigned, opened, synchronize, reopened, ready_for_review] | ||
paths: | ||
- shasta/** | ||
push: | ||
branches: | ||
- main | ||
- future | ||
paths: | ||
- libdash/** | ||
- shasta/** | ||
jobs: | ||
Shasta-Test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
runs-on: ${{ matrix.os }} | ||
if: github.event.pull_request.draft == false | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Running Tests | ||
run: | | ||
cd tests; | ||
./setup_test.sh | ||
make test | ||
test_succ=$? | ||
timer="$(LANG=en_us_88591; date)" | ||
echo "VERSION<<EOF" >> "$GITHUB_ENV" | ||
echo "OS:${{matrix.os}}" >> "$GITHUB_ENV" | ||
echo "$timer" >> "$GITHUB_ENV" | ||
cat python.log >> "$GITHUB_ENV" | ||
echo 'EOF' >> "$GITHUB_ENV" | ||
exit $test_succ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
*__pycache__* | ||
dist/* | ||
shasta.egg-info/* | ||
tests/libdash_tests/ | ||
tests/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Michael Greenberg, Konstantinos Kallas, Thurston Dang, and Bolun Thompson | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.PHONY: setup_test test clean | ||
|
||
test: rt.py ../shasta/*.py | ||
@find libdash_tests/tests libdash_tests/pash_tests -type f | while read f; do libdash_tests/round_trip.sh ./rt.py "$$f"; done | tee python.log | ||
@cat python.log | egrep '^[A-Z0-9_]+:' | cut -d ':' -f 1 | sort | uniq -c | ||
@grep ':' python.log && echo "FAILED" && exit 1 || exit 0 | ||
|
||
clean: | ||
rm -rf $(wildcard *.log) libdash_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import sys | ||
|
||
import libdash | ||
from shasta.json_to_ast import to_ast_node | ||
|
||
|
||
sys.setrecursionlimit (9001) | ||
|
||
def print_asts(new_asts): | ||
for (ast, lines, linno_before, linno_after) in new_asts: | ||
print(to_ast_node(ast).pretty()) | ||
|
||
if (len(sys.argv) == 1): | ||
new_asts = libdash.parse("-", True) | ||
else: | ||
new_asts = libdash.parse(sys.argv[1], True) | ||
|
||
print_asts(new_asts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
if [ ! -d libdash_tests/ ]; then | ||
git clone https://github.com/binpash/libdash.git | ||
mv libdash/test libdash_tests | ||
rm -rf libdash | ||
fi | ||
|
||
pip install .. libdash |