Commit fded5825 authored by Sebastian Neubauer's avatar Sebastian Neubauer
Browse files

rocm-opencl-icd: add nixos test

parent 76a4adc1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
{ lib, stdenv, rocm-opencl-runtime }:
{ lib, callPackage, stdenv, rocm-opencl-runtime }:

stdenv.mkDerivation rec {
  pname = "rocm-opencl-icd";
@@ -11,6 +11,8 @@ stdenv.mkDerivation rec {
    echo "${rocm-opencl-runtime}/lib/libamdocl64.so" > $out/etc/OpenCL/vendors/amdocl64.icd
  '';

  passthru.impureTests = { rocm-opencl = callPackage ./test.nix {}; };

  meta = with lib; {
    description = "OpenCL ICD definition for AMD GPUs using the ROCm stack";
    license = licenses.mit;
+19 −0
Original line number Diff line number Diff line
{ lib, makeImpureTest, clinfo, rocm-opencl-icd, rocm-smi }:
makeImpureTest {
  name = "rocm-opencl";
  testedPackage = "rocm-opencl-icd";

  nativeBuildInputs = [ clinfo rocm-smi ];

  OCL_ICD_VENDORS = "${rocm-opencl-icd}/etc/OpenCL/vendors/";

  testScript = ''
    # Test fails if the number of platforms is 0
    clinfo | grep -E 'Number of platforms * [1-9]'
    rocm-smi | grep -A1 GPU
  '';

  meta = with lib; {
    maintainers = teams.rocm.members;
  };
}