Skip to contentSkip to conversation

tests/meta_test: Add a meta test for sanity checks of CI systems

PATCH Superseded Marta Lofstedt 3 participants 5 messages Apr 5, 2017 – Apr 24, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/meta_test: Add a meta test for sanity checks of CI systems

The intention of this test is use it to test that the CI system that runs IGT is collecting the results correctly.

For: VIZ-10281

---
 tests/Makefile.sources       |   1 +
 tests/intel-ci/meta.testlist |   7 +++
 tests/meta_test.c            | 145 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 153 insertions(+)
 create mode 100644 tests/intel-ci/meta.testlist
 create mode 100644 tests/meta_test.c
tests/Makefile.sources +1 -0
index 45c21a0..7fa9b8f 100644
@@ -143,6 +143,7 @@ TESTS_progs_M = \
 	template \
 	vgem_basic \
 	vgem_slow \
+	meta_test \
 	$(NULL)
 
 if HAVE_CHAMELIUM
tests/intel-ci/meta.testlist new file +7 -0
new file mode 100644
index 0000000..b3e2923
@@ -0,0 +1,7 @@
+igt@meta_test@pass-result
+igt@meta_test@fail-result
+igt@meta_test@dmesg-pass
+igt@meta_test@dmesg-warn
+igt@meta_test@user-crash
+igt@meta_test@piglit-timeout
+igt@meta_test@generate-panic
tests/meta_test.c new file +145 -0

145 lines not on this page · raw message

Signature · 6 lines
2.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 73 lines · Marta Lofstedt

The intention of this test is use it to test that the CI system that runs IGT is collecting the results correctly.

For: VIZ-10281

---
 tests/Makefile.sources       |   1 +
 tests/intel-ci/meta.testlist |   7 +++
 tests/meta_test.c            | 145 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 153 insertions(+)
 create mode 100644 tests/intel-ci/meta.testlist
 create mode 100644 tests/meta_test.c
tests/Makefile.sources +1 -0
index 45c21a0..7fa9b8f 100644
@@ -143,6 +143,7 @@ TESTS_progs_M = \
 	template \
 	vgem_basic \
 	vgem_slow \
+	meta_test \
 	$(NULL)
 
 if HAVE_CHAMELIUM
tests/intel-ci/meta.testlist new file +7 -0
new file mode 100644
index 0000000..b3e2923
@@ -0,0 +1,7 @@
+igt@meta_test@pass-result
+igt@meta_test@fail-result
+igt@meta_test@dmesg-pass
+igt@meta_test@dmesg-warn
+igt@meta_test@user-crash
+igt@meta_test@piglit-timeout
+igt@meta_test@generate-panic
tests/meta_test.c new file +28 -0
new file mode 100644
index 0000000..8a420ba
@@ -0,0 +1,145 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include <stdlib.h>
+#include <signal.h>
+#include "igt.h"
+

tests/meta_test.c line 38

Quoted 10 lines
tests/meta_test.c new file +10 -0
+/*
+ * The purpose of this test is to test the CI system that we have
+ * for running the tests. The test should generate all possible
+ * exit states for igt tests.
+ *
+ * Possible exit-states of igt tests:
+ * 1. pass - subtest: pass-result
+ * 2. fail - subtest: fail-result
+ * 3. dmesg warn - subtest: dmesg-fail,
+ *      subtest: dmesg-pass is a sanity check for the dmesg-fail.

Add some further explanation here about the purpose and why the test does what it does: The purpose is to check that certain kernel log activity gets correctly reported in the test result, and that normal activity doesn't?

Quoted 27 lines
tests/meta_test.c new file +27 -0
+ * 4. crash - subtest: user-crash
+ * 5. piglit timeout - subtest: piglit-timeout
+ * 6. incomplete - subtest: generate-panic
+ *      NOTE: inorder for this to generate the incomplete state
+ *      the kernel must be configured to reboot on panic.
+ *      NOTE: if the tested CI system have features such as
+ *      PSTORE and/or kexec/kdump enabled. This test could be
+ *      used to make sure that the CI system stores the generated
+ *      log/dumps as expected.
+ * 7. incomplete - where user hang is not caught by piglit timeout.
+ *      This would be caught by a user-side softdog daemon,
+ *      such as owatch by ezbench. However, I don't know
+ *      how to trigger this state, so it will not be tested.
+ * 8. incomplete - system requires hard reboot :
+ *      This state could be triggered by calling an evil kernel
+ *      module that was developed hang the system. Such
+ *      a module will not be developed for this purpose,
+ *      so this "exit state" will not be tested.
+ *
+ * TODO: If this test was deployed on a CI system that
+ * was able to pick up testing again after reboot,
+ * such as ezbench, a post-analyze test should be added
+ * that collected and analyzed the result of the tests
+ * run before reboot.
+ */
+
+__attribute__((format(printf, 1, 2)))

