[Pkg-libvirt-commits] [SCM] Libguestfs Debian packaging branch, experimental, updated. debian/1%1.21.40-1

Richard W.M. Jones rjones at redhat.com
Sat Jun 1 11:04:27 UTC 2013


The following commit has been merged in the experimental branch:
commit 3c43019f8df837f3c0c4325679d46cbb336eced2
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Tue Apr 30 17:41:05 2013 +0100

    ruby: Standardize test names and numbering.

diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 0faa2e0..0c4ee5a 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -32,11 +32,11 @@ EXTRA_DIST = \
 	lib/guestfs.rb \
 	run-bindtests \
 	run-ruby-tests \
-	tests/tc_*.rb
+	t/tc_*.rb
 
 CLEANFILES = \
 	lib/*~ \
-	tests/*~ \
+	t/*~ \
 	ext/guestfs/*~ \
 	ext/guestfs/extconf.h \
 	ext/guestfs/_guestfs.o \
diff --git a/ruby/Rakefile.in b/ruby/Rakefile.in
index a74e191..6317575 100644
--- a/ruby/Rakefile.in
+++ b/ruby/Rakefile.in
@@ -70,7 +70,7 @@ desc "Build the native library"
 task :build => GUESTFS_MODULE
 
 Rake::TestTask.new(:test) do |t|
-    t.test_files = FileList['tests/tc_*.rb']
+    t.test_files = FileList['t/tc_*.rb']
     t.libs = [ 'lib', 'ext/guestfs' ]
 end
 task :test => :build
@@ -100,7 +100,7 @@ PKG_FILES = FileList[
   "Rakefile", "COPYING", "README", "NEWS", "@srcdir@/README.rdoc",
   "lib/**/*.rb",
   "ext/**/*.[ch]", "ext/**/MANIFEST", "ext/**/extconf.rb",
-  "tests/**/*",
+  "t/**/*",
   "spec/**/*"
 ]
 
diff --git a/ruby/run-ruby-tests b/ruby/run-ruby-tests
index c618241..ac18ea3 100755
--- a/ruby/run-ruby-tests
+++ b/ruby/run-ruby-tests
@@ -21,7 +21,7 @@ set -e
 # Run them one at a time, otherwise rake runs them in parallel (which
 # is bound to fail because they all use a single test image file).
 
-for f in tests/tc_*.rb; do
+for f in t/tc_*.rb; do
     echo $RAKE test "$@" TEST="$f"
     $RAKE test "$@" TEST="$f"
 done
diff --git a/ruby/tests/tc_010_load.rb b/ruby/t/tc_010_load.rb
similarity index 92%
copy from ruby/tests/tc_010_load.rb
copy to ruby/t/tc_010_load.rb
index 80c1e03..4274d5a 100644
--- a/ruby/tests/tc_010_load.rb
+++ b/ruby/t/tc_010_load.rb
@@ -1,5 +1,5 @@
 # libguestfs Ruby bindings -*- ruby -*-
-# Copyright (C) 2009 Red Hat Inc.
+# Copyright (C) 2009-2013 Red Hat Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -22,7 +22,5 @@ require 'guestfs'
 
 class TestLoad < Test::Unit::TestCase
   def test_load
-    g = Guestfs::create()
-    assert_not_nil (g)
   end
 end
diff --git a/ruby/tests/tc_010_load.rb b/ruby/t/tc_020_create.rb
similarity index 94%
rename from ruby/tests/tc_010_load.rb
rename to ruby/t/tc_020_create.rb
index 80c1e03..2b57ba1 100644
--- a/ruby/tests/tc_010_load.rb
+++ b/ruby/t/tc_020_create.rb
@@ -1,5 +1,5 @@
 # libguestfs Ruby bindings -*- ruby -*-
-# Copyright (C) 2009 Red Hat Inc.
+# Copyright (C) 2009-2013 Red Hat Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ $:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
 require 'guestfs'
 
 class TestLoad < Test::Unit::TestCase
-  def test_load
+  def test_create
     g = Guestfs::create()
     assert_not_nil (g)
   end
diff --git a/ruby/tests/tc_060_optargs.rb b/ruby/t/tc_070_optargs.rb
similarity index 100%
rename from ruby/tests/tc_060_optargs.rb
rename to ruby/t/tc_070_optargs.rb
diff --git a/ruby/tests/tc_050_lvcreate.rb b/ruby/t/tc_100_launch.rb
similarity index 96%
rename from ruby/tests/tc_050_lvcreate.rb
rename to ruby/t/tc_100_launch.rb
index 4e9c957..4bd8187 100644
--- a/ruby/tests/tc_050_lvcreate.rb
+++ b/ruby/t/tc_100_launch.rb
@@ -1,5 +1,5 @@
 # libguestfs Ruby bindings -*- ruby -*-
-# Copyright (C) 2009 Red Hat Inc.
+# Copyright (C) 2009-2013 Red Hat Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ $:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
 require 'guestfs'
 
 class TestLoad < Test::Unit::TestCase
-  def test_lvcreate
+  def test_launch
     g = Guestfs::create()
 
     File.open("test.img", "w") {
diff --git a/ruby/tests/tc_rhbz664558c6.rb b/ruby/t/tc_410_close_event.rb
similarity index 73%
copy from ruby/tests/tc_rhbz664558c6.rb
copy to ruby/t/tc_410_close_event.rb
index 290deac..ebf4bbc 100644
--- a/ruby/tests/tc_rhbz664558c6.rb
+++ b/ruby/t/tc_410_close_event.rb
@@ -1,5 +1,5 @@
 # libguestfs Ruby bindings -*- ruby -*-
-# Copyright (C) 2011 Red Hat Inc.
+# Copyright (C) 2011-2013 Red Hat Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -15,32 +15,27 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-# Test that throwing an exception in a callback doesn't cause
-# the interpreter to segfault.  See:
-# https://bugzilla.redhat.com/show_bug.cgi?id=664558#c6
-
 require 'test/unit'
 $:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
 $:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
 require 'guestfs'
 
 class TestLoad < Test::Unit::TestCase
-  def test_rhbz664558c6
+  def test_events
     g = Guestfs::create()
 
     close_invoked = 0
     close = Proc.new {| event, event_handle, buf, array |
       close_invoked += 1
-      # Raising an exception used to cause the interpreter to
-      # segfault.  It should just cause an error message to be
-      # printed on stderr.
-      raise "ignore this error"
     }
+
+    # Check that the close event is called.
     g.set_event_callback(close, Guestfs::EVENT_CLOSE)
 
-    # This should call the close callback.
+    if close_invoked != 0
+      raise "close_invoked should be 0"
+    end
     g.close()
-
     if close_invoked != 1
       raise "close_invoked should be 1"
     end
diff --git a/ruby/tests/tc_400_events.rb b/ruby/t/tc_420_log_messages.rb
similarity index 79%
rename from ruby/tests/tc_400_events.rb
rename to ruby/t/tc_420_log_messages.rb
index 7c911c4..d23a0fb 100644
--- a/ruby/tests/tc_400_events.rb
+++ b/ruby/t/tc_420_log_messages.rb
@@ -1,5 +1,5 @@
 # libguestfs Ruby bindings -*- ruby -*-
-# Copyright (C) 2011 Red Hat Inc.
+# Copyright (C) 2011-2013 Red Hat Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,7 +24,9 @@ class TestLoad < Test::Unit::TestCase
   def test_events
     g = Guestfs::create()
 
+    log_invoked = 0
     log = Proc.new {| event, event_handle, buf, array |
+      log_invoked += 1
       if event == Guestfs::EVENT_APPLIANCE
         buf.chomp!
       end
@@ -32,20 +34,11 @@ class TestLoad < Test::Unit::TestCase
       puts "ruby event logged: event=#{event_string} eh=#{event_handle} buf='#{buf}' array=#{array}"
     }
 
-    close_invoked = 0
-    close = Proc.new {| event, event_handle, buf, array |
-      close_invoked += 1
-      log.call(event, event_handle, buf, array)
-    }
-
     # Grab log, trace and daemon messages into our custom callback.
     event_bitmask = Guestfs::EVENT_APPLIANCE | Guestfs::EVENT_LIBRARY |
       Guestfs::EVENT_TRACE
     g.set_event_callback(log, event_bitmask)
 
-    # Check that the close event is called.
-    g.set_event_callback(close, Guestfs::EVENT_CLOSE)
-
     # Make sure we see some messages.
     g.set_trace(1)
     g.set_verbose(1)
@@ -54,12 +47,9 @@ class TestLoad < Test::Unit::TestCase
     g.add_drive_ro("/dev/null")
     g.set_autosync(1)
 
-    if close_invoked != 0
-      raise "close_invoked should be 0"
-    end
     g.close()
-    if close_invoked != 1
-      raise "close_invoked should be 1"
+    if log_invoked == 0
+      raise "log_invoked should be > 0"
     end
   end
 end
diff --git a/ruby/tests/tc_rhbz507346.rb b/ruby/t/tc_800_rhbz507346.rb
similarity index 100%
rename from ruby/tests/tc_rhbz507346.rb
rename to ruby/t/tc_800_rhbz507346.rb
diff --git a/ruby/tests/tc_rhbz664558c6.rb b/ruby/t/tc_810_rhbz664558c6.rb
similarity index 100%
rename from ruby/tests/tc_rhbz664558c6.rb
rename to ruby/t/tc_810_rhbz664558c6.rb

-- 
Libguestfs Debian packaging



More information about the Pkg-libvirt-commits mailing list