root/branches/newmole/scripts/nightly_copy_tsuite.pl

Revision 367, 8.1 kB (checked in by gary, 2 years ago)

rename scripts so that all nightly scripts have names starting nightly_xxx

reorder dir work in nightly_copy_tsuite.pl so that cluster work done first, so that, in case of abort, unix and win versions are not deleted

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1#!perl -w
2
3# This script copies source and test suite from pc to linux cluster
4# it will convert ascii pc source files into unix eol files
5# tar and zip files are created in the pc directory
6
7# bring in the perl module that includes copy
8use File::Copy;
9
10# base name for where we are
11$basename = "c:/projects/cloudy/trunk/";
12
13# --------------------------------------------------------------------------
14# set up path names to all targets on various machines
15# the dir above the working copies of the tsuite
16#$trunk_dir = "c:/projects/cloudy/trunk/tsuite";
17$trunk_dir = "$basename"."tsuite";
18
19# the root directories for the tsuites - zip/tar files will end up here
20#$unix_copy_dir    = "c:/projects/cloudy/trunk/unix/tsuite";
21$unix_copy_dir    = "$basename"."unix/tsuite";
22#$unix_copy_basedir    = "c:/projects/cloudy/trunk/unix";
23$unix_copy_basedir    = "$basename"."unix";
24#$win_copy_dir     = "c:/projects/cloudy/trunk/win/tsuite";
25$win_copy_dir     = "$basename"."win/tsuite";
26#$win_copy_basedir     = "c:/projects/cloudy/trunk/win;
27$win_copy_basedir     = "$basename"."win";
28
29$cluster_copy_dir = "u:/cloudy/trunk/tsuite";
30
31# ftp site on cluster
32$ftp_last = "u:/pub/gary/bleeding_edge/last";
33
34# the subdirectories under tsuite
35@subdirs=("auto","slow");
36
37# end block - set up path names to all targets on various machines
38# --------------------------------------------------------------------------
39
40# array index for dirs below tsuite
41for ($ndir=0; $ndir<2; $ndir++)
42{
43   
44   # --------------------------------------------------------------------------
45   # clean out the target directories so we get fresh copies
46   
47   # move to cluster tsuite directory - do this first since this will abort if
48   # u drive is not mounted
49   $dir = "$cluster_copy_dir"."/"."$subdirs[$ndir]";
50   chdir( "$dir" ) or die " could not move to cluster target directory \n";
51   print(" moved to cluster tsuite directory, about to delete in files\n");
52   # remove the old unix tsuite files - do not do * since want to keep perl files
53   unlink <*.in>;
54   #
55   # move to the unix tsuite dir
56   $dir = "$unix_copy_dir"."/"."$subdirs[$ndir]";
57   chdir( "$dir" ) or die " could not move to test suite directory \n";
58   print(" moved to tsuite unix target directory, about to delete all files\n");
59   # remove all files
60   unlink <*> ;
61   
62   # move to the win tsuite directory
63   $dir = "$win_copy_dir"."/"."$subdirs[$ndir]";
64   chdir( "$dir" ) or die " could not move to test suite directory \n";
65   print(" moved to tsuite win target directory, about to delete all files\n");
66   # remove the win tsuite files
67   unlink <*> ;
68   # do not remove the *.out since a job may be running
69   
70   # end block - all target directories cleaned out the so we get fresh copies
71   # --------------------------------------------------------------------------
72   
73   
74   # --------------------------------------------------------------------------
75   # now copy files from trunk to copy dirs
76   #
77   # move to original tsuite directory
78   $dir = "$trunk_dir"."/"."$subdirs[$ndir]";
79   chdir( "$dir" ) or die " could not move to trunk directory \n";
80   
81   # this loops over all input files in the original tsuite directory
82   # and copies unix eol version to subdir unix, which is now empty
83   # and windows eol version to subdir win/tsuite, which is empty
84   while( defined( $input = glob("*.in") ) )
85   {
86           print( "$input going to " );
87           $output = "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
88           print("$output\n");
89           # actually copy the file
90           system "dos2unix < $input  > $output";
91   #
92   #       now do win version
93           print( "$input going to " );
94           $output = "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
95           print("$output\n");
96           # actually execute the code
97           copy( $input  , $output );
98   }
99   
100   # now copy all html files
101   while( defined( $input = glob("*.htm") ) )
102   {
103           print( "$input going to " );
104           $output = "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
105           print("$output\n");
106           # actually execute the code
107           system "dos2unix < $input  > $output";
108           $output = "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
109           print("$output\n");
110           # actually execute the code
111           copy( $input , $output );
112   }
113   
114   # now copy all ini files
115   while( defined( $input = glob("*.ini") ) )
116   {
117           print( "$input going to " );
118           $output = "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
119           print("$output\n");
120           # actually execute the code
121           system "dos2unix < $input  > $output";
122           $output = "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
123           print("$output\n");
124           # actually execute the code
125           copy( $input , $output );
126   }
127   
128   # now copy all dat files
129   while( defined( $input = glob("*.dat") ) )
130   {
131           print( "$input going to " );
132           $output = "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
133           print("$output\n");
134           # actually execute the code
135           system "dos2unix < $input  > $output";
136           $output = "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
137           print("$output\n");
138           # actually execute the code
139           copy( $input , $output );
140   }
141   
142   # the clouds image is a binary file do a straight copy
143   copy( "clouds.jpg" , "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."clouds.jpg" );
144   # the clouds image is a binary file
145   copy( "clouds.jpg" , "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."clouds.jpg" );
146   
147   # now copy all perl scripts
148   while( defined( $input = glob("*.pl") ) )
149   {
150           print( "$input going to " );
151           $output = "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
152           print("$output\n");
153           # actually execute the code
154           system "dos2unix < $input  > $output";
155           $output = "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
156           print("$output\n");
157           # actually execute the code
158           copy( $input , $output );
159   }
160   
161   print("All tsuite files have been copied to pc unix and win subdirs\n");
162   
163   # move to pc unix copy tsuite directory and copy across to cluster
164   $dir = "$unix_copy_dir"."/"."$subdirs[$ndir]";
165   chdir( "$dir" ) or die " could not move to pc unix directory \n";
166   # this loops over all files in the pc unix tsuite directory
167   # and copies unix version to subdir unix on cluster, which is now empty
168   while( defined( $input = glob("*") ) )
169   {
170           print( "$input going to " );
171           $output = "$cluster_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
172           print("$output\n");
173           # actually copy the file
174           copy( $input  , $output );
175   }
176   # end copying files around
177   # --------------------------------------------------------------------------
178   
179   
180   # now zip up the directories we created - move into each do it from there
181   # so that dir name is not included
182   
183   # base name of tar file
184   $tarfile_basename = "tsuite_"."$subdirs[$ndir]";
185   
186   $dir = "$unix_copy_dir"."/"."$subdirs[$ndir]";
187   chdir( "$dir" ) or die " could not move to pc unix directory \n";
188   print(" moved to unix copy directory\n");
189   
190   $tarfile = "$unix_copy_basedir"."/"."$tarfile_basename".".tar";
191   # remove old gzipd file if it exists
192   if( -e "$tarfile" )
193   {
194      unlink("$tarfile" );
195   }
196   
197   #   tar the files
198   #   NB we must do this in the directory so that we do not keep the dir structure, just names
199   # the cygwin tar chocked on the fully resolved tarfile name
200   #system "tar -cf $tarfile * ";
201   system "C:\\u\\mks\\mksnt\\tar_mks.exe -cf $tarfile * ";
202   print( "about to gzip $tarfile\n" );
203   # remove old gzipd file if it exists
204   if( -e "$tarfile".".gz" )
205   {
206      unlink("$tarfile".".gz" );
207   }
208   system "gzip $tarfile ";
209   
210   # copy to the ftp site
211   copy( "$tarfile".".gz" , $ftp_last );
212   
213   # how go to win home and zip the win source dir
214   $dir = "$win_copy_dir"."/"."$subdirs[$ndir]";
215   chdir( "$dir" ) or die " could not move to pc win directory \n";
216   print(" moved to win copy directory\n");
217   
218   # remove old gzipd file if it exists
219   $tarfile = "$win_copy_basedir"."/"."$tarfile_basename".".zip";
220   if( -e "$tarfile" )
221   {
222      unlink("$tarfile" );
223   }
224   
225   # create zip file
226   #system "c:\\u\\wzzip $tarfile  ";
227   system "wzzip $tarfile  ";
228   
229   # finally copy the newly created files to the ftp site
230   copy( "$tarfile" , $ftp_last );
231   
232   print("\ndone\n");
233
234}
Note: See TracBrowser for help on using the browser.