tests/run-all.rb
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 11 Feb 2014 16:29:28 +0000
branchdevelopment
changeset 3020 e7c286435bfe
parent 3000 08d798b4ef80
child 3299 61e9df43f8a4
permissions -rwxr-xr-x
Fixed tests'run-all.rb to run under Windows as well.
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
3020
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
     2
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
     3
require 'fileutils'
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
PACKAGES = [ 'stx:libjava', 'stx:libjava/mauve', 'stx:libjava/experiments', 'stx:libjava/tools' ]
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
PARAMS = {
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	'STX_LIBJAVA_ENABLE_JIT' => [
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
		#'1',
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
		'0'
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
	],
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
	'STX_LIBJAVA_RELEASE' => [
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
		'JDK6',
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
		'JDK7'
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
	]
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
}
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
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
    18
3020
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    19
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    20
def win32?      
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    21
  return (Config::CONFIG['host_os'] =~ /mingw32/) != nil
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    22
end
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    23
 
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    24
def unix?     
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    25
  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
    26
    return false
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    27
  end      
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    28
  return (Config::CONFIG['host_os'] =~ /linux|solaris/) != nil
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    29
end
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    30
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    31
if win32?
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    32
	REPORT_RUNNER = File.join(File.dirname(__FILE__), '..', '..', 'goodies', 'builder', 'reports' , 'report-runner.bat')
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    33
else
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    34
	REPORT_RUNNER = File.join(File.dirname(__FILE__), '..', '..', 'goodies', 'builder', 'reports' , 'report-runner.sh')	
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    35
end
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    36
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    37
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    38
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
    39
def run_package(package, params = {})
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
	ident = []
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
	setup = 'Stdin close'
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
	params.keys.sort.each do | name |
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
		value = params[name]
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
		ident.push("#{name}=#{value}")
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
		ENV[name] = value
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
	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
    47
	if ident.size > 0 then
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
		logf = File.join(REPORT_DIR, "#{package.tr(':/', '__')}-#{ident.join('-')}-Test.out")
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
		ident = "#{ident.join('-')}"
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
		cmd = %W[#{REPORT_RUNNER} -S #{setup} -D #{REPORT_DIR} -i #{ident} -r Builder::TestReport -p #{package}]
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
		#cmd = %W[#{REPORT_RUNNER} -S #{setup} -D #{REPORT_DIR} -i #{ident} -r Builder::TestReport ]
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
	else
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
		logf = File.join(REPORT_DIR, "#{package.tr(':/', '__')}-Test.out")
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
		ident = ''
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
		cmd = %W[#{REPORT_RUNNER} -S #{setup}  -D #{REPORT_DIR} -r Builder::TestReport -p #{package}]
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
	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
    57
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
	puts "Running #{package} {#{ident}}"
3020
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    59
	puts cmd.inspect
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
    60
	pattern = /SUMMARY: (?<run>\d+) run, (?<passed>\d+) passed, (?<skipped>\d+) skipped, (?<failed>\d+) failed, (?<error>\d+) 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
    61
	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
    62
						'run' => '?',
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
						'passed' => '?',
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
						'skipped' => '?',
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
						'failed' => '?',
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
						'error' => '?'
3020
e7c286435bfe Fixed tests'run-all.rb to run under Windows as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3000
diff changeset
    67
					}	
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
    68
	IO.popen(cmd + [ :err => [:child, :out]]) do | out |
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
		File.open(logf, "w") do | log |
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
			out.each do | line |
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
				log.puts line
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
				puts line
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
				match = pattern.match (line)
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
				if match then
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
					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
    76
						'run' => match['run'],
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
						'passed' => match['passed'],
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
						'skipped' => match['skipped'],
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
						'failed' => match['failed'],
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
						'error' => match['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
    81
					}
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
				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
    83
			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
    84
		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
    85
	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
    86
	result['ident'] = ident
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
	result['package'] = package
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
	result['params'] = params
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
	return 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
    90
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
    91
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
def combine(params, bound = {}, &block)
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
	if bound.size == params.size then
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
		yield bound
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
	else
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
		params_to_combine = params.keys.sort.select { | p | not bound.key? 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
    97
		param = params_to_combine.to_a().first()
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
		values = params[param]
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
		values.each do | value |
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
			combined = bound.clone()
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
			combined[param] = value
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
			combine(params, combined, &block)
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
		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
   104
	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
   105
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
   106
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
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
   109
  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
   110
    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
   111
  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
   112
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
   113
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
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
   116
    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
   117
    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
   118
    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
   119
    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
   120
    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
   121
    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
   122
      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
   123
      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
   124
      if result['run'] != '0' then
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
	      if result['error'] != '0' then
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
	      	result_text = '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
   127
	      elsif result['failed'] != '0' then
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
	      	result_text = 'FAILED'
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
				else
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   130
					result_text = 'passed'
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   131
				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
   132
			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
   133
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
      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
   135
      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
   136
    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
   137
    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
   138
    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
   139
      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
   140
        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
   141
        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
   142
      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
   143
    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
   144
    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
   145
      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
   146
      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
   147
      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
   148
    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
   149
    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
   150
08d798b4ef80 Added run-all.rb scrip to run all tests on several different configurations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   151
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
   152
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
FileUtils.mkdir_p REPORT_DIR
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
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
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
   157
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
combine(PARAMS) do | bound |
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
	PACKAGES.each do | package |
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
		results.push(run_package(package, bound))
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
	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
   162
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
   163
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
write_results_txt_to_file(File.join(REPORT_DIR, 'results.txt'), 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
   165
write_results_txt(STDOUT, 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
   166
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