From: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/3] tests/gem_exec_alignment.c: Timeout alarm wrappers
Date: Thu, 19 Mar 2020 08:38:17 +0100 [thread overview]
Message-ID: <20200319073819.13383-2-dominik.grzegorzek@intel.com> (raw)
In-Reply-To: <20200319073819.13383-1-dominik.grzegorzek@intel.com>
Implementation of timeout functions in gem_exec_alignment.c.
Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
tests/i915/gem_exec_alignment.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/tests/i915/gem_exec_alignment.c b/tests/i915/gem_exec_alignment.c
index a10571c9..b7c11947 100644
--- a/tests/i915/gem_exec_alignment.c
+++ b/tests/i915/gem_exec_alignment.c
@@ -36,6 +36,7 @@
#include <errno.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <signal.h>
#include "drm.h"
IGT_TEST_DESCRIPTION("Exercises the basic execbuffer using object alignments");
@@ -65,6 +66,37 @@ static uint32_t file_max(void)
return max;
}
+static bool timed_out;
+static void alignment_alarm_handler(int signal)
+{
+ igt_debug("alignment test timed out!\n");
+ timed_out = true;
+}
+
+static void alignment_set_timeout(unsigned int sec, unsigned int usec)
+{
+ struct sigaction sa = {};
+ struct itimerval itv = {};
+
+ sa.sa_handler = alignment_alarm_handler;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sigaction(SIGALRM, &sa, NULL);
+
+ timed_out = false;
+ itv.it_value.tv_sec = sec;
+ itv.it_value.tv_usec = usec;
+ setitimer(ITIMER_REAL, &itv, NULL);
+}
+
+static inline void alignment_reset_timeout(void)
+{
+ struct itimerval itv = {};
+
+ sigaction(SIGALRM, NULL, NULL);
+ setitimer(ITIMER_REAL, &itv, NULL);
+}
+
static void many(int fd)
{
uint32_t bbe = MI_BATCH_BUFFER_END;
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-03-19 7:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-19 7:38 [igt-dev] [PATCH i-g-t 0/3] tests/gem_exec_alignment.c: Update subtests Dominik Grzegorzek
2020-03-19 7:38 ` Dominik Grzegorzek [this message]
2020-03-19 7:38 ` [igt-dev] [PATCH i-g-t 2/3] tests/gem_exec_alignment.c: Update subtest many Dominik Grzegorzek
2020-03-19 7:38 ` [igt-dev] [PATCH i-g-t 3/3] tests/gem_exec_alignment.c: Add priority inversion Dominik Grzegorzek
2020-03-19 8:10 ` [igt-dev] ✗ GitLab.Pipeline: failure for tests/gem_exec_alignment.c: Update subtests (rev3) Patchwork
2020-03-19 8:23 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2020-03-19 9:31 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2020-03-16 12:03 [igt-dev] [PATCH i-g-t 0/3] tests/gem_exec_alignment.c: Update subtests Dominik Grzegorzek
2020-03-16 12:03 ` [igt-dev] [PATCH i-g-t 1/3] tests/gem_exec_alignment.c: Timeout alarm wrappers Dominik Grzegorzek
2020-03-12 9:09 [igt-dev] [PATCH i-g-t 0/3] tests/gem_exec_alignment.c: Update subtests Dominik Grzegorzek
2020-03-12 9:09 ` [igt-dev] [PATCH i-g-t 1/3] tests/gem_exec_alignment.c: Timeout alarm wrappers Dominik Grzegorzek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200319073819.13383-2-dominik.grzegorzek@intel.com \
--to=dominik.grzegorzek@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox