tests/run-tests.rb
author Jan Vrany <jan.vrany@labware.com>
Mon, 29 Nov 2021 16:36:55 +0000
changeset 4010 19843598d34b
parent 3507 041e88b3db01
permissions -rw-r--r--
Test for different methods in `ProjectDefinition >> #postLoadJavaHook` This commit just changes the clumsy test for compiled class libraries to use multiple different methods. `#classNamesAndAttributes` may be missing in (pure) Pharo `PackageManifests`. `#mandatoryPreRequisites` may be missing in some old project definitions created before (single) `#preRequisites` have been split to `#mandatoryPreRequisites` and `#requiredPreRequisites`. Sigh.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
#!/usr/bin/ruby
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
     2
DOCUMENTATION = <<DOCEND
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
     3
A simple script to run all tests on all supported JDKs. Use this to check
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
     4
changes before pushing to upstream repository!
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
     5
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
     6
== Parameters ==
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
     7
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
     8
Following parameters are currently supported:
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
     9
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    10
* STX_LIBJAVA_RELEASE ..... which Java releases to test. Defaults to
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    11
                            'JDK6, JDK7, zulu7'
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    12
* STX_LIBJAVA_ENABLE_JIT .. test with Java JIT on ("1") or off ("0").
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    13
                            Defaults to off ("0")
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    14
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    15
This script takes parameter values, compute all possible combinations
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    16
and run tests on each combination, writing results to an output directory.
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    17
Parameter values are specified as a list of comma-separated values.
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    18
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    19
== Results ==
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    20
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    21
After all tests finish, a short summay is written to the standard output.
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    22
In addition, this summary, test report in JUnit xml format as well and
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    23
tests' stdout is written to a new directory named "results-YYYY-MM-DD-HH-MM-SS"
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    24
where YYYY-MM-DD-HH-MM-SS is current date time.
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    25
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    26
== Examples ==
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    27
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    28
Run all standard tests (to be run before push!):
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    29
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    30
   ./run-tests.rb
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    31
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    32
Run basic and Mauve test suites on JDK7 in both interpreted and JIT modes:
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    33
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    34
   ./run-tests.rb -D "STX_LIBJAVA_RELEASE=JDK7" -D "STX_LIBJAVA_ENABLE_JIT=1,0"\
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    35
                  -p stx:libjava -p stx:libjava/tests/mauve
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    36
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    37
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    38
DOCEND
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    39
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    40
3020
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    41
require 'rbconfig'
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
require 'fileutils'
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    43
require 'optparse'
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    45
PACKAGES = [
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    46
  'stx:libjava',
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    47
  'stx:libjava/tests/mauve',
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    48
  'stx:libjava/experiments',
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    49
  'stx:libjava/tools'
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    50
]
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    51
PARAM_NAMES=[ 'STX_LIBJAVA_ENABLE_JIT', 'STX_LIBJAVA_RELEASE' ]
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
PARAMS = {
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    53
  'STX_LIBJAVA_ENABLE_JIT' => [
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    54
    #'1',
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    55
    '0'
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    56
  ],
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    57
  'STX_LIBJAVA_RELEASE' => [
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    58
    'JDK6',
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    59
    'JDK7',
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    60
    'zulu7'
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    61
  ]
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
}
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
REPORT_DIR="results-#{Time.now.strftime("%Y-%m-%d-%H-%M-%S")}"
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
3020
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    66
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    67
def win32?
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    68
  return (RbConfig::CONFIG['host_os'] =~ /mingw32/) != nil
3020
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    69
end
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    70
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    71
def unix?
3020
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    72
  if win32_wine?
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    73
    return false
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    74
  end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    75
  return (RbConfig::CONFIG['host_os'] =~ /linux|solaris/) != nil
3020
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    76
end
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    77
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    78
if win32?
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    79
  REPORT_RUNNER = File.join(File.dirname(__FILE__), '..', '..', 'goodies', 'builder', 'reports' , 'report-runner.bat')
3020
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    80
else
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    81
  REPORT_RUNNER = File.join(File.dirname(__FILE__), '..', '..', 'goodies', 'builder', 'reports' , 'report-runner.sh')
