[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Failing Java tests due to no JRE
From: |
Rik |
Subject: |
Re: Failing Java tests due to no JRE |
Date: |
Fri, 16 Sep 2016 18:22:36 -0700 |
On 09/16/2016 05:21 PM, Mike Miller wrote:
> On Thu, Sep 15, 2016 at 14:03:11 -0700, Rik wrote:
>> You could introduce some in-band communication method. Right now I believe
>> test.m takes the test code, wraps it in a function, evals the function into
>> existence, and then executes the new function in a try/catch block. I
>> don't believe the created function has a return argument, but you could
>> bolt one on and use that to pass information back to test.m. And certainly
>> there is no rush to do this.
> Yes, good point. The test block could return a specific value to signal
> that the test should be marked as "skipped".
>
> Maybe better would be to throw an error with a specific error-id that
> could be caught and recognized as a runtime "skip" signal.
>
Either way is possible. The code from test.m is:
## evaluate code for test, shared, and assert.
if (! isempty(__code))
try
## FIXME: Must check for embedded test functions, which cause
## segfaults, until issues with subfunctions in functions are fixed.
embed_func = regexp (__code, '^\s*function ', 'once', 'lineanchors');
if (isempty (embed_func))
eval (sprintf ("function %s__test__(%s)\n%s\nendfunction",
__shared_r, __shared, __code));
eval (sprintf ("%s__test__(%s);", __shared_r, __shared));
else
error (["Functions embedded in %!test blocks are not
allowed.\n", ...
"Use the %!function/%!endfunction syntax instead to
define shared functions for testing.\n"]);
endif
catch
if (isempty (lasterr ()))
error ("test: empty error text, probably Ctrl-C --- aborting");
else
__success = false;
if (__isxtest)
__xfail += 1;
if (isempty (__bug_id))
__msg = "known failure";
else
if (all (isdigit (__bug_id)))
__bug_id = ["http://octave.org/testfailure/?" __bug_id];
endif
__msg = ["known bug: " __bug_id];
endif
else
__msg = "test failed";
endif
__msg = [__signal_fail __msg "\n" lasterr()];
endif
end_try_catch
clear __test__;
endif
You can see the eval line creating and running the __test__ function in the
first part of the try block. The first possibility is to modify that and
have it return a special value to indicate SKIP. Otherwise, you can modify
the catch block to look at lasterr() and see if it is a special value.
--Rik