+ added allexec tests if executables compiled

don't return with an error code
  * some changes in test files for dos
This commit is contained in:
pierre 1998-10-22 14:35:40 +00:00
parent e14a086c73
commit aa82e1cb8c
4 changed files with 118 additions and 15 deletions

View File

@ -4,7 +4,7 @@
# make all test # make all test
# and printout errors # and printout errors
all : clean allts alltf allto all : clean allts alltf allto alltest
grep -n -i fails log grep -n -i fails log
# returns the error code # returns the error code
@ -12,11 +12,18 @@ all : clean allts alltf allto
# in file retcode # in file retcode
ifdef DJGPP ifdef DJGPP
EXEEXT=.exe
getreturncode : getreturncode :
redir -e $(FILE).log -o $(FILE).log getret $(COMMAND) redir -e $(FILE).log -o $(FILE).log getret $(COMMAND)
cp retcode $(FILE).$(RESEXT)
else else
EXEEXT=
getreturncode : getreturncode :
getret $(COMMAND) !> $(FILE).log !2>$(FILE).log getret $(COMMAND) !> $(FILE).log !2>$(FILE).log
cp retcode $(FILE).$(RESEXT)
endif endif
@ -49,6 +56,39 @@ testsuccess:
echo $(FILE) >> faillist echo $(FILE) >> faillist
endif endif
ifdef FILE
ifneq ($wildcard $(FILE).exc),)
EXERETVAL:=$(shell cat $(FILE).exc)
else
EXERETVAL=-1
endif
else
EXERETVAL=-2
endif
ifeq ($(EXERETVAL),0)
testexecsuccess:
echo Test for exec $(FILE) success (runs without error)
echo Test for $(FILE) success (runs without error) >>log
else
testexecsuccess:
echo Test for exec $(FILE) fails exec error $(RETVAL)
echo Test for exec $(FILE) fails exec error $(RETVAL)>>log
echo $(FILE) >> faillist
endif
ifneq ($(wildcard $(FILE)$(EXEEXT)),)
testexec:
redir -e $(FILE).elg -o$(FILE).elg getret $(FILE)$(EXEEXT)
cp retcode $(FILE).exc
make testexecsuccess 'FILE=$(FILE)'
else
testexec:
echo No exefile $(FILE)$(EXEEXT)
make testexecsuccess 'FILE=$(FILE)'
true
endif
ifneq ($(RETVAL),0) ifneq ($(RETVAL),0)
testfail: testfail:
echo Test for $(FILE) success (does not compile) error $(RETVAL) echo Test for $(FILE) success (does not compile) error $(RETVAL)
@ -83,30 +123,44 @@ FILE=ts00001.pp
endif endif
testone : testone :
make getreturncode 'COMMAND=$(PP) $(OPT) $(FILE).pp' make getreturncode 'COMMAND=$(PP) $(OPT) $(FILE).pp' 'RESEXT=$(RESEXT)'
make printretcode 'FILE=$(FILE)' make printretcode 'FILE=$(FILE)'
%.res : %.pp %.res : %.pp
make testone 'FILE=$*' make testone 'FILE=$*' 'RESEXT=res'
cat retcode > $*.res
make testsuccess 'FILE=$*' 'RESFILE=$*.res' make testsuccess 'FILE=$*' 'RESFILE=$*.res'
%.ref : %.pp %.ref : %.pp
make testone 'FILE=$*' make testone 'FILE=$*' 'RESEXT=ref'
cat retcode > $*.ref
make testfail 'FILE=$*' 'RESFILE=$*.ref' make testfail 'FILE=$*' 'RESFILE=$*.ref'
# exec log files
# creates two files
# *.elg log file
# *.exc exicode of program
%.elg : %.res
make testexec 'FILE=$*'
allts : $(patsubst %.pp,%.res,$(wildcard ts*.pp)) allts : $(patsubst %.pp,%.res,$(wildcard ts*.pp))
alltest : $(patsubst %.pp,%.res,$(wildcard test*.pp))
alltf : $(patsubst %.pp,%.ref,$(wildcard tf*.pp)) alltf : $(patsubst %.pp,%.ref,$(wildcard tf*.pp))
allto : $(patsubst %.pp,%.res,$(wildcard to*.pp)) allto : $(patsubst %.pp,%.res,$(wildcard to*.pp))
allexec: $(patsubst %.pp,%.elg,$(wildcard test*.pp)) $(patsubst %.pp,%.elg,$(wildcard ts*.pp))
clean : clean :
-rm *.re* *.o *.ppu ts*.exe tf*.exe log faillist -rm *.re* *.o *.ppu ts*.exe tf*.exe log faillist
# $Log$ # $Log$
# Revision 1.5 1998-10-21 16:24:16 pierre # Revision 1.6 1998-10-22 14:35:40 pierre
# + added allexec tests if executables compiled
# don't return with an error code
# * some changes in test files for dos
#
# Revision 1.5 1998/10/21 16:24:16 pierre
# + tests to check if filename exists # + tests to check if filename exists
# #
# Revision 1.4 1998/10/21 12:14:30 pierre # Revision 1.4 1998/10/21 12:14:30 pierre

