diff options
author | 2017-08-22 11:02:51 +0200 | |
---|---|---|
committer | 2017-08-24 15:00:22 -0400 | |
commit | 084a5771a359da6a083e8f11169ccfdff6066abd (patch) | |
tree | 2297651b85e1cbff988d494121ef0c8690f92cde /ebuild-writing/functions | |
parent | ebuild-writing/.../src_test: Update the default implementation (diff) | |
download | devmanual-084a5771a359da6a083e8f11169ccfdff6066abd.tar.gz devmanual-084a5771a359da6a083e8f11169ccfdff6066abd.tar.bz2 devmanual-084a5771a359da6a083e8f11169ccfdff6066abd.zip |
ebuild-writing/.../src_test: Provide a detailed solution for X11 requirement
Diffstat (limited to 'ebuild-writing/functions')
-rw-r--r-- | ebuild-writing/functions/src_test/text.xml | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ebuild-writing/functions/src_test/text.xml b/ebuild-writing/functions/src_test/text.xml index 5d1ba3f..bd8f297 100644 --- a/ebuild-writing/functions/src_test/text.xml +++ b/ebuild-writing/functions/src_test/text.xml @@ -63,6 +63,50 @@ src_test() { </section> <section> +<title>Tests that require X11</title> +<body> +<p> +Some packages include tests (or other build-time applications) that +attempt to use the user's X11 session and fail being unable to connect +to it. Those tests need to be fixed to work independently of the X11 +server that might or might not be running when packages are being built. +</p> + +<p> +If the program in question does not strictly need X11 but merely +attempts to take opportunity of the <c>DISPLAY</c> variable being set, +the best solution is to simply unset this variable in the ebuild. +</p> + +<codesample lang="ebuild"> +src_test() { + # tests attempt to connect to X11 and fail when it is set + # however, they work just fine without X11 + unset DISPLAY + + default +} +</codesample> + +<p> +If the package actually requires a running X11 server to run +the complete test suite, you can use the <c>virtualx</c> eclass to +provide an isolated Xvfb environment for the tests to use. It provides +a virtual X11 display that is not connected to any physical device +and that programs can use reliably. +</p> + +<codesample lang="ebuild"> +inherit virtualx + +src_test() { + virtx default +} +</codesample> +</body> +</section> + +<section> <title>Common <c>src_test</c> Tasks</title> <body> <p> |