Algorithmique Numérique Distribuée Public GIT Repository
1 #!/usr/bin/perl -w
2 use strict;
4 if(\$#ARGV!=1) {
5     die "Usage: perl make_tesh.pl <directory> <old.tesh>\n";
6 }
8 my(\$directory)=\$ARGV[0];
9 my(\$old)=\$ARGV[1];
11 chdir("\$directory");
13 open SH_LIGNE, \$old or die "Unable to open \$old. \$!\n";
15 my(\$line);
16 my(\$line_exec);
17 my(\$l);
18 my(\$tmp);
20 print "#! ./tesh\n";
22 while(defined(\$line=<SH_LIGNE>))
23 {
24         if(\$line =~ /^p(.*)\$/)
25         {
26                 print "\$line\n";
27         }
28         else
29         {
30                 if(\$line =~ /^\\$(.*)\$/)
31                 {
32                         \$line_exec = \$line;
33                         \$line =~ s/\\$\{srcdir\:\=\.\}/./g;
34                         \$line =~ s/\\$SG_TEST_EXENV//g;
35                         \$line =~ s/\\$EXEEXT//g;
36                         \$line =~ s/^\\$\ */.\//g;
37                         \$line =~ s/^.\/lua/lua/g;
38                         \$line =~ s/^.\/ruby/ruby/g;
39                         \$line =~ s/--log=([^ ]*)/--log="\$1"/g;
40                         print "\n\$line_exec";
41                         chomp \$line;
42                         open (FILE, "\$line 2>&1|");
43                         while(defined(\$l=<FILE>))
44                         {
45                         chomp \$l;
46                         print "\> \$l\n";
47                         }
49                 }
50                 close(FILE);
51         }
52 }
54 close(SH_LIGNE);