Skip to content

Commit

Permalink
Improve bash generation
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed Sep 21, 2023
1 parent bffa69f commit ad15f91
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tested/languages/bash/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,21 @@ def convert_execution_unit(pu: PreparedExecutionUnit) -> str:
# Prepare command arguments if needed.
if tc.testcase.is_main_testcase():
assert isinstance(tc.input, MainInput)
result += f"{indent}source {pu.submission_name}.sh "
result += f"{indent}bash {pu.submission_name}.sh "
result += " ".join(shlex.quote(s) for s in tc.input.arguments) + "\n"
else:
assert isinstance(tc.input, PreparedTestcaseStatement)
result += indent + convert_statement(tc.input.input_statement()) + "\n"
result += "\n"

result += indent + ctx.after + "\n"
result += indent + "return $?" + "\n"
result += "}\n"

for i, ctx in enumerate(pu.contexts):
result += "write_context_separator\n"
result += f"context_{i}\n"
result += f"context_{i} || (exit $?)\n"
result += f""

result += "exit $?\n"

Expand Down

0 comments on commit ad15f91

Please sign in to comment.