[01/10] Android: change the saved file path.

Submitted by Yang, Rong R on May 19, 2016, 8:37 a.m.

Details

Message ID 1463647036-25545-1-git-send-email-rong.r.yang@intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 1 ) in Beignet

Not browsing as part of any series.

Commit Message

Yang, Rong R May 19, 2016, 8:37 a.m.
Save tmp file to /data/local/tmp and the ustest image to /sdcard/ocl

Signed-off-by: Yang Rong <rong.r.yang@intel.com>
---
 src/cl_program.c        |  5 +++++
 utests/utest_helper.cpp | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/cl_program.c b/src/cl_program.c
index e079a77..b569479 100644
--- a/src/cl_program.c
+++ b/src/cl_program.c
@@ -781,7 +781,12 @@  cl_program_compile(cl_program            p,
     p->build_opts = NULL;
   }
 
+#if defined(__ANDROID__)
+  char temp_header_template[]= "/data/local/tmp/beignet.XXXXXX";
+#else
   char temp_header_template[]= "/tmp/beignet.XXXXXX";
+#endif
+
   char* temp_header_path = mkdtemp(temp_header_template);
 
   if (p->source_type == FROM_SOURCE) {
diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index 4d2d4df..2a204f3 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -685,7 +685,15 @@  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/ocl/%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