3020
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    82
end
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    83
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    84
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    85
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
def run_package(package, params = {})
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    87
  ident = []
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    88
  setup = 'Stdin close'
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    89
  params.keys.sort.each do | name |
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    90
    value = params[name]
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    91
    ident.push("#{name}=#{value}")
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    92
    ENV[name] = value
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    93
  end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    94
  if ident.size > 0 then
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    95
    logf = File.join(REPORT_DIR, "#{package.tr(':/', '__')}-#{ident.join('-')}-Test.out")
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    96
    ident = "#{ident.join('-')}"
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    97
    cmd = %W[#{REPORT_RUNNER} -S #{setup} -D #{REPORT_DIR} -i #{ident} -r Builder::TestReport -p #{package}]
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    98
    #cmd = %W[#{REPORT_RUNNER} -S #{setup} -D #{REPORT_DIR} -i #{ident} -r Builder::TestReport ]
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    99
  else
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   100
    logf = File.join(REPORT_DIR, "#{package.tr(':/', '__')}-Test.out")
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   101
    ident = ''
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   102
    cmd = %W[#{REPORT_RUNNER} -S #{setup}  -D #{REPORT_DIR} -r Builder::TestReport -p #{package}]
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   103
  end
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   105
  puts "Running #{package} {#{ident}}"
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   106
  puts cmd.join()
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   107
  pattern = /SUMMARY: (?<run>\d+) run, (?<passed>\d+) passed, (?<skipped>\d+) skipped, (?<failed>\d+) failed, (?<error>\d+) error/
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   108
  result = {
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   109
            'run' => '?',
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   110
            'passed' => '?',
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   111
            'skipped' => '?',
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   112
            'failed' => '?',
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   113
            'error' => '?'
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   114
          }
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   115
  IO.popen(cmd + [ :err => [:child, :out]]) do | out |
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   116
    File.open(logf, "w") do | log |
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   117
      out.each do | line |
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   118
        log.puts line
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   119
        puts line
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   120
        match = pattern.match (line)
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   121
        if match then
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   122
          result = {
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   123
            'run' => match['run'],
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   124
            'passed' => match['passed'],
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   125
            'skipped' => match['skipped'],
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   126
            'failed' => match['failed'],
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   127
            'error' => match['error']
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   128
          }
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   129
        end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   130
      end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   131
    end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   132
  end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   133
  result['ident'] = ident
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   134
  result['package'] = package
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   135
  result['params'] = params
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   136
  return result
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
end
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
def combine(params, bound = {}, &block)
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   140
  if bound.size == params.size then
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   141
    yield bound
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   142
  else
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   143
    params_to_combine = params.keys.sort.select { | p | not bound.key? p }
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   144
    param = params_to_combine.to_a().first()
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   145
    values = params[param]
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   146
    values.each do | value |
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   147
      combined = bound.clone()
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   148
      combined[param] = value
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   149
      combine(params, combined, &block)
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   150
    end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   151
  end
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   152
end
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
def write_results_txt_to_file(filename, results)
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   156
  File.open(filename, "a+") do |file|
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   157
    write_results_txt(file, results)
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   158
  end
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
end
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   160
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   161
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
def write_results_txt(file, results)
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   163
    file.write("\n")
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   164
    file.write(Time.now.to_s)
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   165
    file.write("\n")
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   166
    params = PARAMS.keys.sort
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   167
    values = [[ "Package"] + params + ['result', 'run', 'passed', 'skipped' , 'failed' , 'error']]
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
    results.each do | result |
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   169
      param_values = params.collect { | p | result['params'][p] }
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   170
      result_text = '?'
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   171
      if result['run'] != '0' then
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   172
        if result['error'] != '0' then
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   173
          result_text = 'ERROR'
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   174
        elsif result['failed'] != '0' then
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   175
          result_text = 'FAILED'
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   176
        else
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   177
          result_text = 'passed'
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   178
        end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   179
      end
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   180
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   181
      row = [ result['package'] ] + param_values + [ result_text, result['run'], result['passed'], result['skipped'], result['failed'], result['error'] ]
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   182
      values.push(row)
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   183
    end
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   184
    max_lengths = values[0].map { |val| val.length }
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   185
    values.each do |row|
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   186
      row.each_with_index do |elem, index|
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   187
        elem_size = elem.size
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   188
        max_lengths[index] = elem_size if elem_size > max_lengths[index]
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   189
      end
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   190
    end
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   191
    values.each do |val|
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   192
      format = max_lengths.map { |length| "%#{length}s" }.join(" " * 3)
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   193
      file.write(format % val)
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   194
      file.write("\n")
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   195
    end
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   196
    file.write("--\n")
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   197
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   198
end
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   199
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   200
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   201
def main()
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   202
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   203
  FileUtils.mkdir_p REPORT_DIR
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   204
  results = []
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   205
  packages = []
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   206
  params = {}
3507
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   207
  runs = 1
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   208
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   209
  optparse = OptionParser.new do | opts |
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   210
    opts.banner = "Usage: run-tests.rb [-D NAME=VALUE [-D...]] [-p PACKAGE [-p ...]]"
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   211
    opts.on('-D', '--define NAME=VALUES', "Define a parameter NAME with VALUES") do | define |
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   212
      name , value = define.split("=")
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   213
      params[name] = value.split(",").collect { | e | e.strip }
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   214
    end
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   215
3507
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   216
    opts.on('-N', '--runs NUMBER', "Run tests NUMBER times") do | number |
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   217
      runs = number.to_i
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   218
    end	
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   219
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   220
    opts.on('-p', '--package PACKAGE', "Run tests for PACKAGE") do | package |
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   221
      packages << package
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   222
    end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   223
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   224
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   225
    opts.on(nil, '--help', "Prints this message") do
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   226
      puts DOCUMENTATION
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   227
      puts optparse.help()
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   228
      exit 0
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   229
    end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   230
  end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   231
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   232
  optparse.parse!
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   233
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   234
  # Validate parameters
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   235
  params.each do | name, values |
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   236
    if not PARAM_NAMES.include? name then
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   237
      puts "ERROR: Invalid parameter name: #{name}"
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   238
      puts DOCUMENTATION
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   239
      puts optparse.help()
3507
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   240
      exit 1
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   241
    end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   242
  end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   243
3507
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   244
  if (runs < 1)
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   245
    puts "ERROR: Invalid number of runs"
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   246
    exit 2
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   247
  end
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   248
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   249
  PARAMS.each do | name, values |
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   250
    if not params.has_key? name then
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   251
      params[name] = values
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   252
    end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   253
  end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   254
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   255
  if packages.size == 0 then
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   256
    packages = PACKAGES
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   257
  end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   258
3507
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   259
  runs.times do 
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   260
    combine(params) do | bound |
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   261
      packages.each do | package |
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   262
        results.push(run_package(package, bound))
041e88b3db01 Added -N option to tests/run-tests.rb to run all tests several times
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3396
diff changeset
   263
      end
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   264
    end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   265
  end
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   266
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   267
  write_results_txt_to_file(File.join(REPORT_DIR, 'results.txt'), results)
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   268
  write_results_txt(STDOUT, results)
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   269
end
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   270
3396
f309d512205c testing: improved run-all.rb script to run tests with different configurations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   271
main()
3000
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   272
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   273