mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-13 02:46:23 +00:00
tests: add igt_subtest_f for snprintf'ing testnames
Useful when stitching together combinatorial testnames. v2: - ## rules are just fun. We need 2 indirections to actually get __LINE__ to properly expand. - Kill stray ; which botched the logic. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
1532af19d9
commit
6234658063
@ -100,6 +100,17 @@ void igt_progress(const char *header, uint64_t i, uint64_t total);
|
|||||||
jmp_buf igt_subtest_jmpbuf;
|
jmp_buf igt_subtest_jmpbuf;
|
||||||
void igt_subtest_init(int argc, char **argv);
|
void igt_subtest_init(int argc, char **argv);
|
||||||
bool __igt_run_subtest(const char *subtest_name);
|
bool __igt_run_subtest(const char *subtest_name);
|
||||||
|
#define igt_tokencat2(x, y) x ## y
|
||||||
|
#define igt_tokencat(x, y) igt_tokencat2(x, y)
|
||||||
|
#define __igt_subtest_f(tmp, format, args...) \
|
||||||
|
for (char tmp [256]; \
|
||||||
|
snprintf( tmp , sizeof( tmp ), \
|
||||||
|
format, args), \
|
||||||
|
__igt_run_subtest( tmp ) && \
|
||||||
|
(setjmp(igt_subtest_jmpbuf) == 0); \
|
||||||
|
igt_success())
|
||||||
|
#define igt_subtest_f(f, a...) \
|
||||||
|
__igt_subtest_f(igt_tokencat(__tmpchar, __LINE__), f, a)
|
||||||
#define igt_subtest(name) for (; __igt_run_subtest((name)) && \
|
#define igt_subtest(name) for (; __igt_run_subtest((name)) && \
|
||||||
(setjmp(igt_subtest_jmpbuf) == 0); \
|
(setjmp(igt_subtest_jmpbuf) == 0); \
|
||||||
igt_success())
|
igt_success())
|
||||||
|
@ -254,21 +254,16 @@ static void test_partial_read_writes(void)
|
|||||||
|
|
||||||
static void do_tests(int cache_level, const char *suffix)
|
static void do_tests(int cache_level, const char *suffix)
|
||||||
{
|
{
|
||||||
char name[80];
|
|
||||||
|
|
||||||
if (cache_level != -1)
|
if (cache_level != -1)
|
||||||
gem_set_caching(fd, scratch_bo->handle, cache_level);
|
gem_set_caching(fd, scratch_bo->handle, cache_level);
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "reads%s", suffix);
|
igt_subtest_f("reads%s", suffix)
|
||||||
igt_subtest(name)
|
|
||||||
test_partial_reads();
|
test_partial_reads();
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "writes%s", suffix);
|
igt_subtest_f("write%s", suffix)
|
||||||
igt_subtest(name)
|
|
||||||
test_partial_writes();
|
test_partial_writes();
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "writes-after-reads%s", suffix);
|
igt_subtest_f("writes-after-reads%s", suffix)
|
||||||
igt_subtest(name)
|
|
||||||
test_partial_read_writes();
|
test_partial_read_writes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ int fd;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define COLOR 0xffffffff
|
#define COLOR 0xffffffff
|
||||||
static void run_test(int ring, const char *testname)
|
static void run_test(int ring)
|
||||||
{
|
{
|
||||||
uint32_t *ptr;
|
uint32_t *ptr;
|
||||||
int i;
|
int i;
|
||||||
@ -66,8 +66,6 @@ static void run_test(int ring, const char *testname)
|
|||||||
if (ring == I915_EXEC_RENDER)
|
if (ring == I915_EXEC_RENDER)
|
||||||
gem_require_ring(fd, I915_EXEC_BLT);
|
gem_require_ring(fd, I915_EXEC_BLT);
|
||||||
|
|
||||||
printf("running subtest %s\n", testname);
|
|
||||||
|
|
||||||
target_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
|
target_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
|
||||||
if (!target_bo) {
|
if (!target_bo) {
|
||||||
fprintf(stderr, "failed to alloc target buffer\n");
|
fprintf(stderr, "failed to alloc target buffer\n");
|
||||||
@ -194,15 +192,13 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(tests); i++) {
|
for (i = 0; i < ARRAY_SIZE(tests); i++) {
|
||||||
igt_subtest(tests[i].name)
|
igt_subtest(tests[i].name)
|
||||||
run_test(tests[i].ring, tests[i].name);
|
run_test(tests[i].ring);
|
||||||
}
|
}
|
||||||
|
|
||||||
igt_fork_signal_helper();
|
igt_fork_signal_helper();
|
||||||
for (i = 0; i < ARRAY_SIZE(tests); i++) {
|
for (i = 0; i < ARRAY_SIZE(tests); i++) {
|
||||||
char name[180];
|
igt_subtest_f("%s-interruptible", tests[i].name)
|
||||||
snprintf(name, sizeof(name), "%s-interruptible", tests[i].name);
|
run_test(tests[i].ring);
|
||||||
igt_subtest(name)
|
|
||||||
run_test(tests[i].ring, name);
|
|
||||||
}
|
}
|
||||||
igt_stop_signal_helper();
|
igt_stop_signal_helper();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user