tests: add reloc, pread, pwrite slow path subtest

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>
This commit is contained in:
Xiong Zhang 2013-07-19 18:42:52 +08:00 committed by Daniel Vetter
parent 7ea2983b11
commit fc5c693014
2 changed files with 24 additions and 1 deletions

View File

@ -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;
}

View File

@ -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;
@ -163,6 +172,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);