Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 85 lines 2.6 kB view raw
1{ 2 opencv4, 3 testDataSrc, 4 stdenv, 5 lib, 6 runCommand, 7 gst_all_1, 8 runAccuracyTests, 9 runPerformanceTests, 10 enableGStreamer, 11 enableGtk2, 12 enableGtk3, 13 xvfb-run, 14}: 15let 16 testNames = 17 [ 18 "calib3d" 19 "core" 20 "features2d" 21 "flann" 22 "imgcodecs" 23 "imgproc" 24 "ml" 25 "objdetect" 26 "photo" 27 "stitching" 28 "video" 29 #"videoio" # - a lot of GStreamer warnings and failed tests 30 #"dnn" #- some caffe tests failed, probably because github workflow also downloads additional models 31 ] 32 ++ lib.optionals (!stdenv.hostPlatform.isAarch64 && enableGStreamer) [ "gapi" ] 33 ++ lib.optionals (enableGtk2 || enableGtk3) [ "highgui" ]; 34 perfTestNames = [ 35 "calib3d" 36 "core" 37 "features2d" 38 "imgcodecs" 39 "imgproc" 40 "objdetect" 41 "photo" 42 "stitching" 43 "video" 44 ] ++ lib.optionals (!stdenv.hostPlatform.isAarch64 && enableGStreamer) [ "gapi" ]; 45 testRunner = lib.optionalString (!stdenv.hostPlatform.isDarwin) "${lib.getExe xvfb-run} -a "; 46 testsPreparation = '' 47 touch $out 48 # several tests want a write access, so we have to copy files 49 tmpPath="$(mktemp -d "/tmp/opencv_extra_XXXXXX")" 50 cp -R ${testDataSrc} $tmpPath/opencv_extra 51 chmod -R +w $tmpPath/opencv_extra 52 export OPENCV_TEST_DATA_PATH="$tmpPath/opencv_extra/testdata" 53 export OPENCV_SAMPLES_DATA_PATH="${opencv4.package_tests}/samples/data" 54 55 # ignored tests because of gtest error - "Test code is not available due to compilation error with GCC 11" 56 # ignore test due to numerical instability 57 export GTEST_FILTER="-AsyncAPICancelation/cancel*:Photo_CalibrateDebevec.regression" 58 ''; 59 accuracyTests = lib.optionalString runAccuracyTests '' 60 ${builtins.concatStringsSep "\n" ( 61 map ( 62 test: 63 "${testRunner}${opencv4.package_tests}/opencv_test_${test} --test_threads=$NIX_BUILD_CORES --gtest_filter=$GTEST_FILTER" 64 ) testNames 65 )} 66 ''; 67 performanceTests = lib.optionalString runPerformanceTests '' 68 ${builtins.concatStringsSep "\n" ( 69 map ( 70 test: 71 "${testRunner}${opencv4.package_tests}/opencv_perf_${test} --perf_impl=plain --perf_min_samples=10 --perf_force_samples=10 --perf_verify_sanity --skip_unstable=1 --gtest_filter=$GTEST_FILTER" 72 ) perfTestNames 73 )} 74 ''; 75in 76runCommand "opencv4-tests" { 77 nativeBuildInputs = lib.optionals enableGStreamer ( 78 with gst_all_1; 79 [ 80 gstreamer 81 gst-plugins-base 82 gst-plugins-good 83 ] 84 ); 85} (testsPreparation + accuracyTests + performanceTests)