mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 02:16:17 +00:00
igt/drv_hangman: Tidy up assertion failure message
Because (drv_hangman:6035) CRITICAL: Failed assertion: !((__extension__ (__builtin_constant_p (l) && ((__builtin_constant_p (tmp) && strlen (tmp) < ((size_t) (l))) || (__builtin_constant_p (s) && strlen (s) < ((size_t) (l)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (tmp) && __builtin_constant_p (s) && (__s1_len = strlen (tmp), __s2_len = strlen (s), (!((size_t)(const void *)((tmp) + 1) - (size_t)(const void *)(tmp) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) || __s2_len >= 4)) ? __builtin_strcmp (tmp, s) : (__builtin_constant_p (tmp) && ((size_t)(const void *)((tmp) + 1) - (size_t)(const void *)(tmp) == 1) && (__s1_len = strlen (tmp), __s1_len < 4) ? (__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) ? __builtin_strcmp (tmp, s) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (s); int __result = (((const unsigned char *) (const char *) (tmp))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (tmp))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (tmp))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (tmp))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) && (__s2_len = strlen (s), __s2_len < 4) ? (__builtin_constant_p (tmp) && ((size_t)(const void *)((tmp) + 1) - (size_t)(const void *)(tmp) == 1) ? __builtin_strcmp (tmp, s) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (tmp); int __result = (((const unsigned char *) (const char *) (s))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (s))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (tmp, s)))); }) : strncmp (tmp, s, l))) == 0) is a little hard to understand at a glance. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
430439541c
commit
405b3478d1
@ -32,11 +32,12 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
#ifndef I915_PARAM_CMD_PARSER_VERSION
|
||||
#define I915_PARAM_CMD_PARSER_VERSION 28
|
||||
#endif
|
||||
|
||||
static char read_buffer[1024];
|
||||
|
||||
static int _read_sysfs(void *dst, int maxlen,
|
||||
const char* path,
|
||||
const char *fname)
|
||||
@ -73,9 +74,7 @@ static int read_sysfs(void *dst, int maxlen, const char *fname)
|
||||
|
||||
static void test_sysfs_error_exists(void)
|
||||
{
|
||||
char tmp[1024];
|
||||
|
||||
igt_assert_lt(0, read_sysfs(tmp, sizeof(tmp), "error"));
|
||||
igt_assert_lt(0, read_sysfs(read_buffer, sizeof(read_buffer), "error"));
|
||||
}
|
||||
|
||||
static void test_debugfs_error_state_exists(void)
|
||||
@ -112,29 +111,26 @@ static void read_dfs(const char *fname, char *d, int maxlen)
|
||||
igt_debug("dfs entry %s read '%s'\n", fname, d);
|
||||
}
|
||||
|
||||
static void _assert_dfs_entry(const char *fname, const char *s, bool inverse)
|
||||
static int compare_dfs_entry(const char *fname, const char *s)
|
||||
{
|
||||
char tmp[1024];
|
||||
const int l = min(strlen(s), sizeof(tmp));
|
||||
const int l = min(strlen(s), sizeof(read_buffer));
|
||||
|
||||
read_dfs(fname, tmp, l + 1);
|
||||
if (!inverse) {
|
||||
igt_fail_on_f(strncmp(tmp, s, l) != 0,
|
||||
"contents of %s: '%s' (expected '%s')\n", fname, tmp, s);
|
||||
} else {
|
||||
igt_fail_on_f(strncmp(tmp, s, l) == 0,
|
||||
"contents of %s: '%s' (expected not '%s'\n", fname, tmp, s);
|
||||
}
|
||||
read_dfs(fname, read_buffer, l + 1);
|
||||
return strncmp(read_buffer, s, l);
|
||||
}
|
||||
|
||||
static void assert_dfs_entry(const char *fname, const char *s)
|
||||
{
|
||||
_assert_dfs_entry(fname, s, false);
|
||||
igt_fail_on_f(compare_dfs_entry(fname, s) != 0,
|
||||
"contents of %s: '%s' (expected '%s')\n",
|
||||
fname, read_buffer, s);
|
||||
}
|
||||
|
||||
static void assert_dfs_entry_not(const char *fname, const char *s)
|
||||
{
|
||||
_assert_dfs_entry(fname, s, true);
|
||||
igt_fail_on_f(compare_dfs_entry(fname, s) == 0,
|
||||
"contents of %s: '%s' (expected not '%s'\n",
|
||||
fname, read_buffer, s);
|
||||
}
|
||||
|
||||
static void assert_error_state_clear(void)
|
||||
|
Loading…
x
Reference in New Issue
Block a user