* patch from Pierre for working around the exitcode <= 125 limitation in wasmtime

This commit is contained in:
Nikolay Nikolov 2022-05-24 10:15:44 +03:00
parent 32fa0ecaf9
commit a8b789d183
2 changed files with 36 additions and 9 deletions

View File

@ -146,6 +146,11 @@ End;
procedure System_exit; procedure System_exit;
begin begin
if ExitCode>=126 then
begin
writeln(stderr,'##WASI-EXITCODE: ',ExitCode,' -> 125##');
ExitCode:=125;
end;
__wasi_proc_exit(ExitCode); __wasi_proc_exit(ExitCode);
End; End;

View File

@ -1024,6 +1024,7 @@ var
t : text; t : text;
s : string; s : string;
i,code : integer; i,code : integer;
is_wasi :boolean;
begin begin
CheckTestExitCode:=false; CheckTestExitCode:=false;
{ open logfile } { open logfile }
@ -1033,18 +1034,34 @@ begin
{$I+} {$I+}
if ioresult<>0 then if ioresult<>0 then
exit; exit;
GetCompilerTarget;
is_wasi:=(CompilerTarget='wasi');
while not eof(t) do while not eof(t) do
begin begin
readln(t,s); readln(t,s);
i:=pos('TestExitCode: ',s); if is_wasi then
if i>0 then begin
begin i:=pos('##WASI-EXITCODE: ',s);
delete(s,1,i+14-1); delete(s,1,i+17-1);
val(s,ExecuteResult,code); val(s,ExecuteResult,code);
if code=0 then if code>1 then
CheckTestExitCode:=true; val(copy(s,1,code-1),ExecuteResult,code);
break; if code=0 then
end; CheckTestExitCode:=true;
break;
end
else
begin
i:=pos('TestExitCode: ',s);
if i>0 then
begin
delete(s,1,i+14-1);
val(s,ExecuteResult,code);
if code=0 then
CheckTestExitCode:=true;
break;
end;
end;
end; end;
close(t); close(t);
end; end;
@ -1325,6 +1342,11 @@ begin
{$I-} {$I-}
ChDir(OldDir); ChDir(OldDir);
{$I+} {$I+}
GetCompilerTarget;
if (CompilerTarget='wasi') then
begin
CheckTestExitCode(FullEXELogFile);
end;
end end
else if RemoteAddr<>'' then else if RemoteAddr<>'' then
begin begin