[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#940488: glslang: add autopkgtest smoke-tests



Source: glslang
Version: 7.10.2984-1
Severity: wishlist
Tags: patch

While backporting glslang to an older Debian derivative, I wanted to check
that the backport was basically functional, so I added simple autopkgtests.
Please consider adding something similar.

I attach the patch I used, but I'm sure a more realistic smoke-test (like
making the tools actually compile a shader, not just show help) would
be straightforward for someone who knows this package better than I do!

Thanks,
    smcv
>From d7cdbaa1f73f5dae468f1ad3dcbe4dae80a4e4ea Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Thu, 12 Sep 2019 19:36:12 +0100
Subject: [PATCH] d/tests: Add superficial autopkgtests

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 debian/tests/control       |  9 +++++++++
 debian/tests/glslang-dev   | 37 +++++++++++++++++++++++++++++++++++++
 debian/tests/glslang-tools | 17 +++++++++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 debian/tests/control
 create mode 100755 debian/tests/glslang-dev
 create mode 100755 debian/tests/glslang-tools

diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 00000000..b40ee0ea
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,9 @@
+Tests: glslang-dev
+Restrictions: allow-stderr, superficial
+Depends:
+ glslang-dev,
+
+Tests: glslang-tools
+Restrictions: allow-stderr, superficial
+Depends:
+ glslang-tools,
diff --git a/debian/tests/glslang-dev b/debian/tests/glslang-dev
new file mode 100755
index 00000000..9cb42d7e
--- /dev/null
+++ b/debian/tests/glslang-dev
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Copyright © 2019 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+# (see debian/copyright)
+
+# Check that the library can be linked.
+
+set -e
+set -u
+set -x
+
+tempdir="$(mktemp -d)"
+cd "$tempdir"
+
+cat > trivial.cpp <<'EOF'
+#undef NDEBUG
+#include <cassert>
+
+#include <glslang/Public/ShaderLang.h>
+
+int main (void)
+{
+  ShHandle handle;
+  handle = ShConstructUniformMap();
+  ShDestruct(handle);
+  return 0;
+}
+EOF
+
+# This is hard-coded because there's no pkg-config, but that matches
+# what renderdoc does...
+c++ -std=c++11 -o trivial trivial.cpp -lglslang -lHLSL -lOGLCompiler -lOSDependent -lSPIRV -lpthread
+test -x trivial
+./trivial
+
+cd /
+rm -fr "$tempdir"
diff --git a/debian/tests/glslang-tools b/debian/tests/glslang-tools
new file mode 100755
index 00000000..2445c3ca
--- /dev/null
+++ b/debian/tests/glslang-tools
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Copyright © 2019 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+# (see debian/copyright)
+
+set -eux
+export LC_ALL=C.UTF-8
+
+# For now just check that the executables can run at all. They exit
+# unsuccessfully when asked for help, so screen-scrape the help...
+
+spirv-remap --help 2>&1 | tee "$AUTOPKGTEST_TMP/help"
+grep -q Usage: "$AUTOPKGTEST_TMP/help"
+
+glslangValidator --help 2>&1 | tee "$AUTOPKGTEST_TMP/help"
+grep -q Usage: "$AUTOPKGTEST_TMP/help"
-- 
2.23.0


Reply to: