test/unit as included in the standard ruby 1.8x distribution is broken. Probably the autorunner is not working correctly, see below. The problem does NOT lay in test/unit itself, as it works totally correct when I build from the pristine ruby-1.8.1.tar.gz which the ruby ebuild uses. There has definitely to be something wrong with the ruby-1.8 in Portage. # ruby-1.8.1 as build by Portage phil@o2 ~ $ ruby ./t.rb --help Loaded suite ./t Started Finished in 0.000452 seconds. 0 tests, 0 assertions, 0 failures, 0 errors # ruby-1.8.1 from pristine sources phil@o2 ~/build/ruby-1.8.1 $ ./ruby -I ~/build/ruby-1.8.1/lib ./t.rb --help Test::Unit automatic runner. Usage: ./t.rb [options] [-- untouched arguments] -r, --runner=RUNNER Use the given RUNNER. (c[onsole], f[ox], g[tk], g[tk]2, t[k]) -n, --name=NAME Runs tests matching NAME. (patterns may be used). -t, --testcase=TESTCASE Runs tests in TestCases matching TESTCASE. (patterns may be used). -v, --verbose=[LEVEL] Set the output level (default is verbose). (s[ilent], p[rogress], n[ormal], v[erbose]) -- Stop processing options so that the remaining options will be passed to the test. -h, --help Display this help. Deprecated options: --console Console runner (use --runner). --gtk GTK runner (use --runner). --fox Fox runner (use --runner). # ruby-cvs (ruby-1.9.0) phil@o2 ~ $ /usr/bin/ruby19 ./t.rb --help Test::Unit automatic runner. Usage: ./t.rb [options] [-- untouched arguments] -r, --runner=RUNNER Use the given RUNNER. (c[onsole], f[ox], g[tk], g[tk]2, t[k]) -n, --name=NAME Runs tests matching NAME. (patterns may be used). -t, --testcase=TESTCASE Runs tests in TestCases matching TESTCASE. (patterns may be used). -v, --verbose=[LEVEL] Set the output level (default is verbose). (s[ilent], p[rogress], n[ormal], v[erbose]) -- Stop processing options so that the remaining options will be passed to the test. -h, --help Display this help. Deprecated options: --console Console runner (use --runner). --gtk GTK runner (use --runner). --fox Fox runner (use --runner). [ebuild R ] dev-lang/ruby-1.8.1-r2 -cjk -socks5 +tcltk 363 kB Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.3, glibc-2.3.3_pre20040207-r0, 2.6.3-gentoo-r2) ================================================================= System uname: 2.6.3-gentoo-r2 i686 AMD Athlon(tm) XP 2100+ Gentoo Base System version 1.4.3.13p1 Autoconf: sys-devel/autoconf-2.59-r3 Automake: sys-devel/automake-1.8.3 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CFLAGS="-O3 -march=athlon-xp -pipe -fomit-frame-pointer -frerun-loop-opt -falign-functions=4 -fforce-mem -funroll-loops -ffast-math -finline-functions -foptimize-sibling-calls -m3dnow -mmmx" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /etc/tomcat /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O3 -march=athlon-xp -pipe -fomit-frame-pointer -frerun-loop-opt -falign-functions=4 -fforce-mem -funroll-loops -ffast-math -finline-functions -foptimize-sibling-calls -m3dnow -mmmx -Wno-deprecated" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox" GENTOO_MIRRORS="http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ http://ftp6.uni-erlangen.de/pub/mirrors/gentoo http://128.213.5.34/gentoo/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.de.gentoo.org/gentoo-portage" USE="3dnow X acl acpi alsa apache2 apm autofs avi berkdb cdr crypt cups dvd encode esd foomaticdb gd gdbm gif gimpprint gnome gpm gtk gtk2 imap imlib innodb ipv6 jack java jikes jpeg kde ldap libg++ libwww mad maildir mbox memlimit mikmod mmx mozilla moznocompose moznoirc mpeg mysql ncurses nls nowin oggvorbis opengl pam parse-clocks pdflib png ppds python qt quicktime readline ruby sdl slang spell ssl svga tcltk tcpd tetex truetype unicode vim-with-x x86 xml2 xmms xv xvid zlib"
Please can you post the t.rb script that demonstrates the problem. My (basic) unit tests work with this version: dev-lang/ruby-1.8.1-r3 If you upgrade to this version does the problem go away? Cheers, Tom
>>> t.rb >>> require 'test/unit' class TC < Test::Unit::TestCase def test_it end end <<< t.rb <<< I have to regret, the problem did not go away. The t.rb is as suggested by the author of testunit. It works from a plain compile, but not with the emerged version of ruby. [ebuild R ] dev-lang/ruby-1.8.1-r3 -cjk -socks5 +tcltk 191 kB
Could you include the output of `epm -qGa | grep ruby`? I also cannot reproduce the problem with ruby-1.8.1-r3 and ruby-cvs-1.9.0-r1. usata@rico ~ % ruby18 t.rb --help Test::Unit automatic runner. Usage: t.rb [options] [-- untouched arguments] -r, --runner=RUNNER Use the given RUNNER. (c[onsole], f[ox], g[tk], g[tk]2, t[k]) -n, --name=NAME Runs tests matching NAME. (patterns may be used). -t, --testcase=TESTCASE Runs tests in TestCases matching TESTCASE. (patterns may be used). -v, --verbose=[LEVEL] Set the output level (default is verbose). (s[ilent], p[rogress], n[ormal], v[erbose]) -- Stop processing options so that the remaining options will be passed to the test. -h, --help Display this help. Deprecated options: --console Console runner (use --runner). --gtk GTK runner (use --runner). --fox Fox runner (use --runner). usata@rico ~ % ruby19 t.rb --help Test::Unit automatic runner. Usage: t.rb [options] [-- untouched arguments] -r, --runner=RUNNER Use the given RUNNER. (c[onsole], f[ox], g[tk], g[tk]2, t[k]) -n, --name=NAME Runs tests matching NAME. (patterns may be used). -t, --testcase=TESTCASE Runs tests in TestCases matching TESTCASE. (patterns may be used). -v, --verbose=[LEVEL] Set the output level (default is verbose). (s[ilent], p[rogress], n[ormal], v[erbose]) -- Stop processing options so that the remaining options will be passed to the test. -h, --help Display this help. Deprecated options: --console Console runner (use --runner). --gtk GTK runner (use --runner). --fox Fox runner (use --runner).
Your last message was a bit weird. $ epm -qGa | grep ruby bash: epm: command not found What do you mean exactly?
Oops, sorry. You need to emerge app-portage/epm first to use it. Alternatively, if you have gentoolkit, `qpkg -I ruby` will do the same thing as I requested. (I wanted to get the list of installed ruby packages on your system)
phil@o2 ~ $ qpkg -I ruby dev-lang/ruby * dev-lang/ruby-cvs * dev-ruby/fxruby * dev-ruby/mod-ruby * dev-ruby/mysql-ruby * dev-ruby/nora * dev-ruby/programming-ruby * dev-ruby/rexml * dev-ruby/ri * dev-ruby/ruby-atk * dev-ruby/ruby-config * dev-ruby/ruby-gdkpixbuf2 * dev-ruby/ruby-glib2 * dev-ruby/ruby-gtk2 * dev-ruby/ruby-pango * dev-ruby/ruby-vorbisfile * dev-ruby/testunit * There we are (:
Hum, what is the version of testunit you have? testunit is included in ruby 1.8.0 so you don't need to install it. >=dev-ruby/testunit-0.1.5 pulls ruby-1.6 in so I guess your /usr/bin/ruby refers to ruby16 and that is the cause of the bug. What does `ruby-config -c` return? You can change default ruby by ruby-config. testunit-0.1.8 does not have autorunner, so you cannot use that feature with ruby-1.6 + testunit-0.1.8. If you do not use ruby-1.6 you may want to unmerge testunit and ruby-1.6.
No, this is not the root of the problem. I have ruby-1.6 installed for backwards compatibility. Testunit is included with ruby-1.8 and my profile is indeed set to ruby18.
Works now.