* 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;
begin
if ExitCode>=126 then
begin
writeln(stderr,'##WASI-EXITCODE: ',ExitCode,' -> 125##');
ExitCode:=125;
end;
__wasi_proc_exit(ExitCode);
End;

View File

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