forked from ruby-gnome/ruby-gnome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-test.rb
executable file
·68 lines (56 loc) · 1.61 KB
/
run-test.rb
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
68
#!/usr/bin/env ruby
# quick & dirty script for running all available tests for each module
# Author: Joachim Glauche
require "rbconfig"
require "pathname"
require "time"
ruby = File.join(RbConfig::CONFIG['bindir'],
RbConfig::CONFIG['RUBY_INSTALL_NAME'] + RbConfig::CONFIG['EXEEXT'])
# for creating a separating line
def separator
"-" * 80
end
targets = []
includes = []
base_dir = Pathname(File.dirname(__FILE__))
Pathname.glob((base_dir + "*").to_s) do |dir|
next unless dir.directory?
dir = dir.expand_path
ext_dir = dir + "ext" + dir.basename
includes.concat(["-I", (dir + "lib").to_s, "-I", ext_dir.to_s])
next unless (dir + "test").directory?
targets << dir
end
ignored_modules = [
"gdk4",
"gtk4",
]
failed_target_names = []
targets.each do |target|
next if target.basename.to_s.end_with?("-no-gi")
next if ignored_modules.include?(target.basename.to_s)
Dir.chdir(target.to_s) do
puts "#{Time.now.iso8601}: Running test for #{target}"
puts separator
dependency_check = "dependency-check/Rakefile"
if File.exist?(dependency_check)
unless system(ruby, *includes, "-S",
"rake", "--rakefile", dependency_check)
puts "Failed to resolve dependency: #{target.basename}"
puts separator
next
end
end
unless system(ruby, *includes, "test/run-test.rb")
puts "Failed to run test: #{target.basename}"
failed_target_names << target.basename.to_s
end
puts separator
end
end
if failed_target_names.empty?
exit(true)
else
puts "Failed targets: #{failed_target_names.join(', ')}"
exit(false)
end