Răsfoiți Sursa

* as shared libraries without glibc on linux currently don't work, link those tests
on current fpc versions and linux always against glibc, so the shared library handling is tested

florian 10 luni în urmă
părinte
comite
8b48127b2c

+ 5 - 0
tests/test/tlibrary2.pp

@@ -16,6 +16,11 @@
 
 {$ifdef supported}
 
+{$if (FPC_FULLVERSION<=30301) and defined(linux)}
+  uses
+    initc;
+{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
+
 const
 {$ifdef windows}
   libname='tlibrary1.dll';

+ 20 - 39
tests/test/tlibrary3.pp

@@ -1,24 +1,12 @@
-{ %NORUN }
-{ %SKIPTARGET=macos, $nosharedlib, win64 }
-{ %delfiles=tlibrary3 }
+{ %skiptarget=$nosharedlib }
+{ %NEEDLIBRARY }
+{ %delfiles=tlibrary1 }
 
-{$ifdef darwin}
-{$PIC+}
-{$endif darwin}
-
-{$ifdef CPUX86_64}
-{$ifndef WINDOWS}
-{$PIC+}
-{$endif WINDOWS}
-{$endif CPUX86_64}
-
-{ The .so of the library needs to be in the current dir when
-  testing the loading at runtime }
+{ Test program to test linking to fpc library }
 
 {$ifdef mswindows}
  {$define supported}
- {$define supportidx}
-{$endif win32}
+{$endif mswindows}
 {$ifdef Unix}
  {$define supported}
 {$endif Unix}
@@ -28,32 +16,25 @@
 
 {$ifdef supported}
 
-library bug;
-
-uses
-  initc;
-
 const
-   publicname='TestName';
-   publicindex = 1234;
-
-procedure Test;export;
-
- begin
-//   writeln('Hoi');
- end;
-
-exports
-  Test name publicname;
-{$ifdef supportidx}
-exports
-  Test index publicindex;
+{$ifdef windows}
+  libname='tlibrary1.dll';
+{$else}
+  libname='tlibrary1';
+  {$linklib tlibrary1}
 {$endif}
 
+procedure test;external libname name 'TestName';
+
 begin
+  if islibrary then
+    halt(3);
+  if moduleislib then
+    halt(4);
+  test;
 end.
-{$else supported}
+{$else not supported}
 begin
-  Writeln('No library for that target');
+  Writeln('Dummy test because target does not support libraries');
 end.
-{$endif supported}
+{$endif not supported}

+ 5 - 0
tests/test/tweaklib2.pp

@@ -11,6 +11,11 @@
 
 {$ifdef supported}
 
+{$if (FPC_FULLVERSION<=30301) and defined(linux)}
+  uses
+    initc;
+{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
+
 const
   {$ifdef windows}
     libname='tweaklib1.dll';

+ 5 - 1
tests/webtbs/tw12704b.pp

@@ -6,7 +6,11 @@
 program MainApp;
 
 uses
-  sysutils;
+  sysutils
+{$if (FPC_FULLVERSION<=30301) and defined(linux)}
+  ,initc
+{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
+;
 
 const
 {$ifdef windows}

+ 5 - 0
tests/webtbs/tw16949b.pp

@@ -6,6 +6,11 @@ program ptest;
 
 {$ifdef fpc}{$mode objfpc}{$H+}{$endif fpc}
 
+{$if (FPC_FULLVERSION<=30301) and defined(linux)}
+  uses
+    initc;
+{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
+
 const
 {$if defined(windows) or defined(mswindows)}
   libname='tw16949a.dll';

+ 5 - 0
tests/webtbs/tw3964b.pp

@@ -2,6 +2,11 @@
 { %target=linux,haiku }
 {$mode objfpc}
 
+{$if (FPC_FULLVERSION<=30301) and defined(linux)}
+  uses
+    initc;
+{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
+
 {$linklib tw3964a}
 
 function testfunc : longint;

+ 5 - 1
tests/webtbs/tw8730c.pp

@@ -5,7 +5,11 @@
 program MainApp;
 
 uses
-  sysutils;
+  sysutils
+{$if (FPC_FULLVERSION<=30301) and defined(linux)}
+  ,initc
+{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
+  ;
 
 const
 {$ifdef windows}

+ 5 - 0
tests/webtbs/tw9089c.pp

@@ -6,6 +6,11 @@ program ptest;
 
 {$ifdef fpc}{$mode objfpc}{$H+}{$endif fpc}
 
+{$if (FPC_FULLVERSION<=30301) and defined(linux)}
+  uses
+    initc;
+{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
+
 const
 {$if defined(windows) or defined(mswindows)}
   libname='tw9089b.dll';