diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-11-18 08:37:58 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-11-18 08:37:58 +0100 |
commit | e01f525b49f397322ada23b1be5b2f734fb71327 (patch) | |
tree | 86f1abd4aa5b6c6cd17a41c9e2149a08ec007e75 | |
parent | 26548af2c723ec2e427129a780329a2ad22a679b (diff) | |
download | drminfo-e01f525b49f397322ada23b1be5b2f734fb71327.tar.gz |
add fork test
-rw-r--r-- | drmtest.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -9,6 +9,7 @@ #include <sys/ioctl.h> #include <sys/mman.h> +#include <sys/wait.h> #include <libdrm/drm_fourcc.h> #include <xf86drm.h> @@ -347,7 +348,7 @@ int main(int argc, char **argv) bool dmabuf = false; bool autotest = false; bool pixman = false; - int c,i; + int c,i,pid,rc; for (;;) { c = getopt(argc, argv, "hpdaL:c:s:o:i:f:m:"); @@ -462,6 +463,26 @@ int main(int argc, char **argv) drm_show_fb(); drm_check_content("post-show content"); + pid = fork(); + if (pid == 0) { + test_passed = 0; + test_failed = 0; + drm_check_content("post-fork content"); + rc = (test_failed << 4) | + (test_passed << 0); + exit(rc); + } else { + int status = 0; + waitpid(pid, &status, 0); + if (WIFEXITED(status)) { + rc = WEXITSTATUS(status); + test_passed += (rc >> 0) & 0x0f; + test_failed += (rc >> 4) & 0x0f; + } else { + test_failed++; + } + } + if (autotest) fprintf(stdout, "---ok---\n"); tty_raw(); |