View File

@ -4,6 +4,7 @@
Program to test DOS unit by Peter Vreman. Program to test DOS unit by Peter Vreman.
Only main TP functions are tested (nothing with Interrupts/Break/Verify). Only main TP functions are tested (nothing with Interrupts/Break/Verify).
} }
{$V-}
program testdos; program testdos;
uses dos; uses dos;
@ -11,8 +12,8 @@ procedure TestInfo;
var var
dt : DateTime; dt : DateTime;
ptime : longint; ptime : longint;
wday, wday : word;
HSecs : integer; HSecs : word;
begin begin
writeln; writeln;
writeln('Info Functions'); writeln('Info Functions');
@ -42,10 +43,11 @@ begin
writeln('Amount of environment strings : ',EnvCount); writeln('Amount of environment strings : ',EnvCount);
writeln('GetEnv TERM : ',GetEnv('TERM')); writeln('GetEnv TERM : ',GetEnv('TERM'));
writeln('GetEnv HOST : ',GetEnv('HOST')); writeln('GetEnv HOST : ',GetEnv('HOST'));
writeln('GetEnv PATH : ',GetEnv('PATH'));
writeln('GetEnv SHELL: ',GetEnv('SHELL')); writeln('GetEnv SHELL: ',GetEnv('SHELL'));
write('Press Enter for all Environment Strings using EnvStr()'); write('Press Enter for all Environment Strings using EnvStr()');
Readln; Readln;
for i:=1to EnvCount do for i:=1 to EnvCount do
writeln(EnvStr(i)); writeln(EnvStr(i));
write('Press Enter'); write('Press Enter');
Readln; Readln;
@ -59,7 +61,13 @@ begin
writeln('**************'); writeln('**************');
write('Press Enter for an Exec of ''ls -la'''); write('Press Enter for an Exec of ''ls -la''');
Readln; Readln;
Exec('pine',''); {$ifdef linux }
Exec('ls','-la');
{$else not linux }
SwapVectors;
Exec('ls','-la');
SwapVectors;
{$endif not linux }
write('Press Enter'); write('Press Enter');
Readln; Readln;
end; end;
@ -75,7 +83,8 @@ begin
writeln('**************'); writeln('**************');
writeln('DiskFree 0 : ',DiskFree(0)); writeln('DiskFree 0 : ',DiskFree(0));
writeln('DiskSize 0 : ',DiskSize(0)); writeln('DiskSize 0 : ',DiskSize(0));
writeln('DiskSize 1 : ',DiskSize(1)); {writeln('DiskSize 1 : ',DiskSize(1)); this is a: on dos ??! }
writeln('DiskSize 1 : ',DiskSize(3)); { this is c: on dos }
{$IFDEF LINUX} {$IFDEF LINUX}
AddDisk('/fd0'); AddDisk('/fd0');
writeln('DiskSize 4 : ',DiskSize(4)); writeln('DiskSize 4 : ',DiskSize(4));
@ -103,6 +112,7 @@ begin
writeln; writeln;
writeln('File(name) Functions'); writeln('File(name) Functions');
writeln('********************'); writeln('********************');
{$ifdef linux }
test:='/usr/local/bin/ppc.so'; test:='/usr/local/bin/ppc.so';
writeln('FSplit(',test,')'); writeln('FSplit(',test,')');
FSplit(test,dir,name,ext); FSplit(test,dir,name,ext);
@ -121,8 +131,34 @@ begin
Writeln('Expanded /usr/local/dos.pp : ',FExpand('/usr/local/dos.pp')); Writeln('Expanded /usr/local/dos.pp : ',FExpand('/usr/local/dos.pp'));
Writeln('Expanded ../dos/./../././dos.pp : ',FExpand('../dos/./../././dos.pp')); Writeln('Expanded ../dos/./../././dos.pp : ',FExpand('../dos/./../././dos.pp'));
test:='../;/usr/;/usr/bin/;/usr/bin;/bin/'; test:='../;/usr/;/usr/bin/;/usr/bin;/bin/;';
{$else not linux }
test:='\usr\local\bin\ppc.so';
writeln('FSplit(',test,')');
FSplit(test,dir,name,ext);
writeln('dir: ',dir,' name: ',name,' ext: ',ext);
test:='\usr\bin.1\ppc';
writeln('FSplit(',test,')');
FSplit(test,dir,name,ext);
writeln('dir: ',dir,' name: ',name,' ext: ',ext);
test:='mtools.tar.gz';
writeln('FSplit(',test,')');
FSplit(test,dir,name,ext);
writeln('dir: ',dir,' name: ',name,' ext: ',ext);
Writeln('Expanded dos.pp : ',FExpand('dos.pp'));
Writeln('Expanded ..\dos.pp : ',FExpand('..\dos.pp'));
Writeln('Expanded \usr\local\dos.pp : ',FExpand('\usr\local\dos.pp'));
Writeln('Expanded ..\dos\.\..\.\.\dos.pp : ',FExpand('..\dos\.\..\.\.\dos.pp'));
test:='..\;\usr\;\usr\bin\;\usr\bin;\bin\;';
{$endif not linux}
test:=test+getenv('PATH');
{$ifdef linux}
Writeln('FSearch ls: ',FSearch('ls',test)); Writeln('FSearch ls: ',FSearch('ls',test));
{$else not linux}
Writeln('FSearch ls: ',FSearch('ls.exe',test));
{$endif not linux}
write('Press Enter'); write('Press Enter');
Readln; Readln;

View File

@ -3,6 +3,9 @@
Program to test set functions Program to test set functions
} }
{ $define FPC_HAS_SET_INEQUALITIES
<,> <= and >= are not implemented yet (PM) }
program TestSet; program TestSet;
Procedure InitMSTimer; Procedure InitMSTimer;
@ -57,7 +60,11 @@ begin
Set2 := Set2 + [Box2 [L]] + []; Set2 := Set2 + [Box2 [L]] + [];
end; end;
{$ifdef FPC_HAS_SET_INEQUALITIES }
if (Set1 <> Set2) OR (NOT (Set1 <= Set2)) OR (NOT (Set1 >= Set2)) then begin if (Set1 <> Set2) OR (NOT (Set1 <= Set2)) OR (NOT (Set1 >= Set2)) then begin
{$else FPC_HAS_SET_INEQUALITIES }
if (Set1 <> Set2) then begin
{$endif FPC_HAS_SET_INEQUALITIES }
WriteLn ('error in relational operators 1'); WriteLn ('error in relational operators 1');
Halt; Halt;
end; end;
@ -103,14 +110,20 @@ begin
Low := Random (256); Low := Random (256);
Hi := Random (256); Hi := Random (256);
Set2:= Set1 + [Low..Hi]; Set2:= Set1 + [Low..Hi];
{$ifdef FPC_HAS_SET_INEQUALITIES }
if (Set1 >= Set2) AND (Set1 <> Set2) then begin if (Set1 >= Set2) AND (Set1 <> Set2) then begin
{$else FPC_HAS_SET_INEQUALITIES }
if (Set1 <> Set2) then begin
{$endif FPC_HAS_SET_INEQUALITIES }
WriteLn ('error in relational operators 2'); WriteLn ('error in relational operators 2');
Halt; Halt;
end; end;
{$ifdef FPC_HAS_SET_INEQUALITIES }
if NOT (Set1 <= Set2) then begin if NOT (Set1 <= Set2) then begin
WriteLn ('error in relational operators 3'); WriteLn ('error in relational operators 3');
Halt; Halt;
end; end;
{$endif FPC_HAS_SET_INEQUALITIES }
Set1 := Set2; Set1 := Set2;
end; end;

View File

@ -1,4 +1,4 @@
{ { $OPT=-Fu../rtl/utils
$Id$ $Id$
Program to test string functions and speed of the functions Program to test string functions and speed of the functions