octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unit tests for package oct-files


From: Oliver Heimlich
Subject: Unit tests for package oct-files
Date: Wed, 18 Feb 2015 19:59:34 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0

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 them:

    else
      m = dir (fullfile (src, "*.m"));
      oct = dir (fullfile (src, "*.oct"));
      mex = dir (fullfile (src, "*.mex"));

      filenames = cellfun (@(x) fullfile (src, x),
                           {m.name, oct.name, mex.name},
                           "uniformoutput", false);
    endif

How should unit tests from packages be installed?

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 <function>”.

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 releases.

Oliver



reply via email to

[Prev in Thread] Current Thread [Next in Thread]