diff mbox

[2/2] tests: add reloc, pread, pwrite slow path subtest

Message ID 1374230572-2983-2-git-send-email-xiong.y.zhang@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhang, Xiong Y July 19, 2013, 10:42 a.m. UTC
the reloc, pread, pwrite slow path will be prevented by prefault,
these subtests will disable prefault first, then do reloc, pread,
pwrite, finally enable prefault.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
---
 tests/gem_exec_faulting_reloc.c | 10 +++++++++-
 tests/gem_mmap_gtt.c            | 15 +++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/tests/gem_exec_faulting_reloc.c b/tests/gem_exec_faulting_reloc.c
index 863a1b0..c7f7b6b 100644
--- a/tests/gem_exec_faulting_reloc.c
+++ b/tests/gem_exec_faulting_reloc.c
@@ -220,7 +220,15 @@  static void run(int object_size)
 
 int main(int argc, char **argv)
 {
-	run(OBJECT_SIZE);
+	drmtest_subtest_init(argc, argv);
+
+	if (drmtest_run_subtest("normal"))
+		run(OBJECT_SIZE);
+	if (drmtest_run_subtest("no-prefault")) {
+		drmtest_disable_prefault();
+		run(OBJECT_SIZE);
+		drmtest_enable_prefault();
+	}
 
 	return 0;
 }
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index d759340..0e1b195 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -144,6 +144,15 @@  test_read(int fd)
 	munmap(dst, OBJECT_SIZE);
 }
 
+static void
+run_without_prefault(int fd,
+			void (*func)(int fd))
+{
+	drmtest_disable_prefault();
+	func(fd);
+	drmtest_enable_prefault();
+}
+
 int main(int argc, char **argv)
 {
 	int fd;
@@ -160,6 +169,12 @@  int main(int argc, char **argv)
 		test_write(fd);
 	if (drmtest_run_subtest("write-gtt"))
 		test_write_gtt(fd);
+	if (drmtest_run_subtest("read-no-prefault"))
+		run_without_prefault(fd, test_read);
+	if (drmtest_run_subtest("write-no-prefault"))
+		run_without_prefault(fd, test_write);
+	if (drmtest_run_subtest("write-gtt-no-prefault"))
+		run_without_prefault(fd, test_write_gtt);
 
 	close(fd);