Skip to content

Commit

Permalink
Fix issue with shell executions differently
Browse files Browse the repository at this point in the history
  • Loading branch information
sungshik committed Sep 16, 2024
1 parent 7ce634b commit 5b9abd1
Showing 1 changed file with 35 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,44 @@ bool doTransformTest(list[ConversionUnit] units, RepositoryStats expect, str nam
resolveLocation(lTest).path[(windows ? 1 : 0)..]
];

str result = "";
int code = 0;
try {
// Presumably, this block does *exactly the same* as function
// `execWithCode` (which was used previously). However, using that
// function caused inexplicable errors in the presence of >7 test
// modules. For reference:
//
// - Failing GitHub workflow: https://github.com/SWAT-engineering/rascal-textmate/actions/runs/10883111847/job/30195540047
// - Code of `execWithCode`: https://github.com/usethesource/rascal/blob/5bba6e40b9d3b9af560cf3482c346bed650a1854/src/org/rascalmpl/library/util/ShellExec.rsc#L67-L75
pid = createProcess(lExec, args = args);
println("[LOG] Running <lExec> (args: <args>; pid: <pid>)");
result = readEntireStream(pid);
code = exitCode(pid);
killProcess(pid);
} catch e: {
println("[ERROR] Unexpected error: <e>");
return false;
tuple[str, int] execWithCodeUntilSuccess() {
try {
return execWithCode(lExec, args = args);
} catch e: {
println("[LOG] Retrying after unexpected exception: <e>");
return execWithCodeUntilSuccess();
}
}

if (code != 0) {
println(result);
if (<output, exitCode> := execWithCodeUntilSuccess() && exitCode != 0) {
println(output);
assert false : "Actual tokenization does not match expected tokenization (see output above for details)";
}

// str result = "";
// int code = 0;
// try {
// // Presumably, this block does *exactly the same* as function
// // `execWithCode` (which was used previously). However, using that
// // function caused inexplicable errors in the presence of >7 test
// // modules. For reference:
// //
// // - Failing GitHub workflow: https://github.com/SWAT-engineering/rascal-textmate/actions/runs/10883111847/job/30195540047
// // - Code of `execWithCode`: https://github.com/usethesource/rascal/blob/5bba6e40b9d3b9af560cf3482c346bed650a1854/src/org/rascalmpl/library/util/ShellExec.rsc#L67-L75
// pid = createProcess(lExec, args = args);
// println("[LOG] Running <lExec> (args: <args>; pid: <pid>)");
// result = readEntireStream(pid);
// code = exitCode(pid);
// killProcess(pid);
// } catch e: {
// println("[ERROR] Unexpected error: <e>");
// return false;
// }

// if (code != 0) {
// println(result);
// assert false : "Actual tokenization does not match expected tokenization (see output above for details)";
// }
}

return true;
Expand Down

0 comments on commit 5b9abd1

Please sign in to comment.