rubyfarm-bisect 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc79c5531a352ef5394ba8028b135ce65ee55bea26ad2777dde522bead7ebdce
4
- data.tar.gz: 3284b3ddc7d5dbb4e509e5d3d090d14baaefe52ab7d5b9eca3a3b07118ec4956
3
+ metadata.gz: 579c655b1499377ecf225a7f9c30eff0aece7a85954bf15510d2f6f4ba9e2f55
4
+ data.tar.gz: 0c73556465406ce122586ae14be3dea1dba9f3e4c29d569315238e69eafb8a78
5
5
  SHA512:
6
- metadata.gz: a91015f9b57e449b0148f32dcddaa0b80b3c6e65734f955953e7a9be78f1713bc04af1b108622613ed52491106a0a908cc7b7f2d0cbc0c90aa686ff43deabfb6
7
- data.tar.gz: f54e2fd3b027dd370729a73c76f253469553ee133e427d3438ac00afc11242941362618c1875fd4e22e3dbbe6886f0d4f69804dc76c59f21ff9e346c3f8a1552
6
+ metadata.gz: 2a6b28203ee2b3b4c49c2cea9734a90648b10831e57f37de7c92183fe23b91c50343d33c858abbf54d802db92b03e11be26f0bfe15ada945c4baff365ae499fe
7
+ data.tar.gz: 0cb2739a1bee909dc0101395852029093d2cb7d9ab274271d5aa2519aaa06eac28ecac46115611dad6d74195127233a32e37966cafec8480cec996cc90c6dc81
data/README.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # rubyfarm-bisect
2
2
 
3
3
  This tool allows you to do "git bisect" MRI revisions easily.
4
- Instead of compiling each revision locally, it uses ["mametter/rubyfarm" repository](https://hub.docker.com/r/mametter/rubyfarm/tags/) in DockerHub, which contains all MRI revisions since r57410 that were successfully built.
5
- In short, you don't need to worry about "exit 125" (compilation failure).
4
+ Instead of compiling each revision locally, it uses ["rubylang/rubyfarm" repository](https://hub.docker.com/r/rubylang/rubyfarm/tags/) in DockerHub, which contains all MRI revisions since r57410 that were successfully built.
5
+
6
+ By using rubyfarm-bisect, you don't have to worry about:
7
+
8
+ * Compilation failure ("exit 125"). rubyfarm-bisect handles it.
9
+ * The range of bisect. rubyfarm-bisect has a good default.
10
+ * The order of good and bad commits. rubyfarm-bisect automatically detects the order.
6
11
 
7
12
  ## How to setup
8
13
 
@@ -15,13 +20,13 @@ $ gem install rubyfarm-biesct
15
20
  You also need to be able to use "docker" command without "sudo".
16
21
 
17
22
  ```
18
- $ docker run --rm -t mametter/rubyfarm:r60001 ruby -v
19
- Unable to find image 'mametter/rubyfarm:r60001' locally
20
- r60001: Pulling from mametter/rubyfarm
23
+ $ docker run --rm -t rubylang/rubyfarm:r60001 ruby -v
24
+ Unable to find image 'rubylang/rubyfarm:r60001' locally
25
+ r60001: Pulling from rubylang/rubyfarm
21
26
 
22
27
  *snip*
23
28
 
24
- Status: Downloaded newer image for mametter/rubyfarm:r60001
29
+ Status: Downloaded newer image for rubylang/rubyfarm:r60001
25
30
  ruby 2.5.0dev (2017-09-23 trunk 60001) [x86_64-linux]
26
31
  ```
27
32
 
@@ -33,19 +38,24 @@ The simplest way:
33
38
  $ rubyfarm-bisect ruby -e '<your test code>'
34
39
  ```
35
40
 
36
- which assumes that `<your test code>` runs successfully at r57410, and fails at HEAD.
41
+ which assumes that `<your test code>` runs successfully at r57410, and fails at "trunk".
37
42
 
38
43
  ### `-g`/`-b`: specify a good/bad commit range
39
44
 
40
45
  You can specify good and bad commits for git bisect:
41
46
 
42
47
  ```
43
- $ rubyfarm-bisect -g 7c1b30a6 -b HEAD ruby -e '<your test code>'
48
+ $ rubyfarm-bisect -g 7c1b30a6 -b trunk ruby -e '<your test code>'
44
49
  ```
45
50
 
46
51
  `-g` is a good commit, and `-b` is a bad commit.
47
52
  The arguments must be a SVN revision (e.g., "r60000"), or a commit hash of [git.ruby-lang.org/ruby.git](https://git.ruby-lang.org/ruby.git) (e.g., 7c1b30a6).
48
53
 
54
+ You don't have to worry about which is good and bad:
55
+
56
+ * rubyfarm-bisect first checks if the good commit is an ancestor of the bad one. If not, it swaps the good and bad ones.
57
+ * rubyfarm-bisect then checks if the test passes at the good (older) commit. If it does not pass the test, it works as a "reversed" mode; it tries to find the first "good" commit.
58
+
49
59
  ### `-u`: specify a git url
50
60
 
51
61
  This tool clones [the git repository of ruby](https://git.ruby-lang.org/ruby.git) into temporary directory, which takes some minutes.
data/exe/rubyfarm-bisect CHANGED
@@ -9,19 +9,21 @@ ORIGINAL_GIT_PATH = "https://git.ruby-lang.org/ruby.git"
9
9
  CORE = File.join(__dir__, "rubyfarm-bisect-core")
10
10
 
11
11
  good_commit = FIRST_COMMIT
12
- bad_commit = "HEAD"
12
+ bad_commit = "trunk"
13
13
  git_url = ORIGINAL_GIT_PATH
14
14
  mounts = []
15
+ auto = true
15
16
 
16
17
  opt = OptionParser.new
17
18
  opt.on("-u URL", "--git-url URL", "URL of git repository (defalut: #{ ORIGINAL_GIT_PATH })") {|v| git_url = v }
18
19
  opt.on("-g COMMIT", "--good-commit COMMIT", "good commit (defalut: 7c1b30a)") {|v| good_commit = v }
19
- opt.on("-b COMMIT", "--bad-commit COMMIT", "bad commit (defalut: HEAD)") {|v| bad_commit = v }
20
+ opt.on("-b COMMIT", "--bad-commit COMMIT", "bad commit (defalut: trunk)") {|v| bad_commit = v }
20
21
  opt.on("-m PATH", "--mount-volume PATH", "mount PATH to /root (default: none)") {|v| mounts << v }
21
22
  opt.on("-t", "--test-rb", "run test.rb") do
22
23
  mounts = ["test.rb"]
23
24
  ARGV.concat(["ruby", "/root/test.rb"])
24
25
  end
26
+ opt.on("--no-auto", "disable automatic detection of the order (good->bad or bad->good)") { auto = false }
25
27
  opt.order!(ARGV)
26
28
 
27
29
  mounts = mounts.flat_map do |path|
@@ -54,8 +56,30 @@ Dir.mktmpdir do |dir|
54
56
  system("git", "clone", git_url)
55
57
  puts "\e[0m"
56
58
  Dir.chdir("ruby") do
59
+ good_commit = solve_rev[good_commit]
60
+ bad_commit = solve_rev[bad_commit]
61
+
62
+ if !system("git", "merge-base", "--is-ancestor", solve_rev[good_commit], solve_rev[bad_commit])
63
+ puts "\e[1m\e[32m#{ good_commit } is not an ancestor of #{ bad_commit }. Try to reverse.\e[0m"
64
+ good_commit, bad_commit = bad_commit, good_commit
65
+ if !system("git", "merge-base", "--is-ancestor", solve_rev[good_commit], solve_rev[bad_commit])
66
+ puts "\e[1m\e[32m#{ good_commit } is not an ancestor of #{ bad_commit }. Aborting.\e[0m"
67
+ exit 1
68
+ end
69
+ end
70
+
71
+ order = "normal"
72
+ if auto
73
+ system("git", "checkout", solve_rev[good_commit])
74
+ if !system(CORE, "--", *ARGV)
75
+ puts "\e[1m\e[32mThe beginning commit #{ good_commit } doesn't pass the test. Find the first good commit. \e[0m"
76
+ order = "reversed"
77
+ end
78
+ end
79
+
57
80
  system("git", "bisect", "start", solve_rev[bad_commit], solve_rev[good_commit])
58
- system("git", "bisect", "run", CORE, *mounts, "--", *ARGV)
81
+ env = { "RUBYFARM_BISECT_ORDER" => order }
82
+ system(env, "git", "bisect", "run", CORE, *mounts, "--", *ARGV)
59
83
  end
60
84
  end
61
85
  end
@@ -2,10 +2,10 @@
2
2
 
3
3
  require "shellwords"
4
4
 
5
- REPOSITORY = "mametter/rubyfarm"
5
+ REPOSITORY = "rubylang/rubyfarm"
6
6
 
7
7
  puts
8
- rev = "r" + `git show HEAD`[%r(git-svn-id: svn\+ssh://ci.ruby-lang.org/ruby/trunk@(\d+)), 1]
8
+ rev = `git rev-parse HEAD`.chomp
9
9
  log = -> msg do
10
10
  puts "\e[1m\e[32mrubyfarm-bisect[#{ rev }]: #{ msg }\e[0m"
11
11
  end
@@ -15,7 +15,7 @@ run = -> color, *cmd do
15
15
  system(*cmd)
16
16
  print "\e[0m"
17
17
  end
18
- tag = "mametter/rubyfarm:#{ rev }"
18
+ tag = REPOSITORY + ":#{ rev }"
19
19
 
20
20
  run["\e[34m", "docker", "image", "inspect", "-f", "ok", tag]
21
21
  unless $?.success?
@@ -36,4 +36,6 @@ status = $?.exitstatus
36
36
  msg = { 0 => "good", 125 => "skip" }[status] || "bad"
37
37
  log["status = #{ status } (#{ rev } is #{ msg })"]
38
38
  puts
39
+ exit 125 if status == 125
40
+ exit(status == 0 ? 1 : 0) if ENV["RUBYFARM_BISECT_ORDER"] == "reversed"
39
41
  exit status
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "rubyfarm-bisect"
3
- spec.version = "1.0.2"
3
+ spec.version = "1.1.0"
4
4
  spec.authors = ["Yusuke Endoh"]
5
5
  spec.email = ["mame@ruby-lang.org"]
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyfarm-bisect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Endoh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2019-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,8 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubyforge_project:
78
- rubygems_version: 2.7.3
77
+ rubygems_version: 3.0.1
79
78
  signing_key:
80
79
  specification_version: 4
81
80
  summary: '"git bisect" ruby without compilation trouble'