I added unit tests to the *.cc files of a package. After installing the
package I was not able to execute the tests, because the sources could
not be found by the test.m script.
I found the following solution (workaround?): I can save a list of *.cc
and *.oct file names in a src/FILES file of the package. Then, during
package installation the complete sources of the OCT-files will be
copied into the package's installation directory, where the test script
can perfectly find them.
Without the src/FILES list, the *.cc sources are lost during package
installation, this is the part of the configure_make.m file that ignores
m = dir (fullfile (src, "*.m"));
oct = dir (fullfile (src, "*.oct"));
mex = dir (fullfile (src, "*.mex"));
A) The package maintainer has to maintain a src/FILES list, and *.cc
sources are installed to the package installation directory. This
requires no code changes.
B) The configure_make.m script will be extended and also copy *.cc
sources automatically during package installation. There will be no
general need for a src/FILES.
C) During OCT-file compilation (package's Makefile), the relevant test
cases have to be extracted into separate *.cc-tst files. The
configure_make.m script will be extended and also copy *.cc-tst files
automatically during package installation. The test.m script will be
extended and also look for *.cc-tst files, if it is called with “test
Option B is the most simple solution for the package maintainer.
However, with option C life can be made easier for downstream distros,
which do not want to include unnecessary source code in binary package
On Wed, Feb 18, 2015 at 19:59:34 +0100, Oliver Heimlich wrote:
> I added unit tests to the *.cc files of a package. After installing the
> package I was not able to execute the tests, because the sources could not
> be found by the test.m script.
> How should unit tests from packages be installed?
That is correct, there is not currently a solution for tests in source
files of Octave packages.