gnu: skia: Honor #:tests? argument.

* gnu/packages/graphics.scm (skia)[arguments]: Skip 'check phase
when #:tests? is false.

Change-Id: I529d91cf9cedfe36fa14a2ae514589810054eac8
Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr>
This commit is contained in:
Dariqq 2024-09-30 20:21:44 +00:00 committed by Tobias Geerinckx-Rice
parent de5fe1fb24
commit 2bd04883ed
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -2223,136 +2223,138 @@ (define skia.pc (string-append #$output
Libs: -L${libdir} -lskia Libs: -L${libdir} -lskia
Cflags: -I${includedir}~%" #$output #$version))))) Cflags: -I${includedir}~%" #$output #$version)))))
(replace 'check (replace 'check
(lambda* (#:key inputs native-inputs #:allow-other-keys) (lambda* (#:key tests? inputs native-inputs #:allow-other-keys)
(let ((icu #$(this-package-native-input "icu4c-for-skia"))) (if tests?
;; Unbundle SPIRV-Tools dependency. (let ((icu #$(this-package-native-input "icu4c-for-skia")))
(substitute* "BUILD.gn" ;; Unbundle SPIRV-Tools dependency.
(("deps \\+= \\[ \"//third_party/externals/spirv-tools:spvtools_val\" \\]") (substitute* "BUILD.gn"
"libs += [ \"SPIRV-Tools\" ]")) (("deps \\+= \\[ \"//third_party/externals/spirv-tools:spvtools_val\" \\]")
(substitute* "src/sksl/SkSLCompiler.cpp" "libs += [ \"SPIRV-Tools\" ]"))
(("\"spirv-tools/libspirv.hpp\"") (substitute* "src/sksl/SkSLCompiler.cpp"
"<libspirv.hpp>")) (("\"spirv-tools/libspirv.hpp\"")
;; Configure ICU dependency. "<libspirv.hpp>"))
(substitute* "third_party/icu/BUILD.gn" ;; Configure ICU dependency.
(("data_dir = \"\\.\\./externals/icu/\"") (substitute* "third_party/icu/BUILD.gn"
(string-append "data_dir = \"" icu "/share/data/\"")) (("data_dir = \"\\.\\./externals/icu/\"")
(("script = \"\\.\\./externals/icu/scripts/") (string-append "data_dir = \"" icu "/share/data/\""))
(string-append "script = \"" icu "/share/scripts/")) (("script = \"\\.\\./externals/icu/scripts/")
(("\\.\\./externals/icu/common/icudtl\\.dat") (string-append "script = \"" icu "/share/scripts/"))
(string-append icu "/share/data/icudtl.dat")) (("\\.\\./externals/icu/common/icudtl\\.dat")
(("sources = icu_sources") (string-append icu "/share/data/icudtl.dat"))
"") (("sources = icu_sources")
(("sources \\+= \\[ \"\\$data_assembly\" \\]") "")
"sources = [ \"$data_assembly\" ]")) (("sources \\+= \\[ \"\\$data_assembly\" \\]")
;; Enable system libraries without is_official_build=true. "sources = [ \"$data_assembly\" ]"))
;; This is necessary because is_official_build prevents from ;; Enable system libraries without is_official_build=true.
;; building dm. ;; This is necessary because is_official_build prevents from
(for-each ;; building dm.
(lambda (libname) (for-each
(let ((snake (string-join (string-split libname #\-) "_"))) (lambda (libname)
(substitute* (let ((snake (string-join (string-split libname #\-) "_")))
(string-append "third_party/" libname "/BUILD.gn") (substitute*
(((string-append "skia_use_system_" (string-append "third_party/" libname "/BUILD.gn")
snake (((string-append "skia_use_system_"
" = is_official_build.*")) snake
(string-append "skia_use_system_" snake " = true"))))) " = is_official_build.*"))
'("zlib" "libjpeg-turbo" "harfbuzz" "libpng" "libwebp")) (string-append "skia_use_system_" snake " = true")))))
;; Configure with gn. '("zlib" "libjpeg-turbo" "harfbuzz" "libpng" "libwebp"))
(invoke "gn" "gen" "out/Debug" ;; Configure with gn.
(string-append (invoke "gn" "gen" "out/Debug"
"--args=" (string-append
"cc=\"gcc\" " ;defaults to 'cc' "--args="
"skia_compile_sksl_tests=false " ; disable some tests "cc=\"gcc\" " ;defaults to 'cc'
"skia_use_perfetto=false " ; disable performance tests "skia_compile_sksl_tests=false " ; disable some tests
"skia_use_wuffs=false " ; missing performance tool "skia_use_perfetto=false " ; disable performance tests
"skia_use_system_expat=true " ; use system expat library "skia_use_wuffs=false " ; missing performance tool
"skia_use_system_zlib=true " ; use system zlib library "skia_use_system_expat=true " ; use system expat library
;; Specify where to locate the includes. "skia_use_system_zlib=true " ; use system zlib library
"extra_cflags=[" ;; Specify where to locate the includes.
(string-join "extra_cflags=["
(map (string-join
(lambda (lib) (map
(string-append (lambda (lib)
"\"-I" (string-append
(search-input-directory "\"-I"
inputs (search-input-directory
(string-append "include/" lib)) "\"")) inputs
'("harfbuzz" (string-append "include/" lib)) "\""))
"freetype2" '("harfbuzz"
"spirv-tools" "freetype2"
"spirv" "spirv-tools"
"unicode")) "spirv"
",") "unicode"))
"] " ",")
;; Otherwise the validate-runpath phase fails. "] "
"extra_ldflags=[" ;; Otherwise the validate-runpath phase fails.
"\"-Wl,-rpath=" #$output "/lib\"" "extra_ldflags=["
"] " "\"-Wl,-rpath=" #$output "/lib\""
;; Disabled, otherwise the build system attempts to "] "
;; download the SDK at build time. ;; Disabled, otherwise the build system attempts to
"skia_use_dng_sdk=false " ;; download the SDK at build time.
"skia_use_runtime_icu=true ")) "skia_use_dng_sdk=false "
;; Build dm testing tool. "skia_use_runtime_icu=true "))
(symlink ;; Build dm testing tool.
(string-append #$(this-package-native-input "gn") "/bin/gn") (symlink
"./bin/gn") (string-append #$(this-package-native-input "gn") "/bin/gn")
(invoke "ninja" "-C" "out/Debug" "dm") "./bin/gn")
;; The test suite requires an X server. (invoke "ninja" "-C" "out/Debug" "dm")
(let ((xvfb (search-input-file (or native-inputs inputs) ;; The test suite requires an X server.
"bin/Xvfb")) (let ((xvfb (search-input-file (or native-inputs inputs)
(display ":1")) "bin/Xvfb"))
(setenv "DISPLAY" display) (display ":1"))
(system (string-append xvfb " " display " &"))) (setenv "DISPLAY" display)
;; Run tests. (system (string-append xvfb " " display " &")))
(invoke "out/Debug/dm" "-v" ;; Run tests.
"-w" "dm_output" (invoke "out/Debug/dm" "-v"
"--codecWritePath" "dm_output" "-w" "dm_output"
"--simpleCodec" "--codecWritePath" "dm_output"
"--skip" "--simpleCodec"
;; The underscores are part of the dm syntax for "--skip"
;; skipping tests. ;; The underscores are part of the dm syntax for
;; These tests fail with segmentation fault. ;; skipping tests.
"_" "_" "_" "Codec_trunc" ;; These tests fail with segmentation fault.
"_" "_" "_" "AnimCodecPlayer" "_" "_" "_" "Codec_trunc"
"_" "_" "_" "Codec_partialAnim" "_" "_" "_" "AnimCodecPlayer"
"_" "_" "_" "Codec_InvalidImages" "_" "_" "_" "Codec_partialAnim"
"_" "_" "_" "Codec_GifInterlacedTruncated" "_" "_" "_" "Codec_InvalidImages"
;; This test started failing possibly after mesa "_" "_" "_" "Codec_GifInterlacedTruncated"
;; being updated to 23.2.1 and possibly only on some ;; This test started failing possibly after mesa
;; hardware. ;; being updated to 23.2.1 and possibly only on some
"_" "_" "_" "SkRuntimeBlender_GPU" ;; hardware.
"_" "_" "_" "SkText_UnicodeText_Flags" "_" "_" "_" "SkRuntimeBlender_GPU"
"_" "_" "_" "SkParagraph_FontStyle" "_" "_" "_" "SkText_UnicodeText_Flags"
"_" "_" "_" "flight_animated_image" "_" "_" "_" "SkParagraph_FontStyle"
;; These tests fail because of Codec/Sk failure. "_" "_" "_" "flight_animated_image"
"_" "_" "_" "AndroidCodec_computeSampleSize" ;; These tests fail because of Codec/Sk failure.
"_" "_" "_" "AnimatedImage_invalidCrop" "_" "_" "_" "AndroidCodec_computeSampleSize"
"_" "_" "_" "AnimatedImage_scaled" "_" "_" "_" "AnimatedImage_invalidCrop"
"_" "_" "_" "AnimatedImage_copyOnWrite" "_" "_" "_" "AnimatedImage_scaled"
"_" "_" "_" "AnimatedImage" "_" "_" "_" "AnimatedImage_copyOnWrite"
"_" "_" "_" "BRD_types" "_" "_" "_" "AnimatedImage"
"_" "_" "_" "Codec_frames" "_" "_" "_" "BRD_types"
"_" "_" "_" "Codec_partial" "_" "_" "_" "Codec_frames"
"_" "_" "_" "Codec_partialWuffs" "_" "_" "_" "Codec_partial"
"_" "_" "_" "Codec_requiredFrame" "_" "_" "_" "Codec_partialWuffs"
"_" "_" "_" "Codec_rewind" "_" "_" "_" "Codec_requiredFrame"
"_" "_" "_" "Codec_incomplete" "_" "_" "_" "Codec_rewind"
"_" "_" "_" "Codec_InvalidAnimated" "_" "_" "_" "Codec_incomplete"
"_" "_" "_" "Codec_ossfuzz6274" "_" "_" "_" "Codec_InvalidAnimated"
"_" "_" "_" "Codec_gif_out_of_palette" "_" "_" "_" "Codec_ossfuzz6274"
"_" "_" "_" "Codec_xOffsetTooBig" "_" "_" "_" "Codec_gif_out_of_palette"
"_" "_" "_" "Codec_gif" "_" "_" "_" "Codec_xOffsetTooBig"
"_" "_" "_" "Codec_skipFullParse" "_" "_" "_" "Codec_gif"
"_" "_" "_" "AndroidCodec_animated_gif" "_" "_" "_" "Codec_skipFullParse"
;; These fail for unknown reasons. "_" "_" "_" "AndroidCodec_animated_gif"
"_" "_" "_" "Gif" ;; These fail for unknown reasons.
"_" "_" "_" "Wuffs_seek_and_decode" "_" "_" "_" "Gif"
"_" "_" "_" "Skottie_Shaper_ExplicitFontMgr" "_" "_" "_" "Wuffs_seek_and_decode"
"8888" "skp" "_" "_" "_" "_" "_" "Skottie_Shaper_ExplicitFontMgr"
"8888" "lottie" "_" "_" "8888" "skp" "_" "_"
"gl" "skp" "_" "_" "8888" "lottie" "_" "_"
"gl" "lottie" "_" "_" "gl" "skp" "_" "_"
"_" "_" "_" "ES2BlendWithNoTexture"))))))) "gl" "lottie" "_" "_"
"_" "_" "_" "ES2BlendWithNoTexture"))
(format #t "test suite not run~%")))))))
(native-inputs (list gn libjpeg-turbo ninja pkg-config python-wrapper (native-inputs (list gn libjpeg-turbo ninja pkg-config python-wrapper
spirv-tools spirv-headers spirv-tools spirv-headers
icu4c-for-skia glu xorg-server-for-tests)) icu4c-for-skia glu xorg-server-for-tests))