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:
@@ -13,6 +13,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#include "harness/os_helpers.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
@@ -113,29 +114,6 @@ static char gFileName[256];
|
||||
// Static helper functions definition
|
||||
//-----------------------------------------
|
||||
|
||||
//-----------------------------------------
|
||||
// getTempFileName
|
||||
//-----------------------------------------
|
||||
static int getTempFileName()
|
||||
{
|
||||
// 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 -1;
|
||||
close(fd);
|
||||
#elif defined(_WIN32)
|
||||
UINT ret = GetTempFileName(".", "tmp", 0, gFileName);
|
||||
if (ret == 0)
|
||||
return -1;
|
||||
#else
|
||||
MTdata d = init_genrand((cl_uint)time(NULL));
|
||||
sprintf(gFileName, "tmpfile.%u", genrand_int32(d));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// acquireOutputStream
|
||||
//-----------------------------------------
|
||||
@@ -1062,9 +1040,17 @@ int main(int argc, const char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (getTempFileName() == -1)
|
||||
char* pcTempFname = get_temp_filename();
|
||||
if (pcTempFname != nullptr)
|
||||
{
|
||||
log_error("getTempFileName failed\n");
|
||||
strncpy(gFileName, pcTempFname, sizeof(gFileName));
|
||||
}
|
||||
|
||||
free(pcTempFname);
|
||||
|
||||
if (strlen(gFileName) == 0)
|
||||
{
|
||||
log_error("get_temp_filename failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user