summaryrefslogtreecommitdiff
path: root/utests
diff options
context:
space:
mode:
authorLu Guanqun <guanqun.lu@intel.com>2013-03-25 11:19:05 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-04-10 14:52:33 +0800
commit18e037a1712dca6415fb34d02914e256e3b3523d (patch)
treebe677ed5fd4cc1a55b9a02a8754ff6eefdaad1fb /utests
parent7717541b658b90746c3e82128b13deac299d991b (diff)
downloadbeignet-18e037a1712dca6415fb34d02914e256e3b3523d.tar.gz
change the way clGetPlatformInfo() is called in cl_ocl_init()
This works as a test case for the newly implemented clGetPlatformInfo() behaviour: pass NULL to param_value and it should return the string size. Signed-off-by: Lu Guanqun <guanqun.lu@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests')
-rw-r--r--utests/utest_helper.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index f0cde374..e7bf1868 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -181,6 +181,20 @@ error:
goto exit;
}
+#define GET_PLATFORM_STR_INFO(LOWER_NAME, NAME) \
+ { \
+ size_t param_value_size; \
+ OCL_CALL (clGetPlatformInfo, platform, CL_PLATFORM_##NAME, 0, 0, &param_value_size); \
+ std::vector<char> param_value(param_value_size); \
+ OCL_CALL (clGetPlatformInfo, platform, CL_PLATFORM_##NAME, \
+ param_value_size, param_value.empty() ? NULL : &param_value.front(), \
+ &param_value_size); \
+ std::string str; \
+ if (!param_value.empty()) \
+ str = std::string(&param_value.front(), param_value_size-1); \
+ printf("platform_" #LOWER_NAME " \"%s\"\n", str.c_str()); \
+ }
+
int
cl_ocl_init(void)
{
@@ -196,14 +210,10 @@ cl_ocl_init(void)
/* Get a valid platform */
OCL_CALL (clGetPlatformIDs, 1, &platform, &platform_n);
- OCL_CALL (clGetPlatformInfo, platform, CL_PLATFORM_PROFILE, sizeof(name), name, NULL);
- printf("platform_profile \"%s\"\n", name);
- OCL_CALL (clGetPlatformInfo, platform, CL_PLATFORM_NAME, sizeof(name), name, NULL);
- printf("platform_name \"%s\"\n", name);
- OCL_CALL (clGetPlatformInfo, platform, CL_PLATFORM_VENDOR, sizeof(name), name, NULL);
- printf("platform_vendor \"%s\"\n", name);
- OCL_CALL (clGetPlatformInfo, platform, CL_PLATFORM_VERSION, sizeof(name), name, NULL);
- printf("platform_version \"%s\"\n", name);
+ GET_PLATFORM_STR_INFO(profile, PROFILE);
+ GET_PLATFORM_STR_INFO(name, NAME);
+ GET_PLATFORM_STR_INFO(vendor, VENDOR);
+ GET_PLATFORM_STR_INFO(version, VERSION);
/* Get the device (only GPU device is supported right now) */
OCL_CALL (clGetDeviceIDs, platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);