Jonas Maebe wrote:

Isn't it easier to simply copy all compiled libraries to the target when they are compiled (just like compiled test programs are copied)?

this second approach (which works well for me) copies the libraries when the are compiled. No need to expand the %needlibrary directive.

Regards, Bernd.

Index: tests/utils/dotest.pp
===================================================================
--- tests/utils/dotest.pp       (Revision 17610)
+++ tests/utils/dotest.pp       (Arbeitskopie)
@@ -930,6 +930,8 @@
         str(Config.Timeout,s);
         execcmd:=execcmd+s;
       end;
+      if Config.NeedLibrary then
+         execcmd:=execcmd+'export LD_LIBRARY_PATH='+RemotePath + ' ; ';
       { as we moved to RemotePath, if path is not absolute
         we need to use ./execfilename only }
       if not isabsolute(TestRemoteExe) then
@@ -1185,6 +1187,8 @@
 var
   PPDir : string;
   Res : boolean;
+  LocalLibraryFile, LibraryFileName: String;
+  execres: Boolean;
 begin
   Res:=GetConfig(PPFile[current],Config);
 
@@ -1398,6 +1402,20 @@
    begin
      if (Config.NoRun) then
       begin
+        if (CompilerTarget = 'linux') and (RemoteAddr <> '') then
+        { if test program is a library, copy the library to the target }
+        begin
+           LibraryFileName:= 'lib' + 
ForceExtension(SplitFileName(PPFile[current]), 'so');
+           LocalLibraryFile:= OutputDir + '/' + SplitPath(PPFile[current]) + 
LibraryFileName;
+           if FileExists(LocalLibraryFile) then
+           begin
+              execres:=ExecuteRedir(rcpprog,RemotePara+' '+ LocalLibraryFile+' 
'+RemoteAddr+':' + RemotePath+'/'+ LibraryFileName,'',EXELogFile,'stdout');
+              if not execres then
+              begin
+                Verbose(V_normal, 'Could not copy library ' + LibraryFileName);
+              end;
+           end;
+        end;
         { avoid a second attempt by writing to elg file }
         AddLog(EXELogFile,skipping_run_test+PPFileInfo[current]);
         AddLog(ResLogFile,skipping_run_test+PPFileInfo[current]);
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to