First visit to this forum, hope I've chosen an appropriate place to post this.
I have a Java-based application that uses native C++ libraries (built with g++-4.0) for specialized, computation-intensive routines.
Within the native code, I need to catch exceptions thrown inside called methods and throw a corresponding Java exception back to the JVM. This used to work just fine. But I am performing a rebuild after some time has past, and our platform itself (Debian testing) has had some upgrades (to glibc, etc.). Consequently, the desired functionality seems to be broken. The exceptions are not being caught in the new build.
Note: the same code built and tested on MS Windows platforms works just as expected.
Here is a snippet some of the code that is failing:
Here is the error message that the system gives:
Any input or advice would be terrific.
Matthew
P.S. I now realize that this is a poor choice of forum for my question. If it would be more appropriate, could a moderator please move this to Network Computing Topics > C Programming in the UNIX Environment. I see there is a g++-4.0 thread over there. Sorry.
Hi expert,
Need some help on network interface issue..
I have added 2 x NIC card onto the Ultra 2 system recently and configured as hme1 and hme2. I have unconfigured the onboard hme0 network interface and it was running fine till few days later, i keep recieving error messages showing hme0... (6 Replies)
Hi every body,
I have a Fiber Channel interface (fcs2) in AIX 5.2. This interface was fine & up but for some reason I could not return this interface UP again after I set it DOWN.
When I tried to set this interface UP I encountered the following error:
Method error... (7 Replies)
Hi,
tried to native compile Debian Dialog as ncurses-dev is available.
I am trying native compile Debian Dialog using gcc on Linux embedded router.
What's wrong, as running than make
I get errors.
Mayby this line in the log file is an exaplanation to a problem ?
"
checking if we have... (1 Reply)
hi all,
i have problem with my box,
until now i can't investigate the root cause of my issue at my box.
here the problem.
i have a box as a squid server just forward all request packet from one interface and receive the packet then forward to client at the same interface. but after 5 hours i... (1 Reply)
Hello, I'm trying to use libcurl multi interface to fetch several data in parallel. I would expect this to be faster than performing repeated fetches using the easy interface, but for some reason I can't obtain any speed up at all: using the multi interface actually turns out to be MUCH slower than... (2 Replies)
Hi, i have problems with an installation of Debian i386 505 in a pc. The hardware it is a mother soyo with a chipset via.
When i install the xorg, the installation it`s succesfull, but when i type startx, the pc don`t respond.
I am from Argentina and my English it isn`t good. Sorry. (0 Replies)
Hi
i have replace a NIC card on solaris 10 when i give the following command
ifconfig -a
it just show the lo0 (only loop back with inet 127.0.0.1)
when i give the following command to config the interface,
ifconfig elxl0 plumb
ifconfig: plumb: elxl0: no such interface
please help... (11 Replies)
HI,
genunix: NOTICE: ce0: xcvr addr:0x01 - link up 100 Mbps half duplex
genunix: WARNING: ce0: fault detected external to device; service degraded
genunix: WARNING: ce0: xcvr addr:0x01 - link down
genunix: NOTICE: ce0: fault cleared external to device; service available
genunix: ... (4 Replies)
My desired output is
run:
for this 1
for this 2
for this 3
for this 4
for this 5
for this 1,2
1->2
for this 2,3
2->3
for this 3,4
3->4
for this 4,5
4->5
for this 1,2,3
1->2,3 (2 Replies)
Discussion started by: vaibhavkorde
2 Replies
LEARN ABOUT MOJAVE
test::fatal
Test::Fatal(3) User Contributed Perl Documentation Test::Fatal(3)NAME
Test::Fatal - incredibly simple helpers for testing code with exceptions
VERSION
version 0.013
SYNOPSIS
use Test::More;
use Test::Fatal;
use System::Under::Test qw(might_die);
is(
exception { might_die; },
undef,
"the code lived",
);
like(
exception { might_die; },
qr/turns out it died/,
"the code died as expected",
);
isa_ok(
exception { might_die; },
'Exception::Whatever',
'the thrown exception',
);
DESCRIPTION
Test::Fatal is an alternative to the popular Test::Exception. It does much less, but should allow greater flexibility in testing
exception-throwing code with about the same amount of typing.
It exports one routine by default: "exception".
FUNCTIONS
exception
my $exception = exception { ... };
"exception" takes a bare block of code and returns the exception thrown by that block. If no exception was thrown, it returns undef.
Achtung! If the block results in a false exception, such as 0 or the empty string, Test::Fatal itself will die. Since either of these
cases indicates a serious problem with the system under testing, this behavior is considered a feature. If you must test for these
conditions, you should use Try::Tiny's try/catch mechanism. (Try::Tiny is the underlying exception handling system of Test::Fatal.)
Note that there is no TAP assert being performed. In other words, no "ok" or "not ok" line is emitted. It's up to you to use the rest of
"exception" in an existing test like "ok", "isa_ok", "is", et cetera. Or you may wish to use the "dies_ok" and "lives_ok" wrappers, which
do provide TAP output.
"exception" does not alter the stack presented to the called block, meaning that if the exception returned has a stack trace, it will
include some frames between the code calling "exception" and the thing throwing the exception. This is considered a feature because it
avoids the occasionally twitchy "Sub::Uplevel" mechanism.
Achtung! This is not a great idea:
sub exception_like(&$;$) {
my ($code, $pattern, $name) = @_;
like( &exception($code), $pattern, $name );
}
exception_like(sub { }, qr/foo/, 'foo appears in the exception');
If the code in the "..." is going to throw a stack trace with the arguments to each subroutine in its call stack (for example via
"Carp::confess", the test name, "foo appears in the exception" will itself be matched by the regex. Instead, write this:
like( exception { ... }, qr/foo/, 'foo appears in the exception' );
Achtung: One final bad idea:
isnt( exception { ... }, undef, "my code died!");
It's true that this tests that your code died, but you should really test that it died for the right reason. For example, if you make an
unrelated mistake in the block, like using the wrong dereference, your test will pass even though the code to be tested isn't really run at
all. If you're expecting an inspectable exception with an identifier or class, test that. If you're expecting a string exception,
consider using "like".
success
try {
should_live;
} catch {
fail("boo, we died");
} success {
pass("hooray, we lived");
};
"success", exported only by request, is a Try::Tiny helper with semantics identical to "finally", but the body of the block will only be
run if the "try" block ran without error.
Although almost any needed exception tests can be performed with "exception", success blocks may sometimes help organize complex testing.
dies_ok
lives_ok
Exported only by request, these two functions run a given block of code, and provide TAP output indicating if it did, or did not throw an
exception. These provide an easy upgrade path for replacing existing unit tests based on "Test::Exception".
RJBS does not suggest using this except as a convenience while porting tests to use Test::Fatal's "exception" routine.
use Test::More tests => 2;
use Test::Fatal qw(dies_ok lives_ok);
dies_ok { die "I failed" } 'code that fails';
lives_ok { return "I'm still alive" } 'code that does not fail';
AUTHOR
Ricardo Signes <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.18.2 2013-09-23 Test::Fatal(3)