Unverified Commit 0d20b314 authored by Marcin Serwin's avatar Marcin Serwin
Browse files

shader-slang: add hello-world test



Signed-off-by: default avatarMarcin Serwin <marcin@serwin.dev>
parent f54d1299
Loading
Loading
Loading
Loading
+26 −3
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
  unordered_dense,
  versionCheckHook,
  gitUpdater,
  runCommandCC,

  # Required for compiling to SPIR-V or GLSL
  withGlslang ? true,
@@ -119,10 +120,32 @@ stdenv.mkDerivation (finalAttrs: {
  versionCheckProgramArg = "-v";
  doInstallCheck = true;

  passthru.updateScript = gitUpdater {
  passthru = {
    updateScript = gitUpdater {
      rev-prefix = "v";
      ignoredVersions = "*-draft";
    };
    tests.hello =
      runCommandCC "compile-hello-world"
        {
          # Intermediate files generated by slangc trigger this warning
          NIX_CFLAGS_COMPILE = "-Wno-error=format-security";
        }
        ''
          cat > hello.slang << EOF
          export __extern_cpp int main()
          {
              printf("Hello, world!\n");
              return 0;
          }
          EOF

          ${lib.getExe finalAttrs.finalPackage} hello.slang -target executable -o hello
          ./hello | grep "Hello, world!"

          touch $out
        '';
  };

  meta = {
    description = "Shading language that makes it easier to build and maintain large shader codebases in a modular and extensible fashion";