tests/meta_test.c line 75

Quoted 10 lines
tests/meta_test.c new file +10 -0
+static void kmsg(const char *format, ...)
+#define KERN_EMER"<0>"
+#define KERN_ALERT"<1>"
+#define KERN_CRIT"<2>"
+#define KERN_ERR"<3>"
+#define KERN_WARNING"<4>"
+#define KERN_NOTICE"<5>"
+#define KERN_INFO"<6>"
+#define KERN_DEBUG"<7>"
+{

This is valid C and does what you mean, but can you add some whitespace between the token and the value anyway? :P

Quoted 37 lines
tests/meta_test.c new file +37 -0
+	va_list ap;
+	FILE *file;
+
+	file = fopen("/dev/kmsg", "w");
+	if (file == NULL)
+		return;
+
+	va_start(ap, format);
+	vfprintf(file, format, ap);
+	va_end(ap);
+	fclose(file);
+}
+
+static void test_result(bool result)
+{
+	igt_assert_eq(result, true);
+}
+
+static void test_dmesg(bool pass)
+{
+	if (pass)
+		kmsg(KERN_DEBUG "drm: IGT inserted string.");
+	else
+		kmsg(KERN_WARNING "drm: IGT inserted string.");
+}
+
+static void test_user_crash(void)
+{
+	raise(SIGSEGV);
+}
+
+static void test_piglit_timeout(void)
+{
+	sleep(605);
+}
+
+static void test_panic(void)

tests/meta_test.c line 122

Quoted 10 lines
tests/meta_test.c new file +10 -0
+{
+	system("echo c > /proc/sysrq-trigger");
+}
+
+igt_main
+{
+
+	igt_fixture {
+		igt_skip_on_f(!getenv("IGT_CI_META_TEST"),
+			      "Only for meta-testing of CI systems");

Add a newline here.

With those,

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

#2 lore raw
Quoted 220 lines

-----Original Message-----
From: Latvala, Petri
Sent: Wednesday, April 19, 2017 12:08 PM
To: Lofstedt, Marta <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH i-g-t] tests/meta_test: Add a meta test for sanity checks of CI systems

Quoted 10 lines · Marta Lofstedt

The intention of this test is use it to test that the CI system that runs IGT is collecting the results correctly.

For: VIZ-10281

---
 tests/Makefile.sources       |   1 +
 tests/intel-ci/meta.testlist |   7 +++
 tests/meta_test.c            | 145

+++++++++++++++++++++++++++++++++++++++++++

Quoted 46 lines
 3 files changed, 153 insertions(+)
 create mode 100644 tests/intel-ci/meta.testlist  create mode 100644

tests/meta_test.c

tests/Makefile.sources index renamed from tests/Makefile.sources +0 -0

45c21a0..7fa9b8f 100644

tests/Makefile.sources +1 -0
@@ -143,6 +143,7 @@ TESTS_progs_M = \
 	template \
 	vgem_basic \
 	vgem_slow \
+	meta_test \
 	$(NULL)
 
 if HAVE_CHAMELIUM
(quoted diff) +0 -0

b/tests/intel-ci/meta.testlist new file mode 100644 index 0000000..b3e2923

tests/intel-ci/meta.testlist new file +7 -0
@@ -0,0 +1,7 @@
+igt@meta_test@pass-result
+igt@meta_test@fail-result
+igt@meta_test@dmesg-pass
+igt@meta_test@dmesg-warn
+igt@meta_test@user-crash
+igt@meta_test@piglit-timeout
+igt@meta_test@generate-panic
tests/meta_test.c new file mode renamed from tests/meta_test.c +0 -0

100644 index 0000000..8a420ba

tests/meta_test.c new file +12 -0
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person
+obtaining a
+ * copy of this software and associated documentation files (the
+"Software"),
+ * to deal in the Software without restriction, including without
+limitation
+ * the rights to use, copy, modify, merge, publish, distribute,
+sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom

tests/meta_test.c line 22

Quoted 10 lines
tests/meta_test.c new file +10 -0
+the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including
+the next
+ * paragraph) shall be included in all copies or substantial portions
+of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY

KIND,

tests/meta_test.c line 26

Quoted 4 lines
tests/meta_test.c new file +4 -0
+EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN

NO EVENT

tests/meta_test.c line 28

Quoted 2 lines
tests/meta_test.c new file +2 -0
+SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,

DAMAGES

tests/meta_test.c line 30

Quoted 2 lines
tests/meta_test.c new file +2 -0
+OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR

OTHERWISE,

tests/meta_test.c line 32

Quoted 2 lines
tests/meta_test.c new file +2 -0
+ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE

OR

Quoted 9 lines
tests/meta_test.c new file +9 -0
+OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include <stdlib.h>
+#include <signal.h>
+#include "igt.h"
+

tests/meta_test.c line 38

Quoted 10 lines
tests/meta_test.c new file +10 -0
+/*
+ * The purpose of this test is to test the CI system that we have
+ * for running the tests. The test should generate all possible
+ * exit states for igt tests.
+ *
+ * Possible exit-states of igt tests:
+ * 1. pass - subtest: pass-result
+ * 2. fail - subtest: fail-result
+ * 3. dmesg warn - subtest: dmesg-fail,
+ *      subtest: dmesg-pass is a sanity check for the dmesg-fail.

Add some further explanation here about the purpose and why the test does what it does: The purpose is to check that certain kernel log activity gets correctly reported in the test result, and that normal activity doesn't?

Quoted 26 lines
tests/meta_test.c new file +26 -0
+ * 4. crash - subtest: user-crash
+ * 5. piglit timeout - subtest: piglit-timeout
+ * 6. incomplete - subtest: generate-panic
+ *      NOTE: inorder for this to generate the incomplete state
+ *      the kernel must be configured to reboot on panic.
+ *      NOTE: if the tested CI system have features such as
+ *      PSTORE and/or kexec/kdump enabled. This test could be
+ *      used to make sure that the CI system stores the generated
+ *      log/dumps as expected.
+ * 7. incomplete - where user hang is not caught by piglit timeout.
+ *      This would be caught by a user-side softdog daemon,
+ *      such as owatch by ezbench. However, I don't know
+ *      how to trigger this state, so it will not be tested.
+ * 8. incomplete - system requires hard reboot :
+ *      This state could be triggered by calling an evil kernel
+ *      module that was developed hang the system. Such
+ *      a module will not be developed for this purpose,
+ *      so this "exit state" will not be tested.
+ *
+ * TODO: If this test was deployed on a CI system that
+ * was able to pick up testing again after reboot,
+ * such as ezbench, a post-analyze test should be added
+ * that collected and analyzed the result of the tests
+ * run before reboot.
+ */
+

tests/meta_test.c line 75

Quoted 10 lines
tests/meta_test.c new file +10 -0
+__attribute__((format(printf, 1, 2))) static void kmsg(const char
+*format, ...) #define KERN_EMER"<0>"
+#define KERN_ALERT"<1>"
+#define KERN_CRIT"<2>"
+#define KERN_ERR"<3>"
+#define KERN_WARNING"<4>"
+#define KERN_NOTICE"<5>"
+#define KERN_INFO"<6>"
+#define KERN_DEBUG"<7>"
+{

This is valid C and does what you mean, but can you add some whitespace between the token and the value anyway? :P

Quoted 14 lines
tests/meta_test.c new file +14 -0
+	va_list ap;
+	FILE *file;
+
+	file = fopen("/dev/kmsg", "w");
+	if (file == NULL)
+		return;
+
+	va_start(ap, format);
+	vfprintf(file, format, ap);
+	va_end(ap);
+	fclose(file);
+}
+
+static void test_result(bool result)

tests/meta_test.c

Quoted 10 lines
tests/meta_test.c new file +10 -0
+{
+	igt_assert_eq(result, true);
+}
+
+static void test_dmesg(bool pass)
+{
+	if (pass)
+		kmsg(KERN_DEBUG "drm: IGT inserted string.");
+	else
+		kmsg(KERN_WARNING "drm: IGT inserted

string."); }

Quoted 10 lines
tests/meta_test.c new file +10 -0
+
+static void test_user_crash(void)
+{
+	raise(SIGSEGV);
+}
+
+static void test_piglit_timeout(void) {
+	sleep(605);
+}
+

tests/meta_test.c

Quoted 10 lines
tests/meta_test.c new file +10 -0
+static void test_panic(void)
+{
+	system("echo c > /proc/sysrq-trigger"); }
+
+igt_main
+{
+
+	igt_fixture {
+		igt_skip_on_f(!getenv("IGT_CI_META_TEST"),
+			      "Only for meta-testing of CI

systems");

Add a newline here.

Quoted 3 lines

With those,

Thanks Petri, V2 is up.

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

#3 lore raw

PATCH v2 1/1 tests/meta_test: Add a meta test for sanity checks of CI systems

In reply to Marta Lofstedt

From: Marta Löfstedt <[email protected]>

The intention of this test is use it to test that the CI system that runs IGT is collecting the results correctly.

For: VIZ-10281

v2: minor edits

---
 tests/Makefile.sources       |   1 +
 tests/intel-ci/meta.testlist |   7 ++
 tests/meta_test.c            | 149 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 157 insertions(+)
 create mode 100644 tests/intel-ci/meta.testlist
 create mode 100644 tests/meta_test.c
tests/Makefile.sources +1 -0
index 45c21a0c..7fa9b8f2 100644
@@ -143,6 +143,7 @@ TESTS_progs_M = \
 	template \
 	vgem_basic \
 	vgem_slow \
+	meta_test \
 	$(NULL)
 
 if HAVE_CHAMELIUM
tests/intel-ci/meta.testlist new file +7 -0
new file mode 100644
index 00000000..b3e29235
@@ -0,0 +1,7 @@
+igt@meta_test@pass-result
+igt@meta_test@fail-result
+igt@meta_test@dmesg-pass
+igt@meta_test@dmesg-warn
+igt@meta_test@user-crash
+igt@meta_test@piglit-timeout
+igt@meta_test@generate-panic
tests/meta_test.c new file +149 -0

149 lines not on this page · raw message

Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 15 lines · Marta Lofstedt
tests/meta_test.c new file +15 -0
+
+__attribute__((format(printf, 1, 2)))
+static void kmsg(const char *format, ...)
+#define KERN_EMER	"<0>"
+#define KERN_ALERT	"<1>"
+#define KERN_CRIT	"<2>"
+#define KERN_ERR	"<3>"
+#define KERN_WARNING	"<4>"
+#define KERN_NOTICE	"<5>"
+#define KERN_INFO	"<6>"
+#define KERN_DEBUG	"<7>"
+{
+	va_list ap;
+	FILE *file;
+

tests/meta_test.c line 91

Quoted 10 lines
tests/meta_test.c new file +10 -0
+	file = fopen("/dev/kmsg", "w");
+	if (file == NULL)
+		return;
+
+	va_start(ap, format);
+	vfprintf(file, format, ap);
+	va_end(ap);
+	fclose(file);
+}
+

igt_core.c already implements kmsg(). Is there a reason why not to export and re-use that instead?

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