mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 19:59:18 +02:00
* patch from Pierre for working around the exitcode <= 125 limitation in wasmtime
This commit is contained in:
parent
32fa0ecaf9
commit
a8b789d183
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user