Browse Source

* 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 months ago
parent
commit
8b48127b2c

+ 5 - 0
tests/test/tlibrary2.pp

@@ -16,6 +16,11 @@
 
 
 {$ifdef supported}
 {$ifdef supported}
 
 
+{$if (FPC_FULLVERSION<=30301) and defined(linux)}
+  uses
+    initc;
+{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
+
 const
 const
 {$ifdef windows}
 {$ifdef windows}
   libname='tlibrary1.dll';
   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}
 {$ifdef mswindows}
  {$define supported}
  {$define supported}
- {$define supportidx}
-{$endif win32}
+{$endif mswindows}
 {$ifdef Unix}
 {$ifdef Unix}
  {$define supported}
  {$define supported}
 {$endif Unix}
 {$endif Unix}
@@ -28,32 +16,25 @@
 
 
 {$ifdef supported}
 {$ifdef supported}
 
 
-library bug;
-
-uses
-  initc;
-
 const
 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}
 {$endif}
 
 
+procedure test;external libname name 'TestName';
+
 begin
 begin
+  if islibrary then
+    halt(3);
+  if moduleislib then
+    halt(4);
+  test;
 end.
 end.
-{$else supported}
+{$else not supported}
 begin
 begin
-  Writeln('No library for that target');
+  Writeln('Dummy test because target does not support libraries');
 end.
 end.
-{$endif supported}
+{$endif not supported}

+ 5 - 0
tests/test/tweaklib2.pp

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

+ 5 - 1
tests/webtbs/tw12704b.pp

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

+ 5 - 0
tests/webtbs/tw16949b.pp

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

+ 5 - 0
tests/webtbs/tw3964b.pp

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

+ 5 - 1
tests/webtbs/tw8730c.pp

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

+ 5 - 0
tests/webtbs/tw9089c.pp

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