1 # libguestfs Ruby bindings -*- ruby -*-
2 # Copyright (C) 2011 Red Hat Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 # Test that throwing an exception in a callback doesn't cause
19 # the interpreter to segfault. See:
20 # https://bugzilla.redhat.com/show_bug.cgi?id=664558#c6
23 $:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
24 $:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
27 class TestLoad < Test::Unit::TestCase
32 close = Proc.new {| event, event_handle, buf, array |
34 # Raising an exception used to cause the interpreter to
35 # segfault. It should just cause an error message to be
37 raise "ignore this error"
39 g.set_event_callback(close, Guestfs::EVENT_CLOSE)
41 # This should call the close callback.
45 raise "close_invoked should be 1"