-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest
More file actions
executable file
·67 lines (61 loc) · 2.02 KB
/
Copy pathTest
File metadata and controls
executable file
·67 lines (61 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env ruby
# Copyright 2006-2009 by Starling Software, K.K.
# This is part of QAM from http://www.starling-software.com.
# For license terms, see the LICENSE.QAM file included with this distribution.
def install(install_args)
puts "===== Installing"
install = ['ruby', File.expand_path(__FILE__ + '/../Install'), '-q']
unless system(*(install + install_args + ARGV))
$stderr.puts "***** INSTALL FAILED"
exit 1
end
end
def run_unit_tests(regexes)
return if regexes.empty?
Dir[D.mine('/src/*/Test')].sort.each { |test|
puts "----- #{File.basename(File.dirname(test))}" unless $quiet
shebang = File.open(test) { |s| s.gets }
prefix = shebang[/ruby/] ? 'ruby ' : ''
I.run_or_fail(prefix + test + ' ' +
(regexes == ['.'] ? '-q' :
regexes.collect { |s| "'#{s}'" }.join(' ')))
}
end
def run_system_tests(regexes)
return if regexes.empty?
puts '----- System Tests' unless $quiet
I.run_or_fail(D.mine('/src/qam/Test-system') + ' ' +
(regexes == ['.'] ? '-q' :
regexes.collect { |s| "'#{s}'" }.join(' ')))
end
def usage(message)
puts(message)
puts <<__EOD__
usage: #{File.basename($0)} [options]
-s regex run only system tests matching regex
-i interactive
-q fewer notification messages
-u regex run only unit tests matching regex
__EOD__
exit(2)
end
unittests = ['.']
system_tests = ['.']
install_args = []
while ARGV[0]; case ARGV[0]
when '-C': install_args << ARGV.shift
when '-c': install_args << ARGV.shift
when '-i': ARGV.shift; ENV['INTERACTIVE'] = "1"
when '-q': ARGV.shift; $quiet = true
when '-s': ARGV.shift; system_tests << ARGV.shift
when '-u': ARGV.shift; unittests << ARGV.shift
else usage("Unknown option: #{ARGV[0]}")
end; end
(unittests.length > 1 || system_tests.length > 1) &&
(system_tests.shift; unittests.shift)
install(install_args)
require File.expand_path(__FILE__ + '/../release/qam')
require 'qam/install'
I = QAM::Install.new; D = I.dirs
run_unit_tests(unittests)
run_system_tests(system_tests)