mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-23 07:39:01 +00:00
cl21: Add minimal required version functionality (#270)
This adds functionality to define minimal required version through the ADD_TEST* macros. Tests that don't meet the version requirement will be skipped. By default the minimal required version is set to 1.0, subsequent patches will set the appropriate version for each of the tests. Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
This commit is contained in:
committed by
Kévin Petit
parent
32e702efbc
commit
bfb3e4aa2c
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "threadTesting.h"
|
||||
#include "clImageHelper.h"
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -25,15 +27,36 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ADD_TEST(fn) {test_##fn, #fn}
|
||||
#define NOT_IMPLEMENTED_TEST(fn) {NULL, #fn}
|
||||
#define ADD_TEST(fn) {test_##fn, #fn, Version(1, 0)}
|
||||
#define ADD_TEST_VERSION(fn, ver) {test_##fn, #fn, ver}
|
||||
#define NOT_IMPLEMENTED_TEST(fn) {NULL, #fn, Version(0, 0)}
|
||||
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
|
||||
class Version
|
||||
{
|
||||
public:
|
||||
Version() : m_major(0), m_minor(0) {}
|
||||
Version(int major, int minor) : m_major(major), m_minor(minor) {}
|
||||
bool operator>(const Version& rhs) const { return to_int() > rhs.to_int(); }
|
||||
int to_int() const { return m_major * 10 + m_minor; }
|
||||
std::string to_string() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << m_major << "." << m_minor;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
private:
|
||||
int m_major;
|
||||
int m_minor;
|
||||
};
|
||||
|
||||
typedef struct test_definition
|
||||
{
|
||||
basefn func;
|
||||
const char* name;
|
||||
Version min_version;
|
||||
} test_definition;
|
||||
|
||||
|
||||
@@ -99,6 +122,8 @@ extern cl_device_type GetDeviceType( cl_device_id );
|
||||
// is the only device available, the SAME device is returned, so check!
|
||||
extern cl_device_id GetOpposingDevice( cl_device_id device );
|
||||
|
||||
Version get_device_cl_version(cl_device_id device);
|
||||
|
||||
|
||||
extern int gFlushDenormsToZero; // This is set to 1 if the device does not support denorms (CL_FP_DENORM)
|
||||
extern int gInfNanSupport; // This is set to 1 if the device supports infinities and NaNs
|
||||
|
||||
Reference in New Issue
Block a user