apjanke / octave-testify

New BIST (Built-In Self Test) functions for GNU Octave
GNU General Public License v3.0
4 stars 2 forks source link

BistRunner.restore_diary_state creates empty diary files #86

Closed mtmiller closed 4 years ago

mtmiller commented 5 years ago

The implementation of BistRunner.restore_diary_state restores the diary file name first, then sets the state to off or on. But setting the file name first turns the diary state on in Octave. If the state was off, this creates empty diary files in the working directory every time this method is called.

I can't test whether Matlab works this way or not, maybe there is a bug in Octave's diary function, or maybe there is no way to set the diary file name without also turning on the diary log.

apjanke commented 5 years ago

Matlab works this way, too: doing diary('some_string') will both set the diary output file and turn on diary-ing.

This is a bug in Testify.

Luckily, Octave provides the [state,file] = diary() query form of diary to check its current state, so this will be an easy fix.

apjanke commented 4 years ago

I believe this is fixed in https://github.com/apjanke/octave-testify/commit/abbd9e1f548d8657592f39f2da0539a35bb1b3ef. I could see the error in the old diary-state-restoration logic. And with the new fix, I'm no longer getting empty diary file droppings in the working directory.