sgxsdk: use samples as passthru tests

main
Vincent Haupert 3 years ago
parent 007b606892
commit a25482ffa7
  1. 4
      pkgs/os-specific/linux/sgx-sdk/default.nix
  2. 57
      pkgs/os-specific/linux/sgx-sdk/samples.nix

@ -19,7 +19,6 @@
, python3
, texinfo
, validatePkgConfig
, which
, writeShellScript
, writeText
}:
@ -218,7 +217,6 @@ stdenv.mkDerivation rec {
'';
doInstallCheck = true;
installCheckInputs = [ which ];
installCheckPhase = ''
runHook preInstallCheck
@ -242,6 +240,8 @@ stdenv.mkDerivation rec {
postHooks+=(sgxsdk)
'';
passthru.tests = callPackage ./samples.nix { };
meta = with lib; {
description = "Intel SGX SDK for Linux built with IPP Crypto Library";
homepage = "https://github.com/intel/linux-sgx";

@ -0,0 +1,57 @@
{ stdenv
, sgx-sdk
, which
}:
let
buildSample = name: stdenv.mkDerivation rec {
inherit name;
src = sgx-sdk.out;
sourceRoot = "${sgx-sdk.name}/share/SampleCode/${name}";
buildInputs = [
sgx-sdk
];
buildFlags = [
"SGX_MODE=SIM"
];
installPhase = ''
mkdir $out
install -m 755 app $out/app
install *.so $out/
'';
doInstallCheck = true;
installCheckInputs = [ which ];
installCheckPhase = ''
pushd $out
./app
popd
'';
};
in
{
cxx11SGXDemo = buildSample "Cxx11SGXDemo";
localAttestation = (buildSample "LocalAttestation").overrideAttrs (oldAttrs: {
installPhase = ''
mkdir $out
cp -r bin/. $out/
'';
});
powerTransition = (buildSample "PowerTransition").overrideAttrs (oldAttrs: {
# Requires interaction
doInstallCheck = false;
});
remoteAttestation = (buildSample "RemoteAttestation").overrideAttrs (oldAttrs: {
dontFixup = true;
installCheckPhase = ''
echo "a" | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/sample_libcrypto ./app
'';
});
sampleEnclave = buildSample "SampleEnclave";
sampleEnclavePCL = buildSample "SampleEnclavePCL";
sealUnseal = buildSample "SealUnseal";
switchless = buildSample "Switchless";
}
Loading…
Cancel
Save