Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add a signal trap test #324

Draft
wants to merge 3 commits into
base: future
Choose a base branch
from
Draft
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
19 changes: 19 additions & 0 deletions compiler/parser/ceda/parse_to_ast2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@
# TODO: use Pash root directory
LIBDASH_LIBRARY_PATH = os.path.join(PASH_TOP, "compiler/parser/libdash/src/.libs/libdash.so")

# TODO: Call libdash in interactive mode
# let parse_next i : parse_result =
# let stackmark = Dash.init_stack () in
# let res =
# match Dash.parse_next ~interactive:(is_interactive_mode i) () with
# | Done -> ParseDone
# | Error -> ParseError ""
# | Null -> ParseNull
# | Parsed n ->
# try
# let c = of_node n in
# ParseStmt c
# with ParseException s ->
# ParseError (Printf.sprintf "%s: %s\n" (Filename.basename Sys.executable_name) s)
# in
# Dash.pop_stack stackmark;
# res



EOF_NLEFT = -99; # libdash/src/input.c

Expand Down
20 changes: 19 additions & 1 deletion evaluation/tests/interface_tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ run_test()
echo -n "$test output mismatch "
fi
if [ $test_ec -ne 0 ]; then
echo -n "$test exit code mismatch "
echo -n "$test exit code mismatch (bash: $test_bash_ec) (pash: $test_pash_ec)"
fi
if [ $test_diff_ec -ne 0 ] || [ $test_ec -ne 0 ]; then
echo "are not identical" > $output_dir/${test}_distr.time
Expand Down Expand Up @@ -166,6 +166,24 @@ test18()
$shell escape-madness.sh
}

test_trap()
{
local shell=$1
$shell trap.sh &
shell_pid=$!
sleep 3
kill -INT $shell_pid
wait $shell_pid
cat trap.txt
}

## TODO: os.isatty and libdash should also have some configuration for interactive mode
test_interactive()
{
local shell=$1
PS1="$" $shell -i 2>&1
}

## We run all tests composed with && to exit on the first that fails
if [ "$#" -eq 0 ]; then
run_test test1
Expand Down
5 changes: 5 additions & 0 deletions evaluation/tests/interface_tests/trap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rm -f trap.txt

trap 'echo fudge > trap.txt' INT

sleep 10