tests/prime_nv_tests: convert to subtests

And properly fail the failing ones - bloody hate it when the tests lie
to me ...
This commit is contained in:
Daniel Vetter 2012-12-15 15:30:19 +01:00
parent c0a74d8d50
commit cc4eeb990f
2 changed files with 39 additions and 35 deletions

View File

@ -6,10 +6,11 @@ noinst_PROGRAMS = \
$(NULL) $(NULL)
if HAVE_NOUVEAU if HAVE_NOUVEAU
NOUVEAU_TESTS_M = \
prime_nv_test
NOUVEAU_TESTS = \ NOUVEAU_TESTS = \
prime_nv_api \ prime_nv_api \
prime_nv_pcopy \ prime_nv_pcopy
prime_nv_test
endif endif
TESTS_progs_M = \ TESTS_progs_M = \
@ -28,6 +29,7 @@ TESTS_progs_M = \
gem_set_tiling_vs_blt \ gem_set_tiling_vs_blt \
gem_tiled_partial_pwrite_pread \ gem_tiled_partial_pwrite_pread \
flip_test \ flip_test \
$(NOUVEAU_TESTS_M) \
$(NULL) $(NULL)
TESTS_progs = \ TESTS_progs = \

View File

@ -27,6 +27,7 @@
#include "nouveau.h" #include "nouveau.h"
#include "intel_gpu_tools.h" #include "intel_gpu_tools.h"
#include "intel_batchbuffer.h" #include "intel_batchbuffer.h"
#include "drmtest.h"
int intel_fd = -1, nouveau_fd = -1; int intel_fd = -1, nouveau_fd = -1;
drm_intel_bufmgr *bufmgr; drm_intel_bufmgr *bufmgr;
@ -267,8 +268,7 @@ static int test5(void)
ret = drm_intel_bo_map(test_intel_bo, 0); ret = drm_intel_bo_map(test_intel_bo, 0);
if (ret != 0) { if (ret != 0) {
/* failed to map the bo is expected */ fprintf(stderr,"failed to map imported bo on intel side\n");
ret = 0;
goto out; goto out;
} }
if (!test_intel_bo->virtual) { if (!test_intel_bo->virtual) {
@ -407,18 +407,17 @@ static int test7(void)
*ptr = 0xdeadbeef; *ptr = 0xdeadbeef;
ret = do_read(intel_fd, test_intel_bo->handle, buf, 0, 256); ret = do_read(intel_fd, test_intel_bo->handle, buf, 0, 256);
if (ret != -1) { if (ret) {
fprintf(stderr,"pread succeedded %d\n", ret); fprintf(stderr,"pread failed %d\n", errno);
goto out; goto out;
} }
buf[0] = 0xabcdef55; buf[0] = 0xabcdef55;
ret = do_write(intel_fd, test_intel_bo->handle, buf, 0, 4); ret = do_write(intel_fd, test_intel_bo->handle, buf, 0, 4);
if (ret != -1) { if (ret) {
fprintf(stderr,"pwrite succeedded\n"); fprintf(stderr,"pwrite failed %d\n", errno);
goto out; goto out;
} }
ret = 0;
out: out:
nouveau_bo_ref(NULL, &nvbo); nouveau_bo_ref(NULL, &nvbo);
drm_intel_bo_unreference(test_intel_bo); drm_intel_bo_unreference(test_intel_bo);
@ -505,15 +504,18 @@ out:
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int ret; int ret = 0;
ret = find_and_open_devices(); ret = find_and_open_devices();
if (ret < 0) if (ret < 0)
return ret; return ret;
drmtest_subtest_init(argc, argv);
if (nouveau_fd == -1 || intel_fd == -1) { if (nouveau_fd == -1 || intel_fd == -1) {
fprintf(stderr,"failed to find intel and nouveau GPU\n"); fprintf(stderr,"failed to find intel and nouveau GPU\n");
return 77; if (!drmtest_only_list_subtests())
return 77;
} }
/* set up intel bufmgr */ /* set up intel bufmgr */
@ -541,37 +543,37 @@ int main(int argc, char **argv)
intel_batch = intel_batchbuffer_alloc(bufmgr, devid); intel_batch = intel_batchbuffer_alloc(bufmgr, devid);
/* create an object on the i915 */ /* create an object on the i915 */
ret = test1(); if (drmtest_run_subtest("i915-nouveau-sharing"))
if (ret) if (test1())
fprintf(stderr,"prime_test: failed test 1\n"); exit(1);
ret = test2(); if (drmtest_run_subtest("nouveau-i915-sharing"))
if (ret) if (test2())
fprintf(stderr,"prime_test: failed test 2\n"); exit(1);
ret = test3(); if (drmtest_run_subtest("nouveau-write-i915-shmem-read"))
if (ret) if (test3())
fprintf(stderr,"prime_test: failed test 3\n"); exit(1);
ret = test4(); if (drmtest_run_subtest("nouveau-write-i915-gtt-read"))
if (ret) if (test4())
fprintf(stderr,"prime_test: failed test 4\n"); exit(1);
ret = test5(); if (drmtest_run_subtest("i915-import-shmem-mmap"))
if (ret) if (test5())
fprintf(stderr,"prime_test: failed test 5\n"); exit(1);
ret = test6(); if (drmtest_run_subtest("i915-import-gtt-mmap"))
if (ret) if (test6())
fprintf(stderr,"prime_test: failed test 6\n"); exit(1);
ret = test7(); if (drmtest_run_subtest("i915-import-pread-pwrite"))
if (ret) if (test7())
fprintf(stderr,"prime_test: failed test 7\n"); exit(1);
ret = test8(); if (drmtest_run_subtest("i915-blt-fill-nouveau-read"))
if (ret) if (test8())
fprintf(stderr,"prime_test: failed test 8\n"); exit(1);
intel_batchbuffer_free(intel_batch); intel_batchbuffer_free(intel_batch);