From 3ddb1c3c0905a5537f820bf6a79991d94eaa93cf Mon Sep 17 00:00:00 2001 From: pca006132 Date: Fri, 23 Feb 2024 14:15:16 +0800 Subject: [PATCH] openscad-unstable: run tests --- pkgs/by-name/op/openscad-unstable/package.nix | 33 +++++++++++---- pkgs/by-name/op/openscad-unstable/test.diff | 42 +++++++++++++++++++ 2 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 pkgs/by-name/op/openscad-unstable/test.diff diff --git a/pkgs/by-name/op/openscad-unstable/package.nix b/pkgs/by-name/op/openscad-unstable/package.nix index 5c97d5e37755..05aaf2dee012 100644 --- a/pkgs/by-name/op/openscad-unstable/package.nix +++ b/pkgs/by-name/op/openscad-unstable/package.nix @@ -15,25 +15,27 @@ , flex , fontconfig , freetype +, ghostscript , glib , glm , gmp , harfbuzz , hidapi , lib3mf -, libGL , libGLU , libICE , libSM , libsForQt5 , libspnav , libzip +, mesa , mpfr , python3 , tbb_2021_8 , wayland , wayland-protocols , wrapGAppsHook +, xorg }: let # get cccl from source to avoid license issues @@ -87,16 +89,17 @@ clangStdenv.mkDerivation rec { hash = "sha256-i2ZGYsNfMLDi3wRd/lohs9BuO2KuQ/7kJIXGtV65OQU="; fetchSubmodules = true; }; + patches = [ ./test.diff ]; nativeBuildInputs = [ - pkg-config - cmake - ninja + (python3.withPackages (ps: with ps; [ numpy pillow ])) bison + cmake flex - python3 libsForQt5.qt5.wrapQtAppsHook llvmPackages.bintools wrapGAppsHook + ninja + pkg-config ]; buildInputs = with libsForQt5; with qt5; [ # manifold dependencies @@ -112,6 +115,7 @@ clangStdenv.mkDerivation rec { eigen fontconfig freetype + ghostscript glib gmp harfbuzz @@ -124,7 +128,15 @@ clangStdenv.mkDerivation rec { qtbase qtmultimedia ] - ++ lib.optionals clangStdenv.isLinux [ libICE libSM libGLU libGL wayland wayland-protocols qtwayland ] + ++ lib.optionals clangStdenv.isLinux [ + xorg.libXdmcp + libICE + libSM + wayland + wayland-protocols + qtwayland + libGLU + ] ++ lib.optional clangStdenv.isDarwin qtmacextras ; cmakeFlags = [ @@ -133,11 +145,18 @@ clangStdenv.mkDerivation rec { "-DUSE_BUILTIN_OPENCSG=ON" # bundled latest opencsg "-DOPENSCAD_VERSION=\"${builtins.replaceStrings ["-"] ["."] version}\"" "-DCMAKE_UNITY_BUILD=ON" # faster build - "-DENABLE_TESTS=OFF" # tests do not work for now # IPO "-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld" "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" ]; + doCheck = true; + checkPhase = '' + # for running mesa llvmpipe + export __EGL_VENDOR_LIBRARY_FILENAMES=${mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json + export LIBGL_DRIVERS_PATH=${mesa.drivers}/lib:${mesa.drivers}/lib/dri + # some fontconfig issues cause pdf output to have wrong font + ctest -j$NIX_BUILD_CORES -E pdfexporttest.\* + ''; meta = with lib; { description = "3D parametric model compiler (unstable)"; longDescription = '' diff --git a/pkgs/by-name/op/openscad-unstable/test.diff b/pkgs/by-name/op/openscad-unstable/test.diff new file mode 100644 index 000000000000..23b3983daddd --- /dev/null +++ b/pkgs/by-name/op/openscad-unstable/test.diff @@ -0,0 +1,42 @@ +diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt +index 5c1b40af4..917451dee 100644 +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -59,13 +59,14 @@ if(USE_IMAGE_COMPARE_PY) + + # Since msys2 on Windows prefers bin/ over Scripts, we need to look for the actual folder to determine + # how to utilize the venv +- find_path(VENV_BIN_PATH activate PATHS "${VENV_DIR}/bin" "${VENV_DIR}/Scripts" NO_DEFAULT_PATH NO_CACHE) +- if(WIN32) +- set(IMAGE_COMPARE_EXE "${VENV_BIN_PATH}/python.exe") +- else() +- set(IMAGE_COMPARE_EXE "${VENV_BIN_PATH}/python") +- endif() +- if(EXISTS "${IMAGE_COMPARE_EXE}") ++ # find_path(VENV_BIN_PATH activate PATHS "${VENV_DIR}/bin" "${VENV_DIR}/Scripts" NO_DEFAULT_PATH NO_CACHE) ++ # if(WIN32) ++ # set(IMAGE_COMPARE_EXE "${VENV_BIN_PATH}/python.exe") ++ # else() ++ # set(IMAGE_COMPARE_EXE "${VENV_BIN_PATH}/python") ++ # endif() ++ set(IMAGE_COMPARE_EXE "python3") ++ # if(EXISTS "${IMAGE_COMPARE_EXE}") + message(STATUS "venv found, testing libraries") + execute_process( + COMMAND "${IMAGE_COMPARE_EXE}" "${CCSD}/image_compare.py" "--status" +@@ -77,10 +78,10 @@ if(USE_IMAGE_COMPARE_PY) + message(STATUS "venv libraries complete") + set(BUILD_VENV FALSE) + endif() +- else() +- message(STATUS "venv not found") +- set(BUILD_VENV TRUE) +- endif() ++ # else() ++ # message(STATUS "venv not found") ++ # set(BUILD_VENV TRUE) ++ # endif() + if(BUILD_VENV) + message(STATUS "Setting up testing venv for image comparison") + execute_process( +