diff --git a/pkgs/by-name/ad/adaptivecpp/package.nix b/pkgs/by-name/ad/adaptivecpp/package.nix index c0663597a5adc4..17f41b4146b838 100644 --- a/pkgs/by-name/ad/adaptivecpp/package.nix +++ b/pkgs/by-name/ad/adaptivecpp/package.nix @@ -18,6 +18,7 @@ autoAddDriverRunpath, callPackage, symlinkJoin, + runCommand, nix-update-script, }: let @@ -99,9 +100,25 @@ stdenv.mkDerivation (finalAttrs: { # For tests inherit (finalAttrs) nativeBuildInputs buildInputs; - tests = { - sycl = callPackage ./tests.nix { }; - }; + tests = + let + runner = callPackage ./tests.nix { }; + run = cmd: runCommand cmd { } '' + # the test runner wants to write to $HOME/.acpp, so we need to have it point to a real directory + mkdir home + export HOME=`pwd`/home + + ${runner}/bin/${cmd} && touch $out + ''; + in + { + inherit runner; + sycl = run "sycl_tests"; + rt = run "rt_tests"; + deviceCompilation = run "device_compilation_tests"; + dump = run "dump_tests"; + platformApi = run "platform_api"; + }; updateScript = nix-update-script { }; }; diff --git a/pkgs/by-name/ad/adaptivecpp/tests.nix b/pkgs/by-name/ad/adaptivecpp/tests.nix index 572f56696aec8e..5d8ffa6c98f0a0 100644 --- a/pkgs/by-name/ad/adaptivecpp/tests.nix +++ b/pkgs/by-name/ad/adaptivecpp/tests.nix @@ -2,11 +2,12 @@ lib, stdenv, adaptivecpp, - # within the nix sandbox, the tests will likely be unable to access the gpu. - # for now we just test omp by default as a sanity check, - # however the bulk of work in acpp focuses on the generic target, so we want to switch to that. - targetsBuild ? "omp", - targetsRun ? "omp", + # Within the nix sandbox, and on the CI especially, the tests will likely be unable to access a gpu. + # While the CI won't be able to test on a GPU, we can do a sanity check with OMP atleast + # + # The bulk of work in acpp focuses on the generic target, so we want to test that first and foremost. + # Not setting an explicit target makes it default to the generic target. + targets ? null, }: stdenv.mkDerivation (finalAttrs: { pname = "${adaptivecpp.pname}-tests"; @@ -21,25 +22,23 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ - # see above "-DAdaptiveCpp_DIR=${adaptivecpp}/lib/cmake/AdaptiveCpp" ] - ++ lib.optionals (targetsBuild != null) [ - "-DACCP_TARGETS=\"${targetsBuild}\"" + ++ lib.optionals (targets!= null) [ + "-DACCP_TARGETS=\"${targets}\"" ]; - doCheck = true; - checkPhase = '' - # the test runner wants to write to $HOME/.acpp, so we need to have it point to a real directory - mkdir home - export HOME=`pwd`/home + doCheck = false; - ${lib.strings.optionalString (targetsRun != null) "export ACPP_VISIBILITY_MASK=\"${targetsRun}\""} - ./sycl_tests + installPhase = '' + mkdir $out + install -Dm755 sycl_tests -t $out/bin/ + install -Dm755 rt_tests -t $out/bin/ + install -Dm755 device_compilation_tests -t $out/bin/ + install -Dm755 dump_test/dump_test -t $out/bin/ + install -Dm755 platform_api/platform_api -t $out/bin/ ''; - installPhase = "touch $out"; - # currently fails to build # see https://logs.ofborg.org/?key=nixos/nixpkgs.360893&attempt_id=3b1feb45-0b7d-4cf1-8e38-917afcc12c67 meta.broken = stdenv.isDarwin;