mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-21 16:11:22 +00:00
zenroom: enable tests (#543911)
This commit is contained in:
@@ -14,16 +14,24 @@
|
||||
|
||||
# tests
|
||||
callPackage,
|
||||
jq,
|
||||
meson,
|
||||
ninja,
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.hostPlatform)
|
||||
isDarwin
|
||||
isLinux
|
||||
isMusl
|
||||
isUnix
|
||||
;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "zenroom";
|
||||
version = "5.37.2";
|
||||
|
||||
__structuredAttrs = true;
|
||||
dontUseCmakeConfigure = true; # cmake is a dependency, but we use make to build
|
||||
strictDeps = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dyne";
|
||||
repo = "Zenroom";
|
||||
@@ -38,9 +46,22 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs build/embed-lualibs
|
||||
patchShebangs build/{embed-lualibs,meson_version.sh}
|
||||
patchShebangs test/
|
||||
'';
|
||||
|
||||
__structuredAttrs = true;
|
||||
strictDeps = true;
|
||||
|
||||
# cmake is required to build dependencies, not the main package
|
||||
dontUseCmakeConfigure = true;
|
||||
|
||||
# manually invoken while testing
|
||||
dontUseMesonConfigure = true;
|
||||
dontUseNinjaBuild = true;
|
||||
dontUseNinjaCheck = true;
|
||||
dontUseNinjaInstall = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
which # ar
|
||||
@@ -51,23 +72,27 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
readline
|
||||
];
|
||||
|
||||
buildFlags =
|
||||
with stdenv.hostPlatform;
|
||||
lib.optionals (isLinux && !isMusl) [
|
||||
"linux-lib"
|
||||
"linux-exe"
|
||||
]
|
||||
++ lib.optionals (isLinux && isMusl) [
|
||||
"musl"
|
||||
]
|
||||
++ lib.optionals isDarwin [
|
||||
"osx-lib"
|
||||
"osx-exe"
|
||||
]
|
||||
++ lib.optionals (isUnix && !isLinux && !isDarwin) [
|
||||
"posix-lib"
|
||||
"posix-exe"
|
||||
];
|
||||
buildFlags = [
|
||||
"VERSION=${finalAttrs.version}"
|
||||
"COMMIT=0000000"
|
||||
"BRANCH=master"
|
||||
"CURRENT_YEAR=1970" # unix epoch
|
||||
]
|
||||
++ lib.optionals (isLinux && !isMusl) [
|
||||
"linux-lib"
|
||||
"linux-exe"
|
||||
]
|
||||
++ lib.optionals (isLinux && isMusl) [
|
||||
"musl"
|
||||
]
|
||||
++ lib.optionals isDarwin [
|
||||
"osx-lib"
|
||||
"osx-exe"
|
||||
]
|
||||
++ lib.optionals (isUnix && !isLinux && !isDarwin) [
|
||||
"posix-lib"
|
||||
"posix-exe"
|
||||
];
|
||||
|
||||
hardeningDisable = [ "format" ]; # -Werror=format-security
|
||||
|
||||
@@ -82,11 +107,30 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
install -D libzenroom${stdenv.hostPlatform.extensions.sharedLibrary} -t $out/lib
|
||||
'';
|
||||
|
||||
nativeCheckInputs = [
|
||||
jq
|
||||
meson
|
||||
ninja
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
checkTarget = "check" + lib.optionalString isDarwin "-osx";
|
||||
|
||||
preCheck =
|
||||
lib.optionalString isDarwin # sh
|
||||
''
|
||||
# on darwin, we're using GNU base64
|
||||
substituteInPlace test/zencode/cookbook_{hash_pdf,ecdh_encrypt_json}.bats \
|
||||
--replace-fail \
|
||||
'cmd_base64="base64 -b 0"' \
|
||||
'cmd_base64="base64 -w 0"'
|
||||
'';
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
passthru.tests = callPackage ./tests { zenroom = finalAttrs.finalPackage; };
|
||||
|
||||
meta = {
|
||||
description = "no-code cryptographic virtual machine";
|
||||
description = "No-code cryptographic virtual machine";
|
||||
longDescription = ''
|
||||
Zenroom is a tiny, portable, and fully isolated crypto VM for building
|
||||
privacy-preserving applications, smart contracts, and secure data
|
||||
|
||||
Reference in New Issue
Block a user