diff options
Diffstat (limited to 'src/backends/backendsCommon/test/TestDynamicBackend.hpp')
-rw-r--r-- | src/backends/backendsCommon/test/TestDynamicBackend.hpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/backends/backendsCommon/test/TestDynamicBackend.hpp b/src/backends/backendsCommon/test/TestDynamicBackend.hpp new file mode 100644 index 0000000000..599ca16636 --- /dev/null +++ b/src/backends/backendsCommon/test/TestDynamicBackend.hpp @@ -0,0 +1,67 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include <cstdint> + +#if defined(VALID_TEST_DYNAMIC_BACKEND) + +// Correct dynamic backend interface +extern "C" +{ +const char* GetBackendId(); +void GetVersion(uint32_t* outMajor, uint32_t* outMinor); +void* BackendFactory(); +} + +#elif defined(INVALID_TEST_DYNAMIC_BACKEND_1) + +// Wrong external linkage: expected C-style name mangling +extern const char* GetBackendId(); +extern void GetVersion(uint32_t* outMajor, uint32_t* outMinor); +extern void* BackendFactory(); + +#else + +extern "C" +{ + +#if defined(INVALID_TEST_DYNAMIC_BACKEND_2) + +// Invalid interface: missing "GetBackendId()" +void GetVersion(uint32_t* outMajor, uint32_t* outMinor); +void* BackendFactory(); + +#elif defined(INVALID_TEST_DYNAMIC_BACKEND_3) + +// Invalid interface: missing "GetVersion()" +const char* GetBackendId(); +void* BackendFactory(); + +#elif defined(INVALID_TEST_DYNAMIC_BACKEND_4) + +// Invalid interface: missing "BackendFactory()" +const char* GetBackendId(); +void GetVersion(uint32_t* outMajor, uint32_t* outMinor); + +#elif defined(INVALID_TEST_DYNAMIC_BACKEND_5) || \ + defined(INVALID_TEST_DYNAMIC_BACKEND_6) || \ + defined(INVALID_TEST_DYNAMIC_BACKEND_7) + +// The interface is correct, the corresponding invalid changes are in the TestDynamicBackend.cpp file +const char* GetBackendId(); +void GetVersion(uint32_t* outMajor, uint32_t* outMinor); +void* BackendFactory(); + +#else + +#error "Invalid or missing configuration macro for the TestDynamicBackend object" + +#endif + +} + +#endif |