[Beignet] [PATCH 3/3] Two utest changes for android.

Yang Rong rong.r.yang at intel.com
Sun Aug 31 20:15:34 PDT 2014


1. Change to write bmp file path to /sdcard/beignet.
2. Can't assume t_fin > t_map_w_fin, in android, t_map_w_fin is approximate to t_fin.

Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
 utests/compiler_cl_finish.cpp |  4 ++++
 utests/utest_helper.cpp       | 11 +++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/utests/compiler_cl_finish.cpp b/utests/compiler_cl_finish.cpp
index 7c7dee3..280de48 100644
--- a/utests/compiler_cl_finish.cpp
+++ b/utests/compiler_cl_finish.cpp
@@ -43,7 +43,11 @@ static void compiler_cl_finish(void)
   T_GET(t2);
   t_map_wo_fin = T_LAPSE(t1, t2);
 
+#if defined(__ANDROID__)
+  OCL_ASSERT(t_map_wo_fin > t_map_w_fin);
+#else
   OCL_ASSERT(t_fin > t_map_w_fin && t_map_wo_fin > t_map_w_fin);
+#endif
   OCL_UNMAP_BUFFER(0);
 }
 
diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index b57b8dc..f59de4a 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -583,8 +583,15 @@ int *cl_read_bmp(const char *filename, int *width, int *height)
 void cl_write_bmp(const int *data, int width, int height, const char *filename)
 {
   int x, y;
-
-  FILE *fp = fopen(filename, "wb");
+  FILE *fp = NULL;
+#if defined(__ANDROID__)
+  char dst_img[256];
+  snprintf(dst_img, sizeof(dst_img), "/sdcard/beignet/%s", filename);
+  fp = fopen(dst_img, "wb");
+  if(fp == NULL) return;
+#else
+  fp = fopen(filename, "wb");
+#endif
   assert(fp);
 
   char *raw = (char *) malloc(width * height * sizeof(int));	// at most
-- 
1.8.3.2



More information about the Beignet mailing list