Files
compute-runtime/unit_tests/linux/va_tests.cpp
Artur Harasimiuk 40146291ad Update copyright headers
Updating files modified in 2018 only. Older files remain with old style
copyright header

Change-Id: Ic99f2e190ad74b4b7f2bd79dd7b9fa5fbe36ec92
Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
2018-09-20 18:02:35 +02:00

38 lines
1.1 KiB
C++

/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "test.h"
#include "runtime/sharings/va/va_sharing_functions.h"
#include "unit_tests/helpers/variable_backup.h"
using namespace OCLRT;
TEST(VaTests, whenLibvaSo2IsNotInstalledThenFail) {
VariableBackup<decltype(VASharingFunctions::fdlopen)> dlopenBackup(&VASharingFunctions::fdlopen);
VariableBackup<decltype(VASharingFunctions::fdlclose)> dlcloseBackup(&VASharingFunctions::fdlclose);
VariableBackup<decltype(VASharingFunctions::fdlsym)> dlsymBackup(&VASharingFunctions::fdlsym);
VASharingFunctions::fdlopen = [&](const char *filename, int flag) -> void * {
if (!strncmp(filename, "libva.so.2", 10)) {
return (void *)0xdeadbeef;
} else
return 0;
};
VASharingFunctions::fdlclose = [&](void *handle) -> int {
return 0;
};
VASharingFunctions::fdlsym = [&](void *handle, const char *symbol) -> void * {
return nullptr;
};
VADisplay vaDisplay = nullptr;
VASharingFunctions va(vaDisplay);
EXPECT_EQ(true, va.isVaLibraryAvailable());
}