gnu: mediastreamer2: Enable tests.

* gnu/packages/linphone.scm (mediastreamer2)
[arguments]: Remove tests? argument, enabling tests.
[phases]{pre-check}: New phase.
{check}: Replace with custom phase.
[native-inputs]: Add xorg-server-for-tests.

Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
Raghav Gururajan 2021-03-16 16:56:25 -04:00 committed by Maxim Cournoyer
parent 146a9403b3
commit 0c6f7d8396
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -532,8 +532,7 @@ (define-public mediastreamer2
(outputs '("out" "doc" "tester")) (outputs '("out" "doc" "tester"))
(build-system cmake-build-system) (build-system cmake-build-system)
(arguments (arguments
`(#:tests? #f ; No test target `(#:configure-flags (list "-DENABLE_STATIC=NO")
#:configure-flags (list "-DENABLE_STATIC=NO")
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(add-after 'unpack 'fix-version (add-after 'unpack 'fix-version
@ -541,6 +540,14 @@ (define-public mediastreamer2
(substitute* "CMakeLists.txt" (substitute* "CMakeLists.txt"
(("VERSION [0-9]+\\.[0-9]+\\.[0-9]+") (("VERSION [0-9]+\\.[0-9]+\\.[0-9]+")
(string-append "VERSION " ,version))))) (string-append "VERSION " ,version)))))
(add-before 'check 'pre-check
(lambda _
;; Tests require a running X server.
(system "Xvfb :1 +extension GLX &")
(setenv "DISPLAY" ":1")
;; Tests write to $HOME.
(setenv "HOME" (getenv "TEMP"))))
(delete 'check) ;move after install
(add-after 'install 'separate-outputs (add-after 'install 'separate-outputs
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
@ -552,19 +559,37 @@ (define-public mediastreamer2
(list (string-append tester "/bin") (list (string-append tester "/bin")
(string-append tester "/share") (string-append tester "/share")
(string-append doc "/share/doc"))) (string-append doc "/share/doc")))
;; Copy the tester executable. ;; Move the tester executable.
(rename-file (string-append out "/bin/" tester-name) (rename-file (string-append out "/bin/" tester-name)
(string-append tester "/bin/" tester-name)) (string-append tester "/bin/" tester-name))
;; Copy the tester data files. ;; Move the tester data files.
(rename-file (string-append out "/share/" tester-name) (rename-file (string-append out "/share/" tester-name)
(string-append tester "/share/" tester-name)) (string-append tester "/share/" tester-name))
;; Copy the HTML documentation. ;; Move the HTML documentation.
(rename-file (string-append out "/share/doc/" doc-name) (rename-file (string-append out "/share/doc/" doc-name)
(string-append doc "/share/doc/" doc-name)))))))) (string-append doc "/share/doc/" doc-name)))))
(add-after 'separate-outputs 'check
(lambda* (#:key outputs #:allow-other-keys)
(let ((tester (string-append (assoc-ref outputs "tester")
"/bin/mediastreamer2_tester")))
(for-each (lambda (suite-name)
(invoke tester "--suite" suite-name))
;; Some tests fail, due to requiring access to the
;; sound card or the network.
(list "Basic Audio"
;; "Sound Card"
;; "AdaptiveAlgorithm"
;; "AudioStream"
;; "VideoStream"
"H26x Tools"
"Framework"
;; "Player"
"TextStream"))))))))
(native-inputs (native-inputs
`(("dot" ,graphviz) `(("dot" ,graphviz)
("doxygen" ,doxygen) ("doxygen" ,doxygen)
("python" ,python-wrapper))) ("python" ,python-wrapper)
("xorg-server" ,xorg-server-for-tests)))
(inputs (inputs
`(("alsa" ,alsa-lib) `(("alsa" ,alsa-lib)
("bcg729" ,bcg729) ("bcg729" ,bcg729)