mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
printf test cases for cl_khr_command_buffer extenstion (#1592)
* Added printf test case for cl_khr_command_buffer extenstion according to point 1.6 from: https://github.com/KhronosGroup/OpenCL-CTS/issues/1369 * Corrections related to macos and windows build * Added missing header * Added corrections related to code review of draft PR: https://github.com/KhronosGroup/OpenCL-CTS/pull/1592 refers to issue #1369, p.1.6: https://github.com/KhronosGroup/OpenCL-CTS/issues/1369 * minor fix for previous commit * printf capability condition moved to ::Skip method (#1369, p.1.6): https://github.com/KhronosGroup/OpenCL-CTS/issues/1369 * Applied minor corrections related to code review (#1369, p.1.6): https://github.com/KhronosGroup/OpenCL-CTS/issues/1369 * Added correction to replace string literals with sequence of characters printf arguments (issue #1369, printf) * Added clang formatting. * Added header related to android build (issue #1369, printf) * Fixed memory leak * Fixed memory leak in test_printf * Added cosmetic fix for last commit
This commit is contained in:
@@ -30,8 +30,17 @@
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include <android/api-level.h>
|
||||
#include "harness/mt19937.h"
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#if defined(__APPLE__)
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define CHECK_PTR(ptr) \
|
||||
if ((ptr) == NULL) \
|
||||
{ \
|
||||
@@ -556,4 +565,27 @@ char* get_exe_dir()
|
||||
} // get_exe_dir
|
||||
|
||||
|
||||
char* get_temp_filename()
|
||||
{
|
||||
char gFileName[256] = "";
|
||||
// Create a unique temporary file to allow parallel executed tests.
|
||||
#if (defined(__linux__) || defined(__APPLE__)) && (!defined(__ANDROID__))
|
||||
sprintf(gFileName, "/tmp/tmpfile.XXXXXX");
|
||||
int fd = mkstemp(gFileName);
|
||||
if (fd == -1) return strdup(gFileName);
|
||||
close(fd);
|
||||
#elif defined(_WIN32)
|
||||
UINT ret = GetTempFileName(".", "tmp", 0, gFileName);
|
||||
if (ret == 0) return gFileName;
|
||||
#else
|
||||
MTdata d = init_genrand((cl_uint)time(NULL));
|
||||
sprintf(gFileName, "tmpfile.%u", genrand_int32(d));
|
||||
#endif
|
||||
|
||||
char* fn = strdup(gFileName);
|
||||
CHECK_PTR(fn);
|
||||
return fn;
|
||||
}
|
||||
|
||||
|
||||
// end of file //
|
||||
|
||||
@@ -41,5 +41,7 @@ char* get_err_msg(int err); // Returns system error message. Subject to free.
|
||||
char* get_dir_sep(); // Returns dir separator. Subject to free.
|
||||
char* get_exe_path(); // Returns path of current executable. Subject to free.
|
||||
char* get_exe_dir(); // Returns dir of current executable. Subject to free.
|
||||
char* get_temp_filename(); // returns temporary file name
|
||||
|
||||
|
||||
#endif // __os_helpers_h__
|
||||
|
||||
Reference in New Issue
Block a user