|
@@ -11,6 +11,10 @@ program create_startup_test_crash;
|
|
|
{$ifdef go32v2}
|
|
|
{$define HasExeSuffix}
|
|
|
{$endif}
|
|
|
+{$ifdef msdos}
|
|
|
+{$define HasExeSuffix}
|
|
|
+{$define DosMaxArg}
|
|
|
+{$endif}
|
|
|
{$ifdef win32}
|
|
|
{$define HasExeSuffix}
|
|
|
{$endif}
|
|
@@ -61,28 +65,50 @@ const
|
|
|
const
|
|
|
MAX = 255;
|
|
|
|
|
|
+{$ifdef DosMaxArg}
|
|
|
+ OK_L = 126;
|
|
|
+{$else not DosMaxArg}
|
|
|
+ OK_L = 200;
|
|
|
+{$endif not DosMaxArg}
|
|
|
+
|
|
|
var
|
|
|
cmd,
|
|
|
- arg : string;
|
|
|
- i, first_wrong : longint;
|
|
|
+ arg,arg2_length_string,args : string;
|
|
|
+ i, first, first_wrong,arg2_length,total_length : longint;
|
|
|
const
|
|
|
Everything_ok : boolean = true;
|
|
|
begin
|
|
|
cmd:=Prefix+'targ1a'+ExeSuffix;
|
|
|
arg:='';
|
|
|
first_wrong:=-1;
|
|
|
- for i:=0 to MAX do
|
|
|
+ if paramcount>0 then
|
|
|
+ begin
|
|
|
+ val(paramstr(1),first);
|
|
|
+ for i:=1 to first do
|
|
|
+ arg:=arg+'a';
|
|
|
+ end
|
|
|
+ else
|
|
|
+ first:=0;
|
|
|
+ for i:=first to MAX - 4 { 4 chars needed for first arg and space } do
|
|
|
begin
|
|
|
- Writeln(stderr,'Going to call "',cmd,'" with arg = "',arg,'"');
|
|
|
- Writeln(stderr,'arg length =',length(arg));
|
|
|
- Exec(cmd,arg);
|
|
|
+ arg2_length:=length(arg);
|
|
|
+ Writeln(stderr,'Going to call "',cmd,'" with arg2 = "',arg,'"');
|
|
|
+ Writeln(stderr,'arg2 length =',arg2_length);
|
|
|
+ str(arg2_length, arg2_length_string);
|
|
|
+ args:=arg2_length_string+' '+arg;
|
|
|
+ total_length:=length(args);
|
|
|
+ Writeln(stderr,'Length of all args=',total_length);
|
|
|
+ Exec(cmd,args);
|
|
|
if (DosExitCode<>0) or (DosError<>0) then
|
|
|
begin
|
|
|
- Writeln(stderr,'Crash detected, DosError=', DosError);
|
|
|
- Writeln(stderr,'DosExitCode=',DosExitCode);
|
|
|
+ if DosError<>0 then
|
|
|
+ Writeln(stderr,'Dos.Exec error detected, DosError=', DosError)
|
|
|
+ else
|
|
|
+ Writeln(stderr,'Error running targ1a, DosExitCode=',DosExitCode);
|
|
|
if first_wrong=-1 then
|
|
|
- first_wrong:=i;
|
|
|
+ first_wrong:=total_length;
|
|
|
Everything_ok := false;
|
|
|
+ break;
|
|
|
end;
|
|
|
arg:=arg+'a';
|
|
|
end;
|
|
@@ -94,7 +120,7 @@ begin
|
|
|
begin
|
|
|
Writeln(stderr,'Test fails: Memory corruption occurs');
|
|
|
Writeln(stderr,'First arg length where error appears is ',first_wrong);
|
|
|
- if first_wrong<100 then
|
|
|
+ if first_wrong<OK_L then
|
|
|
RunError(1)
|
|
|
else
|
|
|
Writeln(stderr,'Warning: when using Dos.Exec, arg length must be smaller than ',first_wrong);
|