[PATCH libdrm] amdgpu/basic_tests.c: check for fork

Fabrice Fontaine fontaine.fabrice at gmail.com
Sun Mar 10 09:44:03 UTC 2019


amdgpu test program use fork since
https://cgit.freedesktop.org/mesa/drm/commit/tests/amdgpu/basic_tests.c?id=736ef0b61cab55378202c5f49d91799cc2b99091

However, this function is not always available so add a check for it in
configure.ac and use it in tests/amdgpu/basic_tests.c

Fixes:
 - http://autobuild.buildroot.org/results/8d6194982c1080e173fcef8212fb06e6dc275d58

Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
---
 configure.ac               | 2 ++
 tests/amdgpu/basic_tests.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/configure.ac b/configure.ac
index d72e84ad..6effb9a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -193,6 +193,8 @@ AC_CHECK_FUNCS([open_memstream],
                [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 1, [Have open_memstream()])],
                [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 0)])
 
+AC_CHECK_FUNCS([fork])
+
 dnl Use lots of warning flags with with gcc and compatible compilers
 
 dnl Note: if you change the following variable, the cache is automatically
diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
index dbae4d53..c32a1351 100644
--- a/tests/amdgpu/basic_tests.c
+++ b/tests/amdgpu/basic_tests.c
@@ -1646,10 +1646,12 @@ static void amdgpu_userptr_test(void)
 	while (j++ < sdma_write_length)
 		pm4[i++] = 0xdeadbeaf;
 
+#ifdef HAVE_FORK
 	if (!fork()) {
 		pm4[0] = 0x0;
 		exit(0);
 	}
+#endif
 
 	amdgpu_test_exec_cs_helper(context_handle,
 				   AMDGPU_HW_IP_DMA, 0,
@@ -1675,7 +1677,9 @@ static void amdgpu_userptr_test(void)
 	r = amdgpu_cs_ctx_free(context_handle);
 	CU_ASSERT_EQUAL(r, 0);
 
+#ifdef HAVE_FORK
 	wait(NULL);
+#endif
 }
 
 static void amdgpu_sync_dependency_test(void)
-- 
2.20.1



More information about the dri-devel mailing list