Przeglądaj źródła

* some dummy .o files for solaris
* support running testsuite for non-default compiler targets (i.e. non-linux)

git-svn-id: trunk@2468 -

peter 19 lat temu
rodzic
commit
24fa3cc3bf

+ 4 - 0
.gitattributes

@@ -5410,6 +5410,9 @@ tests/test/cg/obj/macos/powerpc/ctest.o -text
 tests/test/cg/obj/netbsd/m68k/ctest.o -text
 tests/test/cg/obj/os2/i386/ctest.o -text
 tests/test/cg/obj/readme.txt svneol=native#text/plain
+tests/test/cg/obj/solaris/sparc/ctest.o -text
+tests/test/cg/obj/solaris/sparc/tcext3.o -text
+tests/test/cg/obj/solaris/sparc/tcext4.o -text
 tests/test/cg/obj/tcext3.c -text
 tests/test/cg/obj/tcext4.c -text
 tests/test/cg/obj/win32/i386/ctest.o -text
@@ -5616,6 +5619,7 @@ tests/test/tgeneric2.pp svneol=native#text/plain
 tests/test/tgeneric3.pp svneol=native#text/plain
 tests/test/tgeneric4.pp svneol=native#text/plain
 tests/test/tgeneric5.pp svneol=native#text/plain
+tests/test/tgeneric6.pp svneol=native#text/plain
 tests/test/tgoto.pp svneol=native#text/plain
 tests/test/theap.pp svneol=native#text/plain
 tests/test/thintdir.pp svneol=native#text/plain

+ 5 - 5
tests/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/01/13]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/02/06]
 #
 default: allexectests
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -1406,8 +1406,8 @@ ifeq ($(findstring -c$(TEST_FPC),$(DOTESTOPT)),)
 override DOTESTOPT+=-c$(TEST_FPC)
 endif
 endif
-ifneq ($(OS_TARGET),$(TEST_OS_TARGET))
-override DOTESTOPT+=-Y-T$(TEST_OS_TARGET)
+ifneq ($(FULL_TARGET),$(TEST_FULL_TARGET))
+override DOTESTOPT+=-T$(TEST_FULL_TARGET)
 endif
 ifneq ($(TEST_BINUTILSPREFIX),)
 override DOTESTOPT+=-Y-XP$(TEST_BINUTILSPREFIX) -Y-Xd
@@ -1422,7 +1422,7 @@ ifdef TEST_REMOTEPATH
 override DOTESTOPT+=-P$(TEST_REMOTEPATH)
 endif
 ifdef TEST_DELTEMP
-override DOTESTOPT+=-T
+override DOTESTOPT+=-Z
 endif
 ifdef TEST_VERBOSE
 override DOTESTOPT+=-V

+ 3 - 3
tests/Makefile.fpc

@@ -179,8 +179,8 @@ override DOTESTOPT+=-c$(TEST_FPC)
 endif
 endif
 
-ifneq ($(OS_TARGET),$(TEST_OS_TARGET))
-override DOTESTOPT+=-Y-T$(TEST_OS_TARGET)
+ifneq ($(FULL_TARGET),$(TEST_FULL_TARGET))
+override DOTESTOPT+=-T$(TEST_FULL_TARGET)
 endif
 ifneq ($(TEST_BINUTILSPREFIX),)
 override DOTESTOPT+=-Y-XP$(TEST_BINUTILSPREFIX) -Y-Xd
@@ -195,7 +195,7 @@ ifdef TEST_REMOTEPATH
 override DOTESTOPT+=-P$(TEST_REMOTEPATH)
 endif
 ifdef TEST_DELTEMP
-override DOTESTOPT+=-T
+override DOTESTOPT+=-Z
 endif
 ifdef TEST_VERBOSE
 override DOTESTOPT+=-V

BIN
tests/test/cg/obj/solaris/sparc/ctest.o


+ 0 - 0
tests/test/cg/obj/solaris/sparc/tcext3.o


+ 0 - 0
tests/test/cg/obj/solaris/sparc/tcext4.o


+ 50 - 0
tests/test/tgeneric6.pp

@@ -0,0 +1,50 @@
+{$mode objfpc}
+
+type
+   generic PListItem<_T>=^specialize TListItem<_T>;
+   generic TListItem<_T>=record
+     data : _T;
+     next : specialize PListItem<_T>;
+   end;
+
+   generic TList<_T>=class(TObject)
+     first : specialize PListItem<_T>;
+     procedure Add(item: _T);
+   end;
+
+procedure TList.Add(data: _T);
+var
+  newitem : specialize PListItem<_T>;
+begin
+  new(newitem);
+  newitem.data:=data;
+  newitem.next:=first;
+end;
+
+type
+  TMyIntList = specialize TList<integer>;
+  TMyStringList = specialize TList<string>;
+
+var
+  ilist : TMyIntList;
+  slist : TMyStringList;
+  someInt : integer;
+begin
+  someInt:=10;
+  ilist := TMyIntList.Create;
+  ilist.Add(someInt);
+  ilist.Add(someInt+1);
+  writeln(ilist.first^.data);
+  if ilist.data<>10 then
+    halt(1);
+  writeln(ilist.first^.next^.data);
+  if ilist.data<>11 then
+    halt(1);
+
+  slist := TMyStringList.Create;
+  slist.Add('Test1');
+  slist.Add('Test2');
+  writeln(slist.data);
+  if slist.data<>'Test1' then
+    halt(1);
+end.

+ 69 - 23
tests/utils/dotest.pp

@@ -56,10 +56,13 @@ var
   RTLUnitsDir,
   TestOutputDir,
   OutputDir : string;
-  CompilerBin : string;
-  CompilerCPU : string;
-  CompilerTarget : string;
-  CompilerVersion : string;
+  CompilerBin,
+  CompilerCPU,
+  CompilerTarget,
+  CompilerVersion,
+  DefaultCompilerCPU,
+  DefaultCompilerTarget,
+  DefaultCompilerVersion : string;
   PPFile : string;
   PPFileInfo : string;
   TestName : string;
@@ -353,11 +356,32 @@ begin
     return the first info }
   case c of
     compver :
-      hs:='-iVTPTO';
+      begin
+        if DefaultCompilerVersion<>'' then
+          begin
+            GetCompilerInfo:=true;
+            exit;
+          end;
+        hs:='-iVTPTO';
+      end;
     compcpu :
-      hs:='-iTPTOV';
+      begin
+        if DefaultCompilerCPU<>'' then
+          begin
+            GetCompilerInfo:=true;
+            exit;
+          end;
+        hs:='-iTPTOV';
+      end;
     comptarget :
-      hs:='-iTOTPV';
+      begin
+        if DefaultCompilerTarget<>'' then
+          begin
+            GetCompilerInfo:=true;
+            exit;
+          end;
+        hs:='-iTOTPV';
+      end;
   end;
   ExecuteRedir(CompilerBin,hs,'','out','');
   assign(t,'out');
@@ -375,21 +399,21 @@ begin
      case c of
        compver :
          begin
-           CompilerVersion:=GetToken(hs);
-           CompilerCPU:=GetToken(hs);
-           CompilerTarget:=GetToken(hs);
+           DefaultCompilerVersion:=GetToken(hs);
+           DefaultCompilerCPU:=GetToken(hs);
+           DefaultCompilerTarget:=GetToken(hs);
          end;
        compcpu :
          begin
-           CompilerCPU:=GetToken(hs);
-           CompilerTarget:=GetToken(hs);
-           CompilerVersion:=GetToken(hs);
+           DefaultCompilerCPU:=GetToken(hs);
+           DefaultCompilerTarget:=GetToken(hs);
+           DefaultCompilerVersion:=GetToken(hs);
          end;
        comptarget :
          begin
-           CompilerTarget:=GetToken(hs);
-           CompilerCPU:=GetToken(hs);
-           CompilerVersion:=GetToken(hs);
+           DefaultCompilerTarget:=GetToken(hs);
+           DefaultCompilerCPU:=GetToken(hs);
+           DefaultCompilerVersion:=GetToken(hs);
          end;
      end;
      GetCompilerInfo:=true;
@@ -400,7 +424,10 @@ end;
 function GetCompilerVersion:boolean;
 begin
   if CompilerVersion='' then
-    GetCompilerVersion:=GetCompilerInfo(compver)
+    begin
+      GetCompilerVersion:=GetCompilerInfo(compver);
+      CompilerVersion:=DefaultCompilerVersion;
+    end
   else
     GetCompilerVersion:=true;
   if GetCompilerVersion then
@@ -411,7 +438,10 @@ end;
 function GetCompilerCPU:boolean;
 begin
   if CompilerCPU='' then
-    GetCompilerCPU:=GetCompilerInfo(compcpu)
+    begin
+      GetCompilerCPU:=GetCompilerInfo(compcpu);
+      CompilerCPU:=DefaultCompilerCPU;
+    end
   else
     GetCompilerCPU:=true;
   if GetCompilerCPU then
@@ -422,7 +452,10 @@ end;
 function GetCompilerTarget:boolean;
 begin
   if CompilerTarget='' then
-    GetCompilerTarget:=GetCompilerInfo(comptarget)
+    begin
+      GetCompilerTarget:=GetCompilerInfo(comptarget);
+      CompilerTarget:=DefaultCompilerTarget;
+    end
   else
     GetCompilerTarget:=true;
   if GetCompilerTarget then
@@ -488,7 +521,7 @@ var
   execres : boolean;
 begin
   RunCompiler:=false;
-  args:='-n -Fu'+RTLUnitsDir;
+  args:='-n -T'+CompilerTarget+' -Fu'+RTLUnitsDir;
   args:=args+' -FE'+TestOutputDir;
 {$ifdef macos}
   args:=args+' -WT ';  {tests should be compiled as MPWTool}
@@ -789,7 +822,7 @@ procedure getargs;
 var
   ch   : char;
   para : string;
-  i    : longint;
+  i,j  : longint;
 
   procedure helpscreen;
   begin
@@ -807,13 +840,14 @@ var
     writeln('  -M<emulator>  run the tests using the given emulator');
     writeln('  -R<remote>    run the tests remotely with the given rsh/ssh address');
     writeln('  -S            use ssh instead of rsh');
-    writeln('  -T            remove temporary files (executable,ppu,o)');
+    writeln('  -T[cpu-]<os>  run tests for target cpu and os');
     writeln('  -P<path>      path to the tests tree on the remote machine');
     writeln('  -U<remotepara>');
     writeln('                pass additional parameter to remote program. Multiple -U can be used');
     writeln('  -V            be verbose');
     writeln('  -W            use putty compatible file names when testing (plink and pscp)');
     writeln('  -Y<opts>      extra options passed to the compiler. Several -Y<opt> can be given.');
+    writeln('  -Z            remove temporary files (executable,ppu,o)');
     halt(1);
   end;
 
@@ -874,7 +908,16 @@ begin
            end;
 
          'T' :
-           DelExecutable:=true;
+           begin
+             j:=Pos('-',Para);
+             if j>0 then
+               begin
+                 CompilerCPU:=Copy(Para,1,j-1);
+                 CompilerTarget:=Copy(Para,j+1,255);
+               end
+             else
+               CompilerTarget:=Para
+           end;
 
          'U' :
            RemotePara:=RemotePara+' '+Para;
@@ -891,6 +934,9 @@ begin
          'X' : UseComSpec:=false;
 
          'Y' : ExtraCompilerOpts:= ExtraCompilerOpts +' '+ Para;
+
+         'Z' :
+           DelExecutable:=true;
         end;
      end
     else