Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move datadesc and TCP sockets from GRAS to XBT.
[simgrid.git] / buildtools / Cmake / update_tesh.pl
1 #!/usr/bin/perl -w
2 use strict;
3
4 if($#ARGV!=1) {
5     die "Usage: perl make_tesh.pl <directory> <old.tesh>\n";
6 }
7
8 my($directory)=$ARGV[0];
9 my($old)=$ARGV[1];
10
11 chdir("$directory");
12
13 open SH_LIGNE, $old or die "Unable to open $old. $!\n";
14
15 my($line);
16 my($line_exec);
17 my($l);
18 my($tmp);
19
20 while(defined($line=<SH_LIGNE>))
21 {
22         if($line =~ /^\$(.*)$/)
23         {
24                 $line_exec = $line;
25                 $line =~ s/\$\{srcdir\:\=\.\}/./g;
26                 $line =~ s/\(/\\(/g;
27                 $line =~ s/\)/\\)/g;
28                 $line =~ s/\$SG_TEST_EXENV//g;
29                 $line =~ s/\$EXEEXT//g;
30                 $line =~ s/^\$\ */.\//g;
31                 $line =~ s/^.\/lua/lua/g;
32                 $line =~ s/^.\/ruby/ruby/g;
33                 $line =~ s/--log=([^ ]*)/--log="$1"/g;
34                 print "$line_exec";
35                 chomp $line;
36                 open (FILE, "$line 2>&1|");
37                 while(defined($l=<FILE>))
38                 {
39                 chomp $l;
40                 print "\> $l\n";
41                 }
42                 close(FILE);
43         }
44         else
45         {
46                 if($line =~ /^\>(.*)$/)
47                 {
48                 }
49                 else
50                 {
51                 print "$line";
52                 }
53         }       
54 }
55
56 close(SH_LIGNE);