├── .gitignore
├── sample
├── abi-check-ruby-1.9.3-skip-symbols.txt
├── test-error
├── test-date
├── test-sleep
├── test-leave-proc
├── test-make
├── test-nul
├── test-env
├── test-remain-process
├── test-timeout
├── test-echo
├── test-limit
├── test-cc
├── test-diffsec
├── test-timeout2
├── test-git
├── test-co-git
├── test-co-ruby
├── test-upload
├── test-warn
├── test-neterr
├── test-procmemsize
├── test-depver
├── test-opts
├── test-fmesg
├── test-gcc-v
├── test-random-neterror
├── test-dep
├── test-stdio
├── test-core
├── test-randomerror
├── test-core2
├── test-fail
├── test-diamond-dep
├── test-apr
├── test-timeout3
├── test-combfail
├── test-catcherr
├── build-ruby2
├── build-coverage-ruby
├── build-svn
├── build-mruby
├── build-libffi-ruby
├── build-zlib-openssl-ruby
├── build-gperf-ruby
├── build-openssl-ruby
├── build-gdbm-ruby
├── build-gcc-ruby
├── build-ruby-parallel
├── build-bison-ruby
├── build-ruby
├── build-ruby3
└── build-autoconf-ruby
├── misc
├── _htaccess
└── nginx.conf
├── test
├── test-timeoutcom.rb
├── test-util.rb
├── test-logfile.rb
└── test-escape.rb
├── start-oneshot-rubyci
├── last-build
├── chkbuild
├── config.rb
├── zlib.rb
├── options.rb
├── azure-patch.rb
├── lock.rb
├── viewvc.rb
├── target.rb
├── title.rb
├── openssl.rb
├── cvs.rb
├── build.rb
├── gcc.rb
├── main.rb
├── svn.rb
└── upload.rb
├── erbio.rb
├── start-build
├── chkbuild.rb
├── abi-checker.rb
├── gdb.rb
├── tail-f
├── start-rubyci
├── udiff.rb
├── lchg.rb
├── timeoutcom.rb
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | tmp
2 |
--------------------------------------------------------------------------------
/sample/abi-check-ruby-1.9.3-skip-symbols.txt:
--------------------------------------------------------------------------------
1 | rb_class_init_copy
2 |
--------------------------------------------------------------------------------
/sample/test-error:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("error") {|b|
6 | x
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/sample/test-date:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("date") {|b|
6 | b.run("date")
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/misc/_htaccess:
--------------------------------------------------------------------------------
1 | # .htaccess for Apache
2 | RemoveType .gz
3 | AddEncoding gzip .gz
4 | AddType text/plain ltsv
5 |
6 | ForceType application/rss+xml
7 |
8 |
--------------------------------------------------------------------------------
/sample/test-sleep:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("sleep") {|b|
6 | b.run("sleep", "60")
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/sample/test-leave-proc:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("leave-proc") {|b|
6 | b.run("sleep 1000 &")
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/sample/test-make:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("make-failure") {|b|
6 | b.make("nonexisting-target")
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/sample/test-nul:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("nul") {|b|
6 | b.run("ruby", "-e", "puts \"{\\0}\", Time.now")
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/sample/test-env:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("env") {|b|
6 | b.run("sh", "-c", "echo $AAA", "ENV:AAA"=>"foooo")
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/sample/test-remain-process:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("remainprocess") {|b|
6 | b.run("sh", "-c", "sleep 10 &")
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/sample/test-timeout:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("timeout", :timeout=>Time.now+4) {|b|
6 | b.run("sleep", "60")
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/sample/test-echo:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("echo") {|b|
6 | b.run("echo", "f&<>oo http://foo.example.net/bar?a=b&c=d baz")
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/sample/test-limit:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("limit") {|b|
6 | b.run("sh", "-c", "ulimit -a", :rlimit_data => 800*1024)
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/sample/test-cc:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("cc") {|b|
6 | b.cc_version("gcc")
7 | b.cc_version("xlc")
8 | b.cc_version("cc")
9 | }
10 |
11 | ChkBuild.main
12 |
--------------------------------------------------------------------------------
/sample/test-diffsec:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("diffsec") {|b|
6 | b.logfile.start_section 'same-lines'
7 | (1+rand(10)).times {
8 | puts "foo"
9 | }
10 | }
11 |
12 | ChkBuild.main
13 |
--------------------------------------------------------------------------------
/sample/test-timeout2:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("timeout2", :timeout=>'3s') {|b|
6 | b.catch_error { b.run("sleep", "60") }
7 | b.catch_error { b.run("sleep", "60") }
8 | }
9 |
10 | ChkBuild.main
11 |
--------------------------------------------------------------------------------
/sample/test-git:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target('git') {|b|
6 | opts = {:shared_gitdir=>ChkBuild.build_top}
7 | b.git('git://github.com/rubyspec/rubyspec.git', 'tst-rubyspec2', opts)
8 | }
9 |
10 | ChkBuild.main
11 |
--------------------------------------------------------------------------------
/sample/test-co-git:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | #ChkBuild.limit(:data=>1024*1024*2000, :as=>1024*1024*2000)
6 |
7 | ChkBuild.def_target("gitcheckout") {|b|
8 | b.git('git://github.com/akr/depq.git', 'depq-work', {})
9 | }
10 |
11 | ChkBuild.main
12 |
--------------------------------------------------------------------------------
/sample/test-co-ruby:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | #ChkBuild.limit(:data=>1024*1024*2000, :as=>1024*1024*2000)
6 |
7 | ChkBuild.def_target("svnruby") {|b|
8 | b.svn("http://svn.ruby-lang.org/repos/ruby", 'trunk', 'ruby')
9 | }
10 |
11 | ChkBuild.main
12 |
--------------------------------------------------------------------------------
/sample/test-upload:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.add_upload_hook {|name|
6 | p "#{ChkBuild.public_top}/#{name}"
7 | }
8 |
9 | ChkBuild.def_target("uptest", ["dev", "stable"]) {|b|
10 | b.run("echo", "uptest")
11 | }
12 |
13 | ChkBuild.main
14 |
--------------------------------------------------------------------------------
/sample/test-warn:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("warn") {|b|
6 | b.run("echo", "warn")
7 | }
8 |
9 | ChkBuild.define_title_hook('warn', 'echo') {|title, log|
10 | title.update_title(:version, "foo")
11 | }
12 |
13 | ChkBuild.main
14 |
--------------------------------------------------------------------------------
/sample/test-neterr:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("networkerror") {|b|
6 | b.network_access {
7 | if rand < 0.5
8 | b.run("false")
9 | else
10 | b.run("true")
11 | end
12 | }
13 | b.run("true")
14 | }
15 |
16 | ChkBuild.main
17 |
--------------------------------------------------------------------------------
/sample/test-procmemsize:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | # * needs procmemsize command. http://github.com/akr/procmemsize/
6 | # * it is GNU/Linux dependent.
7 |
8 | ChkBuild.def_target("procmemsize", :procmemsize=>true) {|b|
9 | b.run("sleep", "3")
10 | }
11 |
12 | ChkBuild.main
13 |
--------------------------------------------------------------------------------
/sample/test-depver:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | Dep1 = ChkBuild.def_target("lib1", ["dev", "stable"]) {|b|
6 | }
7 |
8 | Dep2 = ChkBuild.def_target("lib2", ["dev", "stable"]) {|b|
9 | }
10 |
11 | ChkBuild.def_target("app", ["dev", "stable"], Dep1, Dep2) {|b|
12 | }
13 |
14 | ChkBuild.main
15 |
--------------------------------------------------------------------------------
/sample/test-opts:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("opts",
6 | [
7 | {:suffix_? => "a", :foo=>"a", :bar=>"x"},
8 | {:suffix_? => "b", :foo=>"b", :bar=>"y"}
9 | ],
10 | :bar=>"z",
11 | :baz=>"A") {|b|
12 | pp b.suffixes
13 | pp b.opts
14 | }
15 |
16 | ChkBuild.main
17 |
--------------------------------------------------------------------------------
/sample/test-fmesg:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("fmesg") {|b|
6 | b.run("echo", "this fails")
7 | if /this fails/ =~ b.logfile.get_section('echo')
8 | raise ChkBuild::Build::CommandError.new(0, "echo")
9 | end
10 | }
11 |
12 | ChkBuild.define_failure_hook('fmesg', 'echo') {|log|
13 | 'FAIL'
14 | }
15 |
16 | ChkBuild.main
17 |
--------------------------------------------------------------------------------
/sample/test-gcc-v:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("gccversion") {|b|
6 | b.run("gcc", '-v', :section=>'version')
7 | }
8 |
9 | ChkBuild.define_title_hook('gccversion', 'version') {|title, log|
10 | if /^gcc version (.*)$/ =~ log
11 | title.update_title(:gcc_version, "(gcc #{$1.strip})")
12 | end
13 | }
14 |
15 | ChkBuild.main
16 |
--------------------------------------------------------------------------------
/sample/test-random-neterror:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | #ChkBuild.limit(:data=>1024*1024*2000, :as=>1024*1024*2000)
6 |
7 | ChkBuild.def_target("randomneterror") {|b|
8 | b.network_access {
9 | if rand < 0.5
10 | b.run("false")
11 | else
12 | b.run("true")
13 | end
14 | }
15 | b.run("date")
16 | }
17 |
18 | ChkBuild.main
19 |
--------------------------------------------------------------------------------
/sample/test-dep:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | Dep1 = ChkBuild.def_target("dep1",
6 | ["dev", "stable"]) {|b|
7 | b.catch_error { raise "foo error" }
8 | Dir.mkdir('bin')
9 | }
10 |
11 | ChkBuild.def_target("dep2",
12 | ["dev", "stable"],
13 | Dep1) {|b|
14 | p b.suffixes
15 | p b.depbuilds
16 | p b.suffixed_name
17 | b.run('env')
18 | }
19 |
20 | ChkBuild.main
21 |
--------------------------------------------------------------------------------
/sample/test-stdio:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("stdio") {|b|
6 | b.run("ruby", "-e", 'system("ls -l /proc/#$$/fd")')
7 | b.run("ruby", "-e", 'system("ls -l /proc/$$/fd")')
8 | b.run("ruby", "-rpp", "-e", "pp STDIN.stat")
9 | b.run("ruby", "-rpp", "-e", "pp STDOUT.stat")
10 | b.run("ruby", "-rpp", "-e", "pp STDERR.stat")
11 | }
12 |
13 | ChkBuild.main
14 |
--------------------------------------------------------------------------------
/sample/test-core:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | #ChkBuild.limit(:core => 0) # bytes
6 |
7 | ChkBuild.def_target("coretest") {|b|
8 | FileUtils.cp(`which ruby`.chomp, "ruby")
9 | b.run("ruby", "-e", <<'End')
10 | Process.setrlimit(Process::RLIMIT_CORE, Process::RLIM_INFINITY, Process::RLIM_INFINITY)
11 | trap("QUIT", "SYSTEM_DEFAULT")
12 | Process.kill("QUIT", $$)
13 | End
14 | }
15 |
16 | ChkBuild.main
17 |
--------------------------------------------------------------------------------
/sample/test-randomerror:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | #ChkBuild.limit(:data=>1024*1024*2000, :as=>1024*1024*2000)
6 |
7 | ChkBuild.def_target("randomerror") {|b|
8 | b.network_access {
9 | if rand < 0.5
10 | b.run("false")
11 | else
12 | b.run("true")
13 | end
14 | }
15 | if rand < 0.5
16 | b.run("false")
17 | else
18 | b.run("true")
19 | end
20 | }
21 |
22 | ChkBuild.main
23 |
--------------------------------------------------------------------------------
/sample/test-core2:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | def coredump(b)
6 | b.run("./ruby", "-e", <<'End')
7 | Process.setrlimit(Process::RLIMIT_CORE, Process::RLIM_INFINITY, Process::RLIM_INFINITY)
8 | trap("SEGV", "DEFAULT")
9 | Process.kill("SEGV", $$)
10 | End
11 | end
12 |
13 | ChkBuild.def_target("core2test") {|b|
14 | FileUtils.cp(`which ruby`.chomp, "ruby")
15 | b.catch_error { coredump(b) }
16 | b.catch_error { coredump(b) }
17 | }
18 |
19 | ChkBuild.main
20 |
--------------------------------------------------------------------------------
/sample/test-fail:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("fail") {|b|
6 | b.run("echo", "[bug]")
7 | b.run("false")
8 | }
9 |
10 | ChkBuild.define_title_hook('fail', nil) {|title, logfile|
11 | log = logfile.get_all_log
12 | mark = ''
13 | mark << "[BUG]" if /\[BUG\]/i =~ log
14 | mark << "[SEGV]" if /Segmentation fault/i =~ log
15 | mark << "[FATAL]" if /\[FATAL\]/i =~ log
16 | title.update_title(:mark, mark)
17 | }
18 |
19 | ChkBuild.main
20 |
--------------------------------------------------------------------------------
/sample/test-diamond-dep:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | Top = ChkBuild.def_target("diamondtop",
6 | ["dev", "stable"]) {|b|
7 | }
8 |
9 | Left = ChkBuild.def_target("diamondleft",
10 | ["dev", "stable"],
11 | Top) {|b|
12 | }
13 |
14 | Right = ChkBuild.def_target("diamondright",
15 | ["dev", "stable"],
16 | Top) {|b|
17 | }
18 |
19 | ChkBuild.def_target("diamondbottom",
20 | ["dev", "stable"],
21 | Left,
22 | Right) {|b|
23 | }
24 |
25 | ChkBuild.main
26 |
--------------------------------------------------------------------------------
/sample/test-apr:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | # resource limits
6 | #word_bytes = [nil].pack("p").length
7 | #ChkBuild.limit(:cpu => 3600*4) # seconds
8 | #ChkBuild.limit(:stack => 1024*1024*10*word_bytes) # bytes
9 | #ChkBuild.limit(:data => 1024*1024*500*word_bytes) # bytes
10 | #ChkBuild.limit(:as => 1024*1024*500*word_bytes) # bytes
11 |
12 | ChkBuild.def_target("apr") {|b|
13 | b.svn("http://svn.apache.org/repos/asf", "apr/apr/trunk", 'apr')
14 | }
15 |
16 | ChkBuild.main
17 |
--------------------------------------------------------------------------------
/sample/test-timeout3:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("timeout3", :timeout=>'10s', :output_interval_timeout=>'3s') {|b|
6 | b.run("sh", "-c", 'sleep 60; echo 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789')
7 | }
8 |
9 | ChkBuild.main
10 |
--------------------------------------------------------------------------------
/sample/test-combfail:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | COMBFAIL1 = ChkBuild.def_target("combfail1",
6 | ["succ", "fail"]) {|b|
7 | suffix = b.suffixes.first
8 | case suffix
9 | when "succ" then command = "true"
10 | when "fail" then command = "false"
11 | end
12 | b.run(command)
13 | }
14 |
15 | ChkBuild.def_target("combfail2", COMBFAIL1) {|b|
16 | combfail1_dir = b.depbuilds.first.dir
17 | combfail2_dir = b.build_dir
18 | b.run(*%W(echo #{combfail1_dir} #{combfail2_dir}))
19 | }
20 |
21 | ChkBuild.main
22 |
--------------------------------------------------------------------------------
/test/test-timeoutcom.rb:
--------------------------------------------------------------------------------
1 | require 'timeoutcom'
2 | require 'test/unit'
3 |
4 | class TestTimeoutCommand < Test::Unit::TestCase
5 | def test_time
6 | assert_raise(CommandTimeout) {
7 | open("/dev/null", 'w') {|null|
8 | TimeoutCommand.timeout_command(<<-'End', Time.now+1, null)
9 | begin
10 | sleep 2
11 | rescue Interrupt
12 | end
13 | End
14 | }
15 | }
16 | end
17 |
18 | def test_past_time
19 | assert_raise(CommandTimeout) {
20 | TimeoutCommand.timeout_command('', Time.now-1, nil)
21 | }
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/sample/test-catcherr:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'chkbuild'
4 |
5 | ChkBuild.def_target("catcherr-fails",
6 | %w[true false],
7 | %w[true false]) {|b|
8 | commands = b.suffixes
9 | b.catch_error { b.run(commands[0]) }
10 | b.catch_error { b.run(commands[1]) }
11 | }
12 |
13 | ChkBuild.def_target("catcherr-branch",
14 | %w[true false],
15 | %w[true false],
16 | %w[true false],
17 | %w[true false]) {|b|
18 | commands = b.suffixes
19 | r1 = b.catch_error { b.run(commands[0]) }
20 | r1 && b.catch_error { b.run(commands[1]) }
21 | r1 && b.catch_error { b.run(commands[2]) }
22 | r1 && b.catch_error { b.run(commands[3]) }
23 | }
24 |
25 | ChkBuild.main
26 |
--------------------------------------------------------------------------------
/misc/nginx.conf:
--------------------------------------------------------------------------------
1 | location ~ ^/~(chkbuild)(/.*/rss)$ {
2 | alias /home/$1/public_html$2;
3 | default_type application/rss+xml;
4 | }
5 | location ~ ^/~(chkbuild)(/.*.html.gz)$ {
6 | alias /home/$1/public_html$2;
7 | default_type text/html;
8 | add_header Content-Encoding gzip;
9 | }
10 | location ~ ^/~(chkbuild)(/.*.txt.gz)$ {
11 | alias /home/$1/public_html$2;
12 | default_type text/plain;
13 | add_header Content-Encoding gzip;
14 | }
15 | location ~ ^/~(.+?)(/.*)?$ {
16 | alias /home/$1/public_html$2;
17 | autoindex on;
18 | include mime.types;
19 | types { text/plain ltsv; }
20 | }
21 |
--------------------------------------------------------------------------------
/start-oneshot-rubyci:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # start-oneshot-rubyci - Start RubyCI for a specific commit
4 | #
5 | # Usage:
6 | # start-oneshot-rubyci [-D] [chkbuild-args...]
7 | #
8 | # Options:
9 | # -D: Start chkbuild in foreground
10 | #
11 | # Example:
12 | # start-oneshot-rubyci 6b3e6b1 build ruby-master-oneshot
13 |
14 | $:.unshift File.dirname(File.expand_path(__FILE__))
15 |
16 | require "rbconfig"
17 | require "chkbuild"
18 |
19 | rev = ARGV.shift
20 | if rev.nil?
21 | abort "Usage: #$0 "
22 | end
23 | daemon = !ARGV.delete("-D")
24 |
25 | cmd = [RbConfig.ruby, "#{__dir__}/start-rubyci", *ARGV]
26 | if ARGV.empty?
27 | # Build the given commit with master branch build configuration
28 | cmd.push "build", "ruby-master-oneshot"
29 | end
30 |
31 | Dir.chdir(__dir__) do
32 | $stderr.puts "Starting RubyCI for #{rev} in #{daemon ? "foreground" : "background"}..."
33 | Process.daemon(true) if daemon
34 | # Spawn a new chkbuild process instead of in-process because
35 | # `ChkBuild.main_build` invokes `$0` to start a internal build process.
36 | system({ "RUBYCI_ONESHOT_BUILD_COMMIT" => rev }, *cmd, exception: true)
37 | end
38 |
--------------------------------------------------------------------------------
/test/test-util.rb:
--------------------------------------------------------------------------------
1 | require 'test/unit'
2 | require 'util'
3 |
4 | class TestUtil < Test::Unit::TestCase
5 | def test_opts2aryparam_configure_args
6 | opts = {
7 | :configure_args => [],
8 | :configure_args_valgrind => ["--with-valgrind"],
9 | }
10 | assert_equal(["--with-valgrind"], Util.opts2aryparam(opts, :configure_args))
11 | end
12 |
13 | def test_opts2aryparam_num
14 | opts = { :foo_1 => "a", :foo_9 => "b", :foo_10 => "c" }
15 | assert_equal(["a", "b", "c"], Util.opts2aryparam(opts, :foo))
16 | end
17 |
18 | def test_opts2aryparam_key
19 | opts = { :foo => [:a, :b], :foo_a => "A", :foo_b => "B", }
20 | assert_equal(["A", "B"], Util.opts2aryparam(opts, :foo))
21 | opts = { :foo => [:b, :a], :foo_a => "A", :foo_b => "B", }
22 | assert_equal(["B", "A"], Util.opts2aryparam(opts, :foo))
23 | opts = { :foo => [:b, :a], :foo_a => ["A"], :foo_b => "B", }
24 | assert_equal(["B", "A"], Util.opts2aryparam(opts, :foo))
25 | opts = { :foo => [:b, :a], :foo_a => "A", :foo_b => ["B", "BB"], }
26 | assert_equal(["B", "BB", "A"], Util.opts2aryparam(opts, :foo))
27 | opts = { :foo => [:a], :foo_a => "A", :foo_b => "B", :foo_9 => "Q", :foo_10 => "J" }
28 | assert_equal(["A", "Q", "J", "B"], Util.opts2aryparam(opts, :foo))
29 | opts = { :foo => [:a, :b_?, :c], :foo_a => "A", :foo_b_9 => "BQ", :foo_b_10 => "BJ", :foo_c => "C", :foo_A => "aa" }
30 | assert_equal(%w[A BQ BJ C aa], Util.opts2aryparam(opts, :foo))
31 | end
32 |
33 | end
34 |
--------------------------------------------------------------------------------
/last-build:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # last-build - show last builds
4 | #
5 | # Copyright (C) 2007,2009 Tanaka Akira
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions
9 | # are met:
10 | #
11 | # 1. Redistributions of source code must retain the above copyright
12 | # notice, this list of conditions and the following disclaimer.
13 | # 2. Redistributions in binary form must reproduce the above
14 | # copyright notice, this list of conditions and the following
15 | # disclaimer in the documentation and/or other materials provided
16 | # with the distribution.
17 | # 3. The name of the author may not be used to endorse or promote
18 | # products derived from this software without specific prior
19 | # written permission.
20 | #
21 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 | tail -n 3 `ls -1tr tmp/public_html/*/summary.txt tmp/build/.lock` < /dev/null
34 | echo
35 |
--------------------------------------------------------------------------------
/chkbuild/config.rb:
--------------------------------------------------------------------------------
1 | # chkbuild/config.rb - chkbuild config routines.
2 | #
3 | # Copyright (C) 2010 Tanaka Akira
4 | #
5 | # Redistribution and use in source and binary forms, with or without
6 | # modification, are permitted provided that the following conditions
7 | # are met:
8 | #
9 | # 1. Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # 2. Redistributions in binary form must reproduce the above
12 | # copyright notice, this list of conditions and the following
13 | # disclaimer in the documentation and/or other materials provided
14 | # with the distribution.
15 | # 3. The name of the author may not be used to endorse or promote
16 | # products derived from this software without specific prior
17 | # written permission.
18 | #
19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
20 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
29 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | module ChkBuild
32 | @top_uri = "file://#{ChkBuild.public_top}/"
33 | class << self
34 | attr_accessor :top_uri
35 | end
36 |
37 | @nickname = Util.simple_hostname
38 | class << self
39 | attr_accessor :nickname
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/erbio.rb:
--------------------------------------------------------------------------------
1 | # erbio.rb - erb output IO directly
2 | #
3 | # Copyright (C) 2010 Tanaka Akira
4 | #
5 | # Redistribution and use in source and binary forms, with or without
6 | # modification, are permitted provided that the following conditions
7 | # are met:
8 | #
9 | # 1. Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # 2. Redistributions in binary form must reproduce the above
12 | # copyright notice, this list of conditions and the following
13 | # disclaimer in the documentation and/or other materials provided
14 | # with the distribution.
15 | # 3. The name of the author may not be used to endorse or promote
16 | # products derived from this software without specific prior
17 | # written permission.
18 | #
19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
20 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
29 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | require 'erb'
32 |
33 | class ERBIO < ERB
34 | def set_eoutvar(compiler, eoutvar = '_erbout')
35 | compiler.put_cmd = "#{eoutvar}.write"
36 | compiler.insert_cmd = "#{eoutvar}.write"
37 |
38 | cmd = []
39 | cmd.push ""
40 |
41 | compiler.pre_cmd = cmd
42 |
43 | cmd = []
44 | cmd.push(eoutvar)
45 |
46 | compiler.post_cmd = cmd
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/start-build:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # start-build - build start script
4 | #
5 | # Copyright (C) 2005-2011 Tanaka Akira
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions
9 | # are met:
10 | #
11 | # 1. Redistributions of source code must retain the above copyright
12 | # notice, this list of conditions and the following disclaimer.
13 | # 2. Redistributions in binary form must reproduce the above
14 | # copyright notice, this list of conditions and the following
15 | # disclaimer in the documentation and/or other materials provided
16 | # with the distribution.
17 | # 3. The name of the author may not be used to endorse or promote
18 | # products derived from this software without specific prior
19 | # written permission.
20 | #
21 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 | #ENV['PATH'] = "/usr/local/bin:#{ENV['PATH']}"
34 |
35 | $:.unshift File.dirname(File.expand_path(__FILE__))
36 |
37 | require 'chkbuild'
38 |
39 | #ChkBuild.rsync_ssh_upload_target("remoteuser@http-server::upload/dir", "/home/chkbuild/.ssh/chkbuild-upload")
40 |
41 | load "sample/build-ruby"
42 |
43 | #load "sample/build-gcc-ruby"
44 |
45 | #load "sample/test-echo"
46 |
--------------------------------------------------------------------------------
/sample/build-ruby2:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # sample/build-ruby2 - build script for ruby in separated directory
4 | #
5 | # Copyright (C) 2005-2012 Tanaka Akira
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions
9 | # are met:
10 | #
11 | # 1. Redistributions of source code must retain the above copyright
12 | # notice, this list of conditions and the following disclaimer.
13 | # 2. Redistributions in binary form must reproduce the above
14 | # copyright notice, this list of conditions and the following
15 | # disclaimer in the documentation and/or other materials provided
16 | # with the distribution.
17 | # 3. The name of the author may not be used to endorse or promote
18 | # products derived from this software without specific prior
19 | # written permission.
20 | #
21 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 | require 'chkbuild'
34 |
35 | #ENV['LC_ALL'] = 'C'
36 |
37 | # resource limits
38 | #word_bytes = [nil].pack("p").length
39 | #ChkBuild.limit(:cpu => 3600*4) # seconds
40 | #ChkBuild.limit(:stack => 1024*1024*10*word_bytes) # bytes
41 | #ChkBuild.limit(:data => 1024*1024*500*word_bytes) # bytes
42 | #ChkBuild.limit(:as => 1024*1024*500*word_bytes) # bytes
43 |
44 | ChkBuild::Ruby.def_target(
45 | #ChkBuild::Ruby::MaintainedBranches,
46 | %w[trunk],
47 | [nil, "pth"],
48 | "-outofplace",
49 | :inplace_build => false)
50 |
51 | ChkBuild.main
52 |
--------------------------------------------------------------------------------
/sample/build-coverage-ruby:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # sample/build-ruby - build script for ruby
4 | #
5 | # Copyright (C) 2005-2013 Tanaka Akira
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions
9 | # are met:
10 | #
11 | # 1. Redistributions of source code must retain the above copyright
12 | # notice, this list of conditions and the following disclaimer.
13 | # 2. Redistributions in binary form must reproduce the above
14 | # copyright notice, this list of conditions and the following
15 | # disclaimer in the documentation and/or other materials provided
16 | # with the distribution.
17 | # 3. The name of the author may not be used to endorse or promote
18 | # products derived from this software without specific prior
19 | # written permission.
20 | #
21 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 | require 'chkbuild'
34 |
35 | #ENV['LC_ALL'] = 'C'
36 |
37 | # resource limits
38 | #word_bytes = [nil].pack("p").length
39 | #ChkBuild.limit(:cpu => 3600*4) # seconds
40 | #ChkBuild.limit(:stack => 1024*1024*10*word_bytes) # bytes
41 | #ChkBuild.limit(:data => 1024*1024*500*word_bytes) # bytes
42 | #ChkBuild.limit(:as => 1024*1024*500*word_bytes) # bytes
43 |
44 | ChkBuild::Ruby.def_target(
45 | [
46 | { :suffix_? => 'master', :output_interval_timeout => '10min' },
47 | ],
48 |
49 | [nil, "pth"],
50 |
51 | :coverage_measurement => true,
52 |
53 | :timeout => '2h',
54 |
55 | :output_interval_timeout => '5min'
56 | )
57 |
58 | ChkBuild.main
59 |
--------------------------------------------------------------------------------
/chkbuild/zlib.rb:
--------------------------------------------------------------------------------
1 | # chkbuild/zlib.rb - zlib build module
2 | #
3 | # Copyright (C) 2012 Tanaka Akira
4 | #
5 | # Redistribution and use in source and binary forms, with or without
6 | # modification, are permitted provided that the following conditions
7 | # are met:
8 | #
9 | # 1. Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # 2. Redistributions in binary form must reproduce the above
12 | # copyright notice, this list of conditions and the following
13 | # disclaimer in the documentation and/or other materials provided
14 | # with the distribution.
15 | # 3. The name of the author may not be used to endorse or promote
16 | # products derived from this software without specific prior
17 | # written permission.
18 | #
19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
20 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
29 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | module ChkBuild
32 | module Zlib
33 | module_function
34 | def def_target(*args)
35 | ChkBuild.def_target('zlib', *args)
36 | end
37 | end
38 | end
39 |
40 | ChkBuild.define_build_proc('zlib') {|b|
41 | opts2 = b.opts.dup
42 | opts2[:branch] = 'develop'
43 | b.git('git://github.com/madler/zlib.git', 'zlib', opts2)
44 | bdir = b.build_dir
45 | Dir.chdir('zlib') {
46 | b.run('./configure',
47 | "--prefix=#{bdir}")
48 | b.make
49 | b.make('test')
50 | b.make('install')
51 | b.catch_error {
52 | b.run("cat", "#{bdir}/lib/pkgconfig/zlib.pc", :section=>"pkgconfig")
53 | }
54 | }
55 | }
56 |
57 | ChkBuild.define_title_hook('zlib', 'pkgconfig') {|title, log|
58 | # Version: 1.2.7-motley
59 | case log
60 | when /^Version: (.*)$/
61 | ver = "zlib #{$1}"
62 | title.update_title(:version, ver)
63 | end
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/test/test-logfile.rb:
--------------------------------------------------------------------------------
1 | require 'test/unit'
2 | require 'tempfile'
3 | require 'chkbuild/logfile'
4 |
5 | class TestLogFile < Test::Unit::TestCase
6 | def with_logfile
7 | t = Tempfile.new("test-logfile")
8 | begin
9 | l = ChkBuild::LogFile.new(t.path, true)
10 | yield l
11 | ensure
12 | t.close(true)
13 | end
14 | end
15 |
16 | def test_start_section
17 | with_logfile {|l|
18 | l.start_section("a")
19 | assert_match(/^== a #/, l.get_all_log)
20 | }
21 | end
22 |
23 | def test_get_section
24 | with_logfile {|l|
25 | l.with_default_output {
26 | l.start_section("a")
27 | puts "aaa"
28 | l.start_section("b")
29 | puts "bbb"
30 | }
31 | assert_equal("aaa\n", l.get_section("a"))
32 | assert_equal("bbb\n", l.get_section("b"))
33 | }
34 | end
35 |
36 | def test_unique_section_name
37 | with_logfile {|l|
38 | secname1 = l.start_section("a")
39 | secname2 = l.start_section("a")
40 | secname3 = l.start_section("a")
41 | secname5 = l.start_section("a(5)")
42 | secname4 = l.start_section("a")
43 | secname6 = l.start_section("a")
44 | assert_equal("a", secname1)
45 | assert_equal("a(2)", secname2)
46 | assert_equal("a(3)", secname3)
47 | assert_equal("a(4)", secname4)
48 | assert_equal("a(5)", secname5)
49 | assert_equal("a(6)", secname6)
50 | assert_match(/^== #{Regexp.quote secname1} #/, l.get_all_log)
51 | assert_match(/^== #{Regexp.quote secname2} #/, l.get_all_log)
52 | assert_match(/^== #{Regexp.quote secname3} #/, l.get_all_log)
53 | }
54 | end
55 |
56 | def test_each_secname
57 | with_logfile {|l|
58 | secname1 = l.start_section("a")
59 | secname2 = l.start_section("b")
60 | secname3 = l.start_section("c")
61 | ss = []
62 | l.each_secname {|v|
63 | ss << v
64 | }
65 | assert_equal(%w[a b c], ss)
66 | }
67 | end
68 |
69 | def test_section_size
70 | with_logfile {|l|
71 | l.with_default_output {
72 | secname1 = l.start_section("a")
73 | puts "A"
74 | secname2 = l.start_section("b")
75 | puts "BB"
76 | secname3 = l.start_section("c")
77 | puts "CCC"
78 | }
79 | secseize_a = l.section_size("a")
80 | secseize_b = l.section_size("b")
81 | secseize_c = l.section_size("c")
82 | assert_equal(secseize_b, secseize_a+1)
83 | assert_equal(secseize_c, secseize_b+1)
84 | }
85 | end
86 | end
87 |
--------------------------------------------------------------------------------
/sample/build-svn:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # sample/build-svn - build script for svn
4 | #
5 | # Copyright (C) 2006-2012 Tanaka Akira
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions
9 | # are met:
10 | #
11 | # 1. Redistributions of source code must retain the above copyright
12 | # notice, this list of conditions and the following disclaimer.
13 | # 2. Redistributions in binary form must reproduce the above
14 | # copyright notice, this list of conditions and the following
15 | # disclaimer in the documentation and/or other materials provided
16 | # with the distribution.
17 | # 3. The name of the author may not be used to endorse or promote
18 | # products derived from this software without specific prior
19 | # written permission.
20 | #
21 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 | require 'chkbuild'
34 |
35 | #ENV['LC_ALL'] = 'C'
36 |
37 | #ChkBuild.limit(:data=>1024*1024*800, :as=>1024*1024*800)
38 |
39 | ChkBuild.def_target("svn") {|b|
40 | dir = b.build_dir
41 | b.svn('http://svn.apache.org/repos/asf', 'subversion/trunk', 'subversion')
42 | Dir.chdir("subversion") {
43 | b.run("./autogen.sh")
44 | b.run("./configure", "--prefix=#{dir}")
45 | b.make
46 | b.run("subversion/svn/svn", "--version", :section=>'version', "ENV:LC_ALL"=>"C")
47 | b.run("subversion/svn/svn", "help", :section=>'help')
48 | b.make("install")
49 | }
50 | }
51 |
52 | ChkBuild.define_title_hook('svn', 'help') {|title, log|
53 | if /^Subversion command-line client, version (.*)\.$/ =~ log
54 | title.update_title(:version, "Subversion #{$1}")
55 | end
56 | }
57 |
58 | ChkBuild.define_diff_preprocess_gsub('svn', /^ compiled .*, \d\d:\d\d:\d\d$/) {
59 | ' compiled