[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #57456] "test rand.cc" produces onCleanup erro
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #57456] "test rand.cc" produces onCleanup error |
Date: |
Fri, 31 Jan 2020 21:28:06 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko |
Update of bug #57456 (project octave):
Status: None => Confirmed
_______________________________________________________
Follow-up Comment #1:
Attaching the file rand.cc-tst which contains the BIST tests. With this one
can start Octave and run
test rand.cc-tst
With version 5.1 this works, with the development branch the result is
warning: onCleanup: error caught while executing cleanup function:
'restore_rand_states' undefined near line 17, column 17
This is a regression. On the other hand, if this is not the right way to be
using %!function and onCleanup then just say so.
The code is
%!function restore_rand_states (seed, state)
%! rand ("seed", seed.rand);
%! rande ("seed", seed.rande);
%! randg ("seed", seed.randg);
%! randn ("seed", seed.randn);
%! randp ("seed", seed.randp);
%! rand ("state", state.rand);
%! rande ("state", state.rande);
%! randg ("state", state.randg);
%! randn ("state", state.randn);
%! randp ("state", state.randp);
%!endfunction
%!shared __random_statistical_tests__, old_seed, old_state, restore_state
%! ## Flag whether the statistical tests should be run in "make check" or not
%! __random_statistical_tests__ = 0;
%! ## Save and restore the states of each of the random number generators
%! ## that are tested by the unit tests in this file.
%! old_seed.rand = rand ("seed");
%! old_seed.rande = rande ("seed");
%! old_seed.randg = randg ("seed");
%! old_seed.randn = randn ("seed");
%! old_seed.randp = randp ("seed");
%! old_state.rand = rand ("state");
%! old_state.rande = rande ("state");
%! old_state.randg = randg ("state");
%! old_state.randn = randn ("state");
%! old_state.randp = randp ("state");
% restore_state = onCleanup (@() restore_rand_states (old_seed, old_state));
The code can be made to work by putting the %!function after the %!shared
declaration. It was my understanding that %!shared only cleared variables,
and not functions, for a %!test block.
(file #48325)
_______________________________________________________
Additional Item Attachment:
File name: rand.cc-tst Size:15 KB
<https://savannah.gnu.org/file/rand.cc-tst?file_id=48325>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?57456>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #57456] "test rand.cc" produces onCleanup error,
Rik <=