Skip to contentSkip to conversation

Test Descriptions

PATCH New Thomas Wood 1 participant 7 messages Oct 30, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Test Descriptions

The following patch series fixes various issues with the previous series and also adds support for the "--help-description" option to testdisplay and the shell script based tests.

Thomas Wood (6):
lib: add the ability to include a description with a test
docs: add some test descriptions
Build the docs directory last
docs: include descriptions for the test programs
testdisplay: add a test description tests/drm_lib.sh: add a "--help-description" option

 Makefile.am                                        |  4 +-
 docs/reference/intel-gpu-tools/.gitignore          |  1 +
 docs/reference/intel-gpu-tools/Makefile.am         | 27 +++++++--
 .../intel-gpu-tools/igt_test_programs.xml.header   | 65 ++++++++++++++++++++++
 .../intel-gpu-tools/intel-gpu-tools-docs.xml       |  1 +
 lib/igt_core.c                                     | 19 ++++++-
 lib/igt_core.h                                     | 12 ++++
 tests/core_getclient.c                             |  5 +-
 tests/core_getstats.c                              |  3 +
 tests/core_getversion.c                            |  6 +-
 tests/drm_lib.sh                                   |  5 ++
 tests/kms_3d.c                                     |  2 +
 tests/kms_cursor_crc.c                             |  8 +++
 tests/kms_fbc_crc.c                                |  5 ++
 tests/kms_fence_pin_leak.c                         |  3 +
 tests/kms_flip_event_leak.c                        | 12 ++--
 tests/testdisplay.c                                |  6 ++
 17 files changed, 164 insertions(+), 20 deletions(-)
 create mode 100644 docs/reference/intel-gpu-tools/igt_test_programs.xml.header
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v2 1/6 lib: add the ability to include a description with a test

The IGT_TEST_DESCRIPTION macro can be used to define a description for a test.

v2: Remove semicolon from end of macro (Damien Lespiau)
Add API documentation for the macro.

---
 lib/igt_core.c | 19 ++++++++++++++++---
 lib/igt_core.h | 12 ++++++++++++
 2 files changed, 28 insertions(+), 3 deletions(-)
lib/igt_core.c +16 -3
index e3d5fb0..3861121 100644
@@ -223,6 +223,7 @@ bool test_child;
 enum {
  OPT_LIST_SUBTESTS,
  OPT_RUN_SUBTEST,
+ OPT_DESCRIPTION,
  OPT_DEBUG,
  OPT_HELP = 'h'
 };
@@ -360,6 +361,12 @@ static void common_exit_handler(int sig)
 	assert(sig != 0 || igt_exit_called);
 }
 
+static void print_test_description(void)
+{
+	if (&__igt_test_description)
+		printf("%s\n", __igt_test_description);
+}
+
 static void print_version(void)
 {
 	struct utsname uts;
@@ -380,11 +387,12 @@ static void print_usage(const char *help_str, bool output_on_stderr)
 {
 	FILE *f = output_on_stderr ? stderr : stdout;
 
-	fprintf(f, "Usage: %s [OPTIONS]\n"
-		   "  --list-subtests\n"
+	fprintf(f, "Usage: %s [OPTIONS]\n", command_str);
+	fprintf(f, "  --list-subtests\n"
 		   "  --run-subtest <pattern>\n"
 		   "  --debug\n"
-		   "  --help\n", command_str);
+		   "  --help-description\n"
+		   "  --help\n");
 	if (help_str)
 		fprintf(f, "%s\n", help_str);
 }
@@ -413,6 +421,7 @@ static int common_init(int argc, char **argv,
 	static struct option long_options[] = {
 		{"list-subtests", 0, 0, OPT_LIST_SUBTESTS},
 		{"run-subtest", 1, 0, OPT_RUN_SUBTEST},
+		{"help-description", 0, 0, OPT_DESCRIPTION},
 		{"debug", 0, 0, OPT_DEBUG},
 		{"help", 0, 0, OPT_HELP},
 		{0, 0, 0, 0}
@@ -510,6 +519,10 @@ static int common_init(int argc, char **argv,
 			if (!list_subtests)
 				run_single_subtest = strdup(optarg);
 			break;
+		case OPT_DESCRIPTION:
+			print_test_description();
+			ret = -1;
+			goto out;
 		case OPT_HELP:
 			print_usage(help_str, false);
 			ret = -1;
lib/igt_core.h +12 -0
index b8f6702..69e54d8 100644
@@ -38,6 +38,18 @@
 #include <stdarg.h>
 #include <getopt.h>
 
+extern const char* __igt_test_description __attribute__((weak));
+
+/**
+ * IGT_TEST_DESCRIPTION:
+ * @str: description string
+ *
+ * Defines a description for a test. This is used as the output for the
+ * "--help-description" option and is also included in the generated
+ * documentation.
+ */
+#define IGT_TEST_DESCRIPTION(str) const char* __igt_test_description = str
+
 /**
  * IGT_EXIT_TIMEOUT:
  *
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v2 2/6 docs: add some test descriptions

In reply to Thomas Wood
---
 tests/core_getclient.c      |  5 ++---
 tests/core_getstats.c       |  3 +++
 tests/core_getversion.c     |  6 +++---
 tests/kms_3d.c              |  2 ++
 tests/kms_cursor_crc.c      |  8 ++++++++
 tests/kms_fbc_crc.c         |  5 +++++
 tests/kms_fence_pin_leak.c  |  3 +++
 tests/kms_flip_event_leak.c | 12 ++++++------
 8 files changed, 32 insertions(+), 12 deletions(-)
tests/core_getclient.c +2 -3
index ed46e51..7598e0f 100644
@@ -32,9 +32,8 @@
 
 #include "drmtest.h"
 
-/**
- * Checks DRM_IOCTL_GET_CLIENT.
- */
+IGT_TEST_DESCRIPTION("Tests the DRM_IOCTL_GET_CLIENT ioctl.");
+
 igt_simple_main
 {
 	int fd, ret;
tests/core_getstats.c +3 -0
index 1e2c565..52a2d20 100644
@@ -40,6 +40,9 @@
  * I don't care too much about the actual contents, just that the kernel
  * doesn't crash.
  */
+
+IGT_TEST_DESCRIPTION("Tests the DRM_IOCTL_GET_STATS ioctl.");
+
 igt_simple_main
 {
 	int fd, ret;
tests/core_getversion.c +3 -3
index 7058c89..30132e4 100644
@@ -29,9 +29,9 @@
 #include <sys/ioctl.h>
 #include "drmtest.h"
 
-/**
- * Checks DRM_IOCTL_GET_VERSION and libdrm's drmGetVersion() interface to it.
- */
+IGT_TEST_DESCRIPTION("Tests the DRM_IOCTL_GET_VERSION ioctl and libdrm's "
+		     "drmGetVersion() interface to it.");
+
 igt_simple_main
 {
 	int fd;
tests/kms_3d.c +2 -0
index 4ecb90d..b1712b2 100644
@@ -27,6 +27,8 @@
 #include "drmtest.h"
 #include "igt_edid.h"
 
+IGT_TEST_DESCRIPTION("Tests 3D mode setting.");
+
 igt_simple_main
 {
 	int drm_fd;
tests/kms_cursor_crc.c +8 -0
index 87b4f64..5772ed4 100644
@@ -34,6 +34,14 @@
 #include "intel_chipset.h"
 #include "igt_aux.h"
 
+IGT_TEST_DESCRIPTION(
+   "Use the display CRC support to validate cursor plane functionality. "
+   "The test will position the cursor plane either fully onscreen, "
+   "partially onscreen, or fully offscreen, using either a fully opaque "
+   "or fully transparent surface. In each case it then reads the PF CRC "
+   "and compares it with the CRC value obtained when the cursor plane "
+   "was disabled.");
+
 #ifndef DRM_CAP_CURSOR_WIDTH
 #define DRM_CAP_CURSOR_WIDTH 0x8
 #endif
tests/kms_fbc_crc.c +5 -0
index e1e8e97..43e68bd 100644
@@ -34,6 +34,11 @@
 #include "intel_batchbuffer.h"
 #include "ioctl_wrappers.h"
 
+IGT_TEST_DESCRIPTION(
+   "Performs various write operations to the scanout buffer while FBC is "
+   "enabled. CRC checks will be used to make sure the modifications to scanout "
+   "buffer are detected.");
+
 enum test_mode {
 	TEST_PAGE_FLIP,
 	TEST_MMAP_CPU,
tests/kms_fence_pin_leak.c +3 -0
index 5610ad8..7f530e6 100644
@@ -35,6 +35,9 @@
 #include "intel_chipset.h"
 #include "igt_aux.h"
 
+IGT_TEST_DESCRIPTION("Exercises full ppgtt fence pin_count leak in the "
+		     "kernel.");
+
 typedef struct {
 	int drm_fd;
 	uint32_t devid;
tests/kms_flip_event_leak.c +6 -6
index 0b45471..8a5e6db 100644
@@ -39,12 +39,12 @@ typedef struct {
 	igt_display_t display;
 } data_t;
 
-/*
- * This test tries to provoke the kernel to leak a pending page flip event
- * when the fd is closed before the flip has completed. The test itself won't
- * fail even if the kernel leaks the event, but the resulting dmesg WARN
- * will cause piglit to report a failure.
- */
+IGT_TEST_DESCRIPTION(
+    "This test tries to provoke the kernel into leaking a pending page flip "
+    "event when the fd is closed before the flip has completed. The test "
+    "itself won't fail even if the kernel leaks the event, but the resulting "
+    "dmesg WARN will indicate a failure.");
+
 static bool test(data_t *data, enum pipe pipe, igt_output_t *output)
 {
 	igt_plane_t *primary;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH v2 3/6 Build the docs directory last

In reply to Thomas Wood

Ensure that other components are built before generating the documentation.

v2: build the docs directory after any optional directories

---
 Makefile.am | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile.am +3 -1
index 1dacb17..4f71a3a 100644
@@ -21,7 +21,7 @@
 
 ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4
 
-SUBDIRS = docs lib man tools scripts benchmarks demos overlay
+SUBDIRS = lib man tools scripts benchmarks demos overlay
 
 if BUILD_ASSEMBLER
 SUBDIRS += assembler
@@ -35,6 +35,8 @@ if BUILD_TESTS
 SUBDIRS += tests
 endif
 
+SUBDIRS += docs
+
 MAINTAINERCLEANFILES = ChangeLog INSTALL
 
 .PHONY: ChangeLog INSTALL
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH v2 4/6 docs: include descriptions for the test programs

In reply to Thomas Wood

v2: fix various distcheck issues

---
 docs/reference/intel-gpu-tools/.gitignore          |  1 +
 docs/reference/intel-gpu-tools/Makefile.am         | 27 +++++++--
 .../intel-gpu-tools/igt_test_programs.xml.header   | 65 ++++++++++++++++++++++
 .../intel-gpu-tools/intel-gpu-tools-docs.xml       |  1 +
 4 files changed, 90 insertions(+), 4 deletions(-)
 create mode 100644 docs/reference/intel-gpu-tools/igt_test_programs.xml.header
docs/reference/intel-gpu-tools/.gitignore +1 -0
index 9415974..303929b 100644
@@ -3,6 +3,7 @@
 /html-build.stamp
 /html.stamp
 /html/
+/igt_test_programs.xml
 /intel-gpu-tools-decl-list.txt
 /intel-gpu-tools-decl.txt
 /intel-gpu-tools-overrides.txt
docs/reference/intel-gpu-tools/Makefile.am +23 -4
index 3368e3e..e02308a 100644
@@ -1,5 +1,22 @@
 ## Process this file with automake to produce Makefile.in
 
+TESTLISTS = $(top_builddir)/tests/single-tests.txt $(top_builddir)/tests/multi-tests.txt
+igt_test_programs.xml: igt_test_programs.xml.header $(TESTLISTS)
+	cat $(srcdir)/igt_test_programs.xml.header > $@; \
+	for test in `cat $(TESTLISTS)`; do \
+		if [ "$$test" = "TESTLIST" -o "$$test" = "END" ]; then \
+			continue; \
+		fi; \
+		echo "<refsect2 id=\"$$test\"><title>$$test</title><para>" >> $@; \
+		if [ -x $(top_builddir)/tests/$$test ]; then \
+			./$(top_builddir)/tests/$$test --help-description >> $@; \
+		else \
+			./$(top_srcdir)/tests/$$test --help-description >> $@; \
+		fi; \
+		echo "</para></refsect2>" >> $@; \
+	done; \
+	echo "</refsect1></refentry>" >> $@;
+
 # We require automake 1.6 at least.
 AUTOMAKE_OPTIONS = 1.6
 
@@ -68,12 +85,12 @@ HTML_IMAGES=
 
 # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
 # e.g. content_files=running.sgml building.sgml changes-2.0.sgml
-content_files=
+content_files=igt_test_programs.xml
 
 # SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
 # These files must be listed here *and* in content_files
 # e.g. expand_content_files=running.sgml
-expand_content_files=
+expand_content_files=igt_test_programs.xml
 
 # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
 # Only needed if you are using gtkdoc-scangobj to dynamically query widget
@@ -88,12 +105,14 @@ include $(top_srcdir)/gtk-doc.make
 
 # Other files to distribute
 # e.g. EXTRA_DIST += version.xml.in
-EXTRA_DIST +=
+EXTRA_DIST += igt_test_programs.xml.header
 
 # Files not to distribute
 # for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
 # for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
-DISTCLEANFILES = $(DOC_MODULE)-sections.txt
+DISTCLEANFILES = $(DOC_MODULE)-sections.txt igt_test_programs.xml
+
+CLEANFILES += igt_test_programs.xml
 
 # Comment this out if you want 'make check' to test you doc status
 # and run some sanity checks
docs/reference/intel-gpu-tools/igt_test_programs.xml.header new file +65 -0

65 lines not on this page · raw message

docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml +1 -0
index 3d9caf8..07ced05 100644
@@ -25,6 +25,7 @@
     <xi:include href="xml/intel_batchbuffer.xml"/>
     <xi:include href="xml/intel_chipset.xml"/>
     <xi:include href="xml/intel_io.xml"/>
+    <xi:include href="xml/igt_test_programs.xml"/>
     <xi:include href="xml/igt_edid.xml"/>
 
   </chapter>
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH v2 5/6 testdisplay: add a test description

In reply to Thomas Wood
---
 tests/testdisplay.c | 6 ++++++
 1 file changed, 6 insertions(+)
tests/testdisplay.c +6 -0
index 09e07f0..d00d64a 100644
@@ -72,6 +72,7 @@
 #include <signal.h>
 
 #define SUBTEST_OPTS 1
+#define HELP_DESCRIPTION 2
 
 static int tio_fd;
 struct termios saved_tio;
@@ -642,6 +643,7 @@ int main(int argc, char **argv)
 	struct option long_opts[] = {
 		{"list-subtests", 0, 0, SUBTEST_OPTS},
 		{"run-subtest", 1, 0, SUBTEST_OPTS},
+		{"help-description", 0, 0, HELP_DESCRIPTION},
 		{ 0, 0, 0, 0 }
 	};
 
@@ -704,6 +706,10 @@ int main(int argc, char **argv)
 			/* invalid subtest options */
 			exit(IGT_EXIT_INVALID);
 			break;
+		case HELP_DESCRIPTION:
+			printf("Tests display functionality.");
+			exit(0);
+			break;
 		default:
 			/* fall through */
 		case 'h':
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH v2 6/6 tests/drm_lib.sh: add a "--help-description" option

In reply to Thomas Wood
---
 tests/drm_lib.sh | 5 +++++
 1 file changed, 5 insertions(+)
tests/drm_lib.sh +5 -0
index 6a8a310..c50664c 100755
@@ -12,11 +12,16 @@ for arg in $@ ; do
 		--debug)
 			IGT_LOG_LEVEL=debug
 			;;
+		--help-description)
+			echo $IGT_TEST_DESCRIPTION
+			exit 0
+			;;
 		--help)
 			echo "Usage: `basename $0` [OPTIONS]"
 			echo "  --list-subtests"
 			echo "  --run-subtest <pattern>"
 			echo "  --debug"
+			echo "  --help-description"
 			echo "  --help"
 			exit 0
 			;;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx