gen_tutorials_tests.pl 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #!/usr/bin/perl
  2. @the_skiplist = <<END_OF_SKIPLIST =~ m/(\S.*\S)/g;
  3. /examples/emulation/extclient/omnetpp.ini General # ext interface tests are not supported as they require pcap drivers and external events
  4. /examples/emulation/extserver/omnetpp.ini Uplink_Traffic # ext interface tests are not supported as they require pcap drivers and external events
  5. /examples/emulation/extserver/omnetpp.ini Downlink_Traffic # ext interface tests are not supported as they require pcap drivers and external events
  6. /examples/emulation/extserver/omnetpp.ini Uplink_and_Downlink_Traffic # ext interface tests are not supported as they require pcap drivers and external events
  7. /examples/emulation/traceroute/omnetpp.ini General # ext interface tests are not supported as they require pcap drivers and external events
  8. /examples/ethernet/lans/defaults.ini General # <!> Error: Network `' or `inet.examples.ethernet.lans.' not found, check .ini and .ned files. # The defaults.ini file included from other ini files
  9. END_OF_SKIPLIST
  10. # next line DISABLE previous skiplist:
  11. #@the_skiplist = ();
  12. foreach $i ( @the_skiplist )
  13. {
  14. ($x) = $i =~ m/\#\s*(.*)$/;
  15. $i =~ s/\s*\#.*//;
  16. $skiplist{$i} = '# '.$x;
  17. }
  18. #print "-",join("-\n-",keys(%skiplist)),"-\n";
  19. #die();
  20. $DN = `dirname $0`;
  21. chomp $DN;
  22. #print "DN='$DN'\n";
  23. chdir "$DN/../..";
  24. $INETROOT=`pwd`;
  25. chomp $INETROOT;
  26. #print "INETROOT='$INETROOT'\n";
  27. @inifiles = sort `find tutorials -name '*.ini'`;
  28. die("Not found ini files\n") if ($#inifiles lt 0);
  29. #print "=====================================\n",@inifiles,"=========================================\n";
  30. @runs = ();
  31. print '# workingdir, args, simtimelimit, fingerprint'."\n";
  32. foreach $fname (@inifiles)
  33. {
  34. chomp $fname;
  35. open(INFILE, $fname) || die "cannot open $fname";
  36. read(INFILE, $txt, 1000000) || die "cannot read $fname";
  37. close INFILE;
  38. ### next if ($txt =~ /\bfingerprint\s*=/); #skip fingerprint tests
  39. @configs = ($txt =~ /^\s*(\[Config [a-zA-Z_0-9-]+\].*)$/mg);
  40. # print "-1- ",$#configs," ---------------->file=$fname, configs={",join(',',@configs),"}\n";
  41. @configs = ( "[Config General]" ) if ($#configs lt 0);
  42. # print "-2- ",$#configs," --------------->file=$fname, configs={",join(',',@configs),"}\n";
  43. # extends = XXX, YYY, ....
  44. @extends = ();
  45. @extendslines = ($txt =~ /^\s*extends\s*=\s*([^\#\n]+)\s*(?:\#.*)?$/mg);
  46. foreach $line (@extendslines)
  47. {
  48. $line =~ s/^\s+//;
  49. $line =~ s/\s+$//;
  50. #print "-e1- >", $line, "<\n";
  51. @items = split(/\s*,\s*/, $line);
  52. foreach $item (@items)
  53. {
  54. #print "-e2- >", $item, "<\n";
  55. $extends{$item} = "# $item extended";
  56. }
  57. }
  58. #print "-e3- >", join(', ',keys(%extends)), "<\n";
  59. foreach $conf (@configs)
  60. {
  61. ($cfg,$comm) = ($conf =~ /^\[Config ([a-zA-Z_0-9-]+)\]\s*(\#.*)?$/g);
  62. ($dir,$fnameonly) = ($fname =~ /(.*)[\/\\](.*)/);
  63. $run = "/".$dir.'/'.",";
  64. $run .= (' 'x(36-length $run)).' ';
  65. $run .= "-f $fnameonly -c $cfg -r 0";#.",";
  66. $xrun = "/$dir/$fnameonly $cfg";
  67. # $run .= (' 'x(83-length $run)).' ';
  68. # $run .= '---100s'.",";
  69. # $run .= (' 'x(100-length $run)).' ';
  70. # $run .= '0'; # intentionally no "-r 0" -- test should do all runs if fits into the time limit...
  71. $x = "$run";
  72. if ($comm =~ /\b__interactive__\b/i)
  73. {
  74. $x = "# $run # $conf";
  75. }
  76. elsif (length($extends{$cfg}))
  77. {
  78. $x = "# $run ".$extends{$cfg};
  79. }
  80. elsif (length($skiplist{$xrun}))
  81. {
  82. $x = "# $run ".$skiplist{$xrun};
  83. }
  84. print "$x\n";
  85. }
  86. }