Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / tools / cmake / scripts / update_tesh.pl
1 #!/usr/bin/env perl
2
3 # Copyright (c) 2012-2019. The SimGrid Team.
4 # All rights reserved.
5
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
8
9 use strict;
10 use warnings;
11
12 if($#ARGV!=1) {
13     die "Usage: perl update_tesh.pl <directory> <old.tesh>\n";
14 }
15
16 my($directory)=$ARGV[0];
17 my($old)=$ARGV[1];
18
19 chdir("$directory");
20
21 open SH_LIGNE, $old or die "Unable to open $old. $!\n";
22
23 my($line);
24 my($line_exec);
25 my($l);
26 my($tmp);
27
28 while(defined($line=<SH_LIGNE>))
29 {
30         if($line =~ /^\$(.*)$/)
31         {
32                 $line_exec = $line;
33                 $line =~ s/\$\{srcdir\:\=\.\}/./g;
34                 $line =~ s/\(/\\(/g;
35                 $line =~ s/\)/\\)/g;
36                 $line =~ s/\$SG_TEST_EXENV//g;
37                 $line =~ s/\$EXEEXT//g;
38                 $line =~ s/^\$\ */.\//g;
39                 $line =~ s/^.\/lua/lua/g;
40                 $line =~ s/^.\/ruby/ruby/g;
41                 $line =~ s/--log=([^ ]*)/--log="$1"/g;
42                 print "$line_exec";
43                 chomp $line;
44                 open (FILE, "$line 2>&1|");
45                 while(defined($l=<FILE>))
46                 {
47                 chomp $l;
48                 print "\> $l\n";
49                 }
50                 close(FILE);
51         }
52         else
53         {
54                 if($line =~ /^\>(.*)$/)
55                 {
56                 }
57                 else
58                 {
59                 print "$line";
60                 }
61         }       
62 }
63
64 close(SH_LIGNE);