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

Re: using package tests

If upstream provide a test script, you can use "Test-Command" to call it from autopkgtest.

Daniel Leidert wrote:
However there is a restriction called 'build-needed' which I guess
is for cases where you rely on something inside the source.

Tests always have the source available, and start in the directory containing it ([0] line 28).

"build-needed" builds the source before running the tests, to also allow access to test executables built by the source package but not installed into its binary package(s) ([0] line 211).

Depending on the
tests run it is possible that tests rely on files inside the source and not the
installed package (that's why e.g. the defaukt ruby tests move the lib/
dorectofry in the source away during the tests).

It is OK to load the tests themselves from the source tree, but the program/library under test should be loaded from the installed package, not the source ([0] line 30).

Some interpreted languages (e.g. Python [1]) search the current directory before the system modules directory, and hence default to loading the module under test from source. One way to avoid this is to change directory to $AUTOPKGTEST_TMP before starting the test [2].

(The source tree is read-only ([0] line 32), so the files Ruby moves [3] probably aren't it.)

[0] https://sources.debian.org/src/autopkgtest/5.12.1/doc/README.package-tests.rst
[1] https://docs.python.org/3/library/sys.html#sys.path
[2] https://sources.debian.org/src/autodep8/0.22/support/python/generate/#L71 [3] https://sources.debian.org/src/gem2deb/1.0.5/lib/gem2deb/test_runner.rb/#L182

Reply to: