Rubyのtest-allを並列化するパッチを書きました

sora_h$B$G$9!#$*$O$h$&$4$6$$$^$9!#(B

($B$3$N%a!<%k$O(Bruby-core$B$K$b1QJ8$GF1$8$h$&$J;v$rBG$D$+$b$7$l$J$$$N$G!"F1$8$h$&$J%a!<%k$rJ#?t<u?.$7$?J}$O$4$a$s$J$5$$!#(B)

3$BF|$[$IA0$+$i(Bruby$B$N(Btest-all$B$rJBNs2=$9$k$?$a$N%Q%C%A$r=q$$$F$$$^$7$?!#(B

$B$d$C$H(Btest-all$B$r(Bworker$B$,Mn$A$:$KAv$jH4$1$k$3$H$,$G$-$k$h$&$K$J$C$?$?$a0lEY(BML$B$K(B
$B%a!<%k$r$*$/$k$3$H$H$7$^$7$?!#(B

$B<+J,0J30$N4D6-(B($B$?$H$($P(B, Windows$B$H$+(B, Windows$B$H$+(B,
Windows$B$H$+(B)$B$G$^[email protected]’$r(B
$B$7$F$$$J$$$?$a!"$=$NJU$G$bF0:n3NG’$d!";XE&$J$I$r$7$F$/$l$J$$$+$J$"$H;W$$$^$7$?!#(B

$BLdBj(B(?)$B$N%Q%C%A(B


https://github.com/sorah/ruby/compare/master...parallel_test

$B>e$O:#F|(B
$B:#;[email protected]$G$N%Q%C%A!“2<$,(Bgithub$B$KCV$$$F$”$k:G?7HG$H$J$j$^$9!#(B

$B;H$$J}(B

  1. $B%Q%C%A$rE,MQ$9$k$+!"(Bhttps://github.com/sorah/ruby.git
    parallel_test$B%V%i%s%A$r$R$C$Q$C$F$/$k(B
  2. $B%S%k%I$9$k(B
  3. $B$*$b$`$m$K(Bmake TESTS=’-j2 -v’ test-all$B$9$k(B
    (–jobs-status$B$r$D$1$k$H$=$l$>$l$N(Bworker$B$N>uBV$bI=<($5$l$k$h$&$K$J$j$^$9!#%G%P%C%0MQ(B)
    (-j2$B$r(B-j4$B$K$7$?$j(B-j8$B$K$7$?$j$b$G$-$^$9(B)

$B>0!"0lIt%F%9%H(B(gem$B$H$+(B)$B$O(Bfail$B$9$k$?$a(B-x
rubygems$B$J$I9%$^$7$$$G$9(B ($:$B$NLdBj!#(B)
$B:rF|(Brubygems$B$N%F%9%H$K%Q%C%A$r=P$7$?$N$G$=$l$,$H$j$3$^$l$k$^$G$O!#(B

$B8=;[email protected]$G$N(Btodo

test-all$B$OAv$jH4$1$k$b$N$N(B-j$B$r$D$1$?$H$-$N$$K(Bfail/error$B$9$k%F%9%H$,B8:$9$k(B

FAQ

Q. $B$J$<(Btest/unit$B$N$_2C9)$7$?$N$G$9$+(B?
A.
minitest/unit$B$O30It%W%m%8%’%/%H$G$"$k$3$H!"$^$?BgNL$N%F%9%H%9%$!<%H(B
(TestCase$B%/%i%9$r7Q>5$7$?%/%i%9(B) $B$r<B9T$9$k$3$H$,$J$5$=$&(B?
$B$H$$$&$3$H$r9M$(!#(B

Q. $BF0:n86M}$O(B?
A.
Windows$B$r9MN8$7$F(Bspawn$B$r;H$$!"(Btest/unit/parallel.rb$B$r5/F0$7$^$9!#(B
parallel.rb$B$H$O(BIO.pipe$B$H(BSTDIN/OUT$B$r;H$C$FDL?.$r9T$$$^$9!#(B
($B$3$N%U%!%$%k$NCf$N(Bsuite$B$r<B9T$7$m!"$J$I(B)
parallel.rb$B$N%W%m%;%9$r(Bworker$B$H8F$s$G$$$F!"2?EY$b;H$$2s$7$r$9$k$3$H$,2DG=$G$9!#(B

Q. Windows$B$GF0$-$^$;$s(B (xx$B$GF0$-$^$;$s(B)
A. $B%Q%C%A$N%Q%C%A$r=q$$$F$/$l$k$H$&$l$7$$$G$9!#(B

$B%Q%C%A$NI>2A!"$h$m$7$/$*$M$,$$$7$^$9!#(B

sora_h$B$G$9!#(B

mrkn$B$5$s$K$46([email protected]$-!"%Q%U%)!<%^%s%9$N%0%i%U$r:[email protected]$7$^$7$?!#(B

$B%0%i%U(B: http://gyazo.com/e093b9b3e380d516b5783d1d0702b262.png
-j$B$r$D$1$:$K<B9T$7$?;~$r(B1$B$H$7$?%0%i%U(B:
http://gyazo.com/045dfd58d9ce3d057cc14fde137a6615.png
$B85%G!<%?(B: https://gist.github.com/834848

$B%0%i%U>e$G$OF10l$N(Bn$B$K$D$$$F$OJ?6Q$r$H$C$F$$$^$9!#(B

Tests$B$H(BTotal$B$N0c$$$O!"(BTests$B$O%F%9%H$N<B9T;~4V!"(BTotal$B$O(Bmake
test-all$BA4BN(B (test$B$N3+;OA0$N(Brequire$B$b4^$`(B)$B$G$9!#(B

$B$^[email protected]$$$/$D$+%P%0$,$_$i$l$k$h$&$J$N$G!"$3$l$i$rDY$7$F$+$i%A%1%C%H$r:n$m$&$+$H;W$$$^$9$,!"0U8+$OFC$KL5$$$G$7$g$&$+(B?

$B$^$D$b$H(B $B$f$-$R$m$G$9(B

$B%P%0$H$l$?$iF~$l$A$c$C$?$i!)(B

In message “Re: [ruby-dev:43223] Re:
Ruby$B$N(Btest-all$B$rJBNs2=$9$k%Q%C%A$r=q$-$^$7$?(B”
on Sat, 19 Feb 2011 20:50:28 +0900, “Shota F. (sora_h)”
[email protected] writes:
|
|sora_h$B$G$9!#(B
|
|mrkn$B$5$s$K$46([email protected]$-!"%Q%U%)!<%^%s%9$N%0%i%U$r:[email protected]$7$^$7$?!#(B
|
|$B%0%i%U(B: http://gyazo.com/e093b9b3e380d516b5783d1d0702b262.png
|-j$B$r$D$1$:$K<B9T$7$?;~$r(B1$B$H$7$?%0%i%U(B:
http://gyazo.com/045dfd58d9ce3d057cc14fde137a6615.png
|$B85%G!<%?(B: https://gist.github.com/834848
|# $B%0%i%U>e$G$OF10l$N(Bn$B$K$D$$$F$OJ?6Q$r$H$C$F$$$^$9!#(B
|
|Tests$B$H(BTotal$B$N0c$$$O!"(BTests$B$O%F%9%H$N<B9T;~4V!"(BTotal$B$O(Bmake
test-all$BA4BN(B (test$B$N3+;OA0$N(Brequire$B$b4^$`(B)$B$G$9!#(B
|
|$B$^[email protected]$$$/$D$+%P%0$,$_$i$l$k$h$&$J$N$G!"$3$l$i$rDY$7$F$+$i%A%1%C%H$r:n$m$&$+$H;W$$$^$9$,!"0U8+$OFC$KL5$$$G$7$g$&$+(B?

Shota F. a.k.a. @sora_h - http://codnote.net/

[email protected]$G$9!%(B

$B!!([email protected]!$<ALd$5$;$F2<$5$$!%(B

(2011/02/18 6:58), Shota F. (sora_h) wrote:

Q. $B$J$<(Btest/unit$B$N$_2C9)$7$?$N$G$9$+(B?
A. minitest/unit$B$O30It%W%m%8%’%/%H$G$"$k$3$H!"$^$?BgNL$N%F%9%H%9%$!<%H(B
(TestCase$B%/%i%9$r7Q>5$7$?%/%i%9(B) $B$r<B9T$9$k$3$H$,$J$5$=$&(B?
$B$H$$$&$3$H$r9M$(!#(B

$B!!(Bminitest/unit
$B$O!VBgNL$N%F%9%H%9%$!<%H$r<B9T$9$k$3$H$,$J$5$=$&!)!W$H$$(B
$B$&$N$O$I$&$$$&0UL#$J$s$G$7$g$&$+!%(Bminitest/unit
$B$N$3$H$r$h$/CN$i$J$$$N(B
$B$G!$>o<1E*$J$3$H$G$7$?$i$9$_$^$;$s!%(B

$B!!$"$H!$%Q%C%[email protected]$o$1$G$O$J$$$N$G62=L$G$9$,!$(Bruby $B$N(B make
test-all
[email protected]$1$K8z$/JQ99$J$s$G$7$g$&$+!%$=$l$H$b!$(Btest/unit
$B;H$C$F$$$k$9$Y$F$N%F%9(B
$B%H$KM-8z$JOC$J$s$G$7$g$&$+!%(B

むらたです。

On 2011年2月19日土曜日 at 20:50, Shota F. (sora_h) wrote:

まだいくつかバグがみられるようなので、これらを潰してからチケットを作ろうかと思いますが、意見は特に無いでしょうか?

そのグラフの -j3 の部分が変ですね。
私の手違いで -j3 の場合だけサンプル数が少ないのですが、
-j5 の上2つも加えて平均とったりしていませんか?

きちんとやると下のスクリーンショットのようになりました。
https://skitch.com/mrkn/rxah7/gistfile1

私の実験環境の CPU は4コアなのですが、上の結果を見ると4つのコアをすべて活用できている
事が分かりますね。良い改善だと思いました。

テストクラス単位じゃなくてメソッド単位で並列化したらどうなるのか気になっています。

– Kenta M.
Sent with Sparrow

sora_h$B$G$9!#(B

2011/2/21 SASADA Koichi [email protected]:

$B!!(Bminitest/unit $B$O!VBgNL$N%F%9%H%9%$!<%H$r<B9T$9$k$3$H$,$J$5$=$&!)!W$H$$(B
$B$&$N$O$I$&$$$&0UL#$J$s$G$7$g$&$+!%(Bminitest/unit $B$N$3$H$r$h$/CN$i$J$$$N(B
$B$G!$>o<1E*$J$3$H$G$7$?$i$9$_$^$;$s!%(B
$B:#2s$N%Q%C%A$O%F%9%H$N%a%=%C%IKh$KJBNs<B9T$9$k$N$G$O$J$/!"(BTestCase$B%/%i%9$r7Q>5$7$?%/%i%9(B($B%F%9%H%1!<%9(B)
$BKh$K<B9T$7$^$9!#4pK(B1$B%U%!%$%k(B1$B%F%9%H%1!<%[email protected]$H$O;W$&$N$G$9$,!"(Bminitest/unit$B$O%U%!%$%k$N%j%9%H$r;XDj$7$F$^$k$4$H<B9T$9$k(B
$B$h$&$J5!G=$,L5$$$h$&$J5$$,$7$?$?$a!#(B

$B$"$H!$%Q%C%[email protected]$o$1$G$O$J$$$N$G62=L$G$9$,!$(Bruby $B$N(B make test-all
[email protected]$1$K8z$/JQ99$J$s$G$7$g$&$+!%$=$l$H$b!$(Btest/unit $B;H$C$F$$$k$9$Y$F$N%F%9(B
$B%H$KM-8z$JOC$J$s$G$7$g$&$+!%(B
$B%Q%C%AE*$K$O(Btest/unit$B$r;H$C$F$$$kA4%F%9%H$G;H$($^$9$h!#[email protected]$78z2L$rBN83$G$-$k$N$OJ#?t$N%F%9%H%1!<%9$r;}$D>[email protected]$1$+$H;W$o$l$^$9!#(B
$B$^$?!"$"$kDxEY$N%1!<%9?t$,L5$$$H%!<%P!<%X%C%I(B>$B%F%9%H;~4V$K$J$C$F$7$^$&$?$aL50UL#[email protected]$bH]Dj$G$-$^$;$s!#(B
Ruby$B$N>l9g$O%F%9%H;~4V(B>$B%
!<%P!<%X%C%I$G$7$?$,!#(B

[email protected]$G$9!%(B

(2011/02/22 8:32), Shota F. (sora_h) wrote:

2011/2/21 SASADA Koichi [email protected]:

$B!!(Bminitest/unit
$B$O!VBgNL$N%F%9%H%9%$!<%H$r<B9T$9$k$3$H$,$J$5$=$&!)!W$H$$(B

$B$&$N$O$I$&$$$&0UL#$J$s$G$7$g$&$+!%(Bminitest/unit $B$N$3$H$r$h$/CN$i$J$$$N(B
$B$G!$>o<1E*$J$3$H$G$7$?$i$9$_$^$;$s!%(B

$B:#2s$N%Q%C%A$O%F%9%H$N%a%=%C%IKh$KJBNs<B9T$9$k$N$G$O$J$/!"(BTestCase$B%/%i%9$r7Q>5$7$?%/%i%9(B($B%F%9%H%1!<%9(B)

$BKh$K<B9T$7$^$9!#4pK(B1$B%U%!%$%k(B1$B%F%9%H%1!<%[email protected]$H$O;W$&$N$G$9$,!"(Bminitest/unit$B$O%U%!%$%k$N%j%9%H$r;XDj$7$F$^$k$4$H<B9T$9$k(B

$B$h$&$J5!G=$,L5$$$h$&$J5$$,$7$?$?$a!#(B

$B!!(Bminitest $B$N>l9g!$$h$/$o$+$i$J$$$N$G$9$,!$%U%!%$%k%j%9%H$r(B
require $B$7$F(B
$B2s$k$s$G!$7k6I0l=o$N$h$&$J5$$,$7$^$9!%(B

$B!!:#!$$=$l$+$i:#8e!$(BRuby
$B$N%F%9%H$,$I$&=q$+$l$F$$$k$N$,0lHLE*$+$o$+$j$^(B
$B$;$s$,[email protected]$$K$"$k(B gem
$B%Q%C%1!<%8$r$H$+D4$Y$l$P$$$$$N$+$7$i!K!$(Bminitest $B$r(B
$BD>@\8F$V$3$H$,B?$$$J$i!$$=$C$A$KH?1G$7$F$b$$$$$N$+$b$7$l$^$;$s$M!%(B

$B$"$H!$%Q%C%[email protected]$o$1$G$O$J$$$N$G62=L$G$9$,!$(Bruby $B$N(B make test-all
[email protected]$1$K8z$/JQ99$J$s$G$7$g$&$+!%$=$l$H$b!$(Btest/unit
$B;H$C$F$$$k$9$Y$F$N%F%9(B

$B%H$KM-8z$JOC$J$s$G$7$g$&$+!%(B

$B%Q%C%AE*$K$O(Btest/unit$B$r;H$C$F$$$kA4%F%9%H$G;H$($^$9$h!#[email protected]$78z2L$rBN83$G$-$k$N$OJ#?t$N%F%9%H%1!<%9$r;}$D>[email protected]$1$+$H;W$o$l$^$9!#(B

$B$^$?!"$"$kDxEY$N%1!<%9?t$,L5$$$H%*!<%P!<%X%C%I(B>$B%F%9%H;~4V$K$J$C$F$7$^$&$?$aL50UL#[email protected]$bH]Dj$G$-$^$;$s!#(B

Ruby$B$N>l9g$O%F%9%H;~4V(B>$B%*!<%P!<%X%C%I$G$7$?$,!#(B

$B!!$=$l$J$i!$(Btest-all $B$NJBNs2=!$$G$O$J$/(B test/unit
$B$N2~A1!$$H$7$F(B NEWS $B$H(B
$B$+%I%-%e%a%s%H$H$+$7$F$$$$?$[$&$,$$$$$H;W$$$^$9!%8z$/!$8z$+$J$$$OMxMQ<T(B
$B$,A
$Y$P$$$$$N$G!%(B

([email protected]@h@8$KD>@\JV?.$7$F$7$^$C$?$?$a:FAw$7$^$9!#(B)

sora_h$B$G$9!#(B

$B$J$k$[$I!#%3%_%C%H$9$k:]$K$O(BNEWS$B$b$"$o$;$FJT=8$7$^$9!#(B
$B%"%I%P%$%9$"$j$,$H$&$4$6$$$^$7$?!#(B

2011/2/22 SASADA Koichi [email protected]:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs