Kaydet (Commit) d83fb2b2 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Michael Meeks

Unit test for opengl blocklist parsing and evaluating

Parsing unit test checks that the xml values are parsed correctly
and that the DriverInfo structure is populated with the expected
values.

Evaluate unit test checks that blacklisting / whitelisting
logic blocks OS/vendor/driver/device as expected.

Change-Id: Ib1b0926606f0835207c324193bbe19ba83f86bdc
Reviewed-on: https://gerrit.libreoffice.org/22371Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst c0d4f3ad
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_CppunitTest_CppunitTest,vcl_blocklistparser_test))
$(eval $(call gb_CppunitTest_set_include,vcl_blocklistparser_test,\
$$(INCLUDE) \
-I$(SRCDIR)/vcl/inc \
))
$(eval $(call gb_CppunitTest_add_exception_objects,vcl_blocklistparser_test, \
vcl/qa/cppunit/blocklistparsertest \
))
$(eval $(call gb_CppunitTest_use_externals,vcl_blocklistparser_test,\
boost_headers \
))
$(eval $(call gb_CppunitTest_use_libraries,vcl_blocklistparser_test, \
sal \
test \
unotest \
vcl \
$(gb_UWINAPI) \
))
$(eval $(call gb_CppunitTest_use_api,vcl_blocklistparser_test,\
udkapi \
offapi \
))
$(eval $(call gb_CppunitTest_use_ure,vcl_blocklistparser_test))
$(eval $(call gb_CppunitTest_use_vcl,vcl_blocklistparser_test))
$(eval $(call gb_CppunitTest_use_components,vcl_blocklistparser_test,\
configmgr/source/configmgr \
i18npool/util/i18npool \
ucb/source/core/ucb1 \
))
$(eval $(call gb_CppunitTest_use_configuration,vcl_blocklistparser_test))
# vim: set noet sw=4 ts=4:
...@@ -125,6 +125,7 @@ endif ...@@ -125,6 +125,7 @@ endif
ifeq ($(OS),WNT) ifeq ($(OS),WNT)
$(eval $(call gb_Module_add_check_targets,vcl,\ $(eval $(call gb_Module_add_check_targets,vcl,\
CppunitTest_vcl_timer \ CppunitTest_vcl_timer \
CppunitTest_vcl_blocklistparser_test \
)) ))
endif endif
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
...@@ -10,7 +10,10 @@ ...@@ -10,7 +10,10 @@
#ifndef INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX #ifndef INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX
#define INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX #define INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX
#include <vcl/dllapi.h>
#include "opengl/DeviceInfo.hxx" #include "opengl/DeviceInfo.hxx"
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <vector> #include <vector>
#include <cstdint> #include <cstdint>
...@@ -60,14 +63,14 @@ enum DeviceVendor { ...@@ -60,14 +63,14 @@ enum DeviceVendor {
bool ParseDriverVersion(const OUString& rString, uint64_t& rVersion); bool ParseDriverVersion(const OUString& rString, uint64_t& rVersion);
struct DriverInfo struct VCL_DLLPUBLIC DriverInfo
{ {
DriverInfo(OperatingSystem os, const OUString& vendor, VersionComparisonOp op, DriverInfo(OperatingSystem os, const OUString& vendor, VersionComparisonOp op,
uint64_t driverVersion, bool bWhiteListed = false, const char *suggestedVersion = nullptr); uint64_t driverVersion, bool bWhiteListed = false, const char *suggestedVersion = nullptr);
DriverInfo(); DriverInfo();
~DriverInfo(); virtual ~DriverInfo();
OperatingSystem meOperatingSystem; OperatingSystem meOperatingSystem;
uint32_t mnOperatingSystemVersion; uint32_t mnOperatingSystemVersion;
...@@ -96,7 +99,7 @@ struct DriverInfo ...@@ -96,7 +99,7 @@ struct DriverInfo
#define GFX_DRIVER_VERSION(a,b,c,d) \ #define GFX_DRIVER_VERSION(a,b,c,d) \
((uint64_t(a)<<48) | (uint64_t(b)<<32) | (uint64_t(c)<<16) | uint64_t(d)) ((uint64_t(a)<<48) | (uint64_t(b)<<32) | (uint64_t(c)<<16) | uint64_t(d))
inline uint64_t V(uint32_t a, uint32_t b, uint32_t c, uint32_t d) inline VCL_DLLPUBLIC uint64_t V(uint32_t a, uint32_t b, uint32_t c, uint32_t d)
{ {
// We make sure every driver number is padded by 0s, this will allow us the // We make sure every driver number is padded by 0s, this will allow us the
// easiest 'compare as if decimals' approach. See ParseDriverVersion for a // easiest 'compare as if decimals' approach. See ParseDriverVersion for a
...@@ -115,7 +118,7 @@ inline uint64_t V(uint32_t a, uint32_t b, uint32_t c, uint32_t d) ...@@ -115,7 +118,7 @@ inline uint64_t V(uint32_t a, uint32_t b, uint32_t c, uint32_t d)
} }
class WinOpenGLDeviceInfo : public OpenGLDeviceInfo class VCL_DLLPUBLIC WinOpenGLDeviceInfo : public OpenGLDeviceInfo
{ {
private: private:
OUString maDriverVersion; OUString maDriverVersion;
...@@ -204,6 +207,9 @@ public: ...@@ -204,6 +207,9 @@ public:
return mnWindowsVersion; return mnWindowsVersion;
} }
static bool FindBlocklistedDeviceInList(std::vector<wgl::DriverInfo>& aDeviceInfos,
OUString sDriverVersion, OUString sAdapterVendorID,
OUString sAdapterDeviceID, uint32_t nWindowsVersion);
}; };
#endif #endif
......
...@@ -7,17 +7,16 @@ ...@@ -7,17 +7,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
#include "opengl/win/WinDeviceInfo.hxx" #include <vcl/dllapi.h>
#include <xmlreader/xmlreader.hxx> #include <xmlreader/xmlreader.hxx>
#include <vector> #include <vector>
#include "opengl/win/WinDeviceInfo.hxx"
class InvalidFileException class InvalidFileException
{ {
}; };
class WinBlocklistParser class VCL_DLLPUBLIC WinBlocklistParser
{ {
public: public:
WinBlocklistParser(const OUString& rURL, std::vector<wgl::DriverInfo>& rDriverList); WinBlocklistParser(const OUString& rURL, std::vector<wgl::DriverInfo>& rDriverList);
...@@ -29,7 +28,6 @@ private: ...@@ -29,7 +28,6 @@ private:
void handleList(xmlreader::XmlReader& rReader); void handleList(xmlreader::XmlReader& rReader);
void handleContent(xmlreader::XmlReader& rReader); void handleContent(xmlreader::XmlReader& rReader);
enum class BlockType enum class BlockType
{ {
WHITELIST, WHITELIST,
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "opengl/win/WinDeviceInfo.hxx" #include "opengl/win/WinDeviceInfo.hxx"
#include "blocklist_parser.hxx" #include "opengl/win/blocklist_parser.hxx"
#include <config_folders.h> #include <config_folders.h>
#include <windows.h> #include <windows.h>
...@@ -441,67 +441,69 @@ private: ...@@ -441,67 +441,69 @@ private:
} }
bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList() bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(std::vector<wgl::DriverInfo>& aDeviceInfos,
OUString sDriverVersion, OUString sAdapterVendorID,
OUString sAdapterDeviceID, uint32_t nWindowsVersion)
{ {
uint64_t driverVersion; uint64_t driverVersion;
wgl::ParseDriverVersion(maDriverVersion, driverVersion); wgl::ParseDriverVersion(sDriverVersion, driverVersion);
wgl::OperatingSystem eOS = WindowsVersionToOperatingSystem(mnWindowsVersion); wgl::OperatingSystem eOS = WindowsVersionToOperatingSystem(nWindowsVersion);
bool match = false; bool match = false;
uint32_t i = 0; uint32_t i = 0;
for (; i < maDriverInfo.size(); i++) for (; i < aDeviceInfos.size(); i++)
{ {
if (maDriverInfo[i].meOperatingSystem != wgl::DRIVER_OS_ALL && if (aDeviceInfos[i].meOperatingSystem != wgl::DRIVER_OS_ALL &&
maDriverInfo[i].meOperatingSystem != eOS) aDeviceInfos[i].meOperatingSystem != eOS)
{ {
continue; continue;
} }
if (maDriverInfo[i].mnOperatingSystemVersion && maDriverInfo[i].mnOperatingSystemVersion != mnWindowsVersion) if (aDeviceInfos[i].mnOperatingSystemVersion && aDeviceInfos[i].mnOperatingSystemVersion != nWindowsVersion)
{ {
continue; continue;
} }
if (!maDriverInfo[i].maAdapterVendor.equalsIgnoreAsciiCase(GetDeviceVendor(wgl::VendorAll)) && if (!aDeviceInfos[i].maAdapterVendor.equalsIgnoreAsciiCase(GetDeviceVendor(wgl::VendorAll)) &&
!maDriverInfo[i].maAdapterVendor.equalsIgnoreAsciiCase(maAdapterVendorID)) !aDeviceInfos[i].maAdapterVendor.equalsIgnoreAsciiCase(sAdapterVendorID))
{ {
continue; continue;
} }
if (std::none_of(maDriverInfo[i].maDevices.begin(), maDriverInfo[i].maDevices.end(), compareIgnoreAsciiCase("all")) && if (std::none_of(aDeviceInfos[i].maDevices.begin(), aDeviceInfos[i].maDevices.end(), compareIgnoreAsciiCase("all")) &&
std::none_of(maDriverInfo[i].maDevices.begin(), maDriverInfo[i].maDevices.end(), compareIgnoreAsciiCase(maAdapterDeviceID))) std::none_of(aDeviceInfos[i].maDevices.begin(), aDeviceInfos[i].maDevices.end(), compareIgnoreAsciiCase(sAdapterDeviceID)))
{ {
continue; continue;
} }
switch (maDriverInfo[i].meComparisonOp) switch (aDeviceInfos[i].meComparisonOp)
{ {
case wgl::DRIVER_LESS_THAN: case wgl::DRIVER_LESS_THAN:
match = driverVersion < maDriverInfo[i].mnDriverVersion; match = driverVersion < aDeviceInfos[i].mnDriverVersion;
break; break;
case wgl::DRIVER_LESS_THAN_OR_EQUAL: case wgl::DRIVER_LESS_THAN_OR_EQUAL:
match = driverVersion <= maDriverInfo[i].mnDriverVersion; match = driverVersion <= aDeviceInfos[i].mnDriverVersion;
break; break;
case wgl::DRIVER_GREATER_THAN: case wgl::DRIVER_GREATER_THAN:
match = driverVersion > maDriverInfo[i].mnDriverVersion; match = driverVersion > aDeviceInfos[i].mnDriverVersion;
break; break;
case wgl::DRIVER_GREATER_THAN_OR_EQUAL: case wgl::DRIVER_GREATER_THAN_OR_EQUAL:
match = driverVersion >= maDriverInfo[i].mnDriverVersion; match = driverVersion >= aDeviceInfos[i].mnDriverVersion;
break; break;
case wgl::DRIVER_EQUAL: case wgl::DRIVER_EQUAL:
match = driverVersion == maDriverInfo[i].mnDriverVersion; match = driverVersion == aDeviceInfos[i].mnDriverVersion;
break; break;
case wgl::DRIVER_NOT_EQUAL: case wgl::DRIVER_NOT_EQUAL:
match = driverVersion != maDriverInfo[i].mnDriverVersion; match = driverVersion != aDeviceInfos[i].mnDriverVersion;
break; break;
case wgl::DRIVER_BETWEEN_EXCLUSIVE: case wgl::DRIVER_BETWEEN_EXCLUSIVE:
match = driverVersion > maDriverInfo[i].mnDriverVersion && driverVersion < maDriverInfo[i].mnDriverVersionMax; match = driverVersion > aDeviceInfos[i].mnDriverVersion && driverVersion < aDeviceInfos[i].mnDriverVersionMax;
break; break;
case wgl::DRIVER_BETWEEN_INCLUSIVE: case wgl::DRIVER_BETWEEN_INCLUSIVE:
match = driverVersion >= maDriverInfo[i].mnDriverVersion && driverVersion <= maDriverInfo[i].mnDriverVersionMax; match = driverVersion >= aDeviceInfos[i].mnDriverVersion && driverVersion <= aDeviceInfos[i].mnDriverVersionMax;
break; break;
case wgl::DRIVER_BETWEEN_INCLUSIVE_START: case wgl::DRIVER_BETWEEN_INCLUSIVE_START:
match = driverVersion >= maDriverInfo[i].mnDriverVersion && driverVersion < maDriverInfo[i].mnDriverVersionMax; match = driverVersion >= aDeviceInfos[i].mnDriverVersion && driverVersion < aDeviceInfos[i].mnDriverVersionMax;
break; break;
case wgl::DRIVER_COMPARISON_IGNORED: case wgl::DRIVER_COMPARISON_IGNORED:
// We don't have a comparison op, so we match everything. // We don't have a comparison op, so we match everything.
...@@ -512,17 +514,17 @@ bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList() ...@@ -512,17 +514,17 @@ bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList()
break; break;
} }
if (match || maDriverInfo[i].mnDriverVersion == wgl::DriverInfo::allDriverVersions) if (match || aDeviceInfos[i].mnDriverVersion == wgl::DriverInfo::allDriverVersions)
{ {
// white listed drivers // white listed drivers
if (maDriverInfo[i].mbWhitelisted) if (aDeviceInfos[i].mbWhitelisted)
{ {
SAL_WARN("vcl.opengl", "whitelisted driver"); SAL_WARN("vcl.opengl", "whitelisted driver");
return false; return false;
} }
match = true; match = true;
SAL_WARN("vcl.opengl", "use : " << maDriverInfo[i].maSuggestedVersion); SAL_WARN("vcl.opengl", "use : " << aDeviceInfos[i].maSuggestedVersion);
break; break;
} }
} }
...@@ -531,6 +533,11 @@ bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList() ...@@ -531,6 +533,11 @@ bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList()
return match; return match;
} }
bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList()
{
return FindBlocklistedDeviceInList(maDriverInfo, maDriverVersion, maAdapterVendorID, maAdapterDeviceID, mnWindowsVersion);
}
namespace { namespace {
OUString getCacheFolder() OUString getCacheFolder()
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
#include "blocklist_parser.hxx" #include "opengl/win/blocklist_parser.hxx"
WinBlocklistParser::WinBlocklistParser(const OUString& rURL, WinBlocklistParser::WinBlocklistParser(const OUString& rURL,
std::vector<wgl::DriverInfo>& rDriverList) std::vector<wgl::DriverInfo>& rDriverList)
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <sal/types.h>
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
#include <unotest/bootstrapfixturebase.hxx>
#include "opengl/win/blocklist_parser.hxx"
namespace
{
class BlocklistParserTest : public test::BootstrapFixtureBase
{
void testParse();
void testEvaluate();
CPPUNIT_TEST_SUITE(BlocklistParserTest);
CPPUNIT_TEST(testParse);
CPPUNIT_TEST(testEvaluate);
CPPUNIT_TEST_SUITE_END();
};
void BlocklistParserTest::testParse()
{
std::vector<wgl::DriverInfo> aDriveInfos;
WinBlocklistParser aBlocklistParser(getURLFromSrc("vcl/qa/cppunit/") + "test_blocklist_parse.xml", aDriveInfos);
aBlocklistParser.parse();
CPPUNIT_ASSERT_EQUAL(20U, aDriveInfos.size());
size_t i = 0;
for (bool bIsWhitelisted : {true, false})
{
wgl::DriverInfo& aDriveInfo = aDriveInfos[i++];
CPPUNIT_ASSERT_EQUAL(bIsWhitelisted, aDriveInfo.mbWhitelisted);
CPPUNIT_ASSERT_EQUAL(WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorAll), aDriveInfo.maAdapterVendor); // "all"
CPPUNIT_ASSERT_EQUAL(wgl::VersionComparisonOp::DRIVER_LESS_THAN, aDriveInfo.meComparisonOp);
CPPUNIT_ASSERT_EQUAL(wgl::V(10,20,30,40), aDriveInfo.mnDriverVersion);
aDriveInfo = aDriveInfos[i++];
CPPUNIT_ASSERT_EQUAL(bIsWhitelisted, aDriveInfo.mbWhitelisted);
CPPUNIT_ASSERT_EQUAL(WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorIntel), aDriveInfo.maAdapterVendor);
CPPUNIT_ASSERT_EQUAL(wgl::VersionComparisonOp::DRIVER_LESS_THAN_OR_EQUAL, aDriveInfo.meComparisonOp);
CPPUNIT_ASSERT_EQUAL(wgl::V(11,21,31,41), aDriveInfo.mnDriverVersion);
aDriveInfo = aDriveInfos[i++];
CPPUNIT_ASSERT_EQUAL(bIsWhitelisted, aDriveInfo.mbWhitelisted);
CPPUNIT_ASSERT_EQUAL(WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorATI), aDriveInfo.maAdapterVendor);
CPPUNIT_ASSERT_EQUAL(wgl::VersionComparisonOp::DRIVER_GREATER_THAN, aDriveInfo.meComparisonOp);
CPPUNIT_ASSERT_EQUAL(wgl::V(12,22,32,42), aDriveInfo.mnDriverVersion);
aDriveInfo = aDriveInfos[i++];
CPPUNIT_ASSERT_EQUAL(bIsWhitelisted, aDriveInfo.mbWhitelisted);
CPPUNIT_ASSERT_EQUAL(WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorAMD), aDriveInfo.maAdapterVendor);
CPPUNIT_ASSERT_EQUAL(wgl::VersionComparisonOp::DRIVER_GREATER_THAN_OR_EQUAL, aDriveInfo.meComparisonOp);
aDriveInfo = aDriveInfos[i++];
CPPUNIT_ASSERT_EQUAL(bIsWhitelisted, aDriveInfo.mbWhitelisted);
CPPUNIT_ASSERT_EQUAL(WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorNVIDIA), aDriveInfo.maAdapterVendor);
CPPUNIT_ASSERT_EQUAL(wgl::VersionComparisonOp::DRIVER_EQUAL, aDriveInfo.meComparisonOp);
aDriveInfo = aDriveInfos[i++];
CPPUNIT_ASSERT_EQUAL(bIsWhitelisted, aDriveInfo.mbWhitelisted);
CPPUNIT_ASSERT_EQUAL(WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorMicrosoft), aDriveInfo.maAdapterVendor);
CPPUNIT_ASSERT_EQUAL(wgl::VersionComparisonOp::DRIVER_NOT_EQUAL, aDriveInfo.meComparisonOp);
aDriveInfo = aDriveInfos[i++];
CPPUNIT_ASSERT_EQUAL(bIsWhitelisted, aDriveInfo.mbWhitelisted);
CPPUNIT_ASSERT_EQUAL(WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorAll), aDriveInfo.maAdapterVendor);
CPPUNIT_ASSERT_EQUAL(wgl::VersionComparisonOp::DRIVER_BETWEEN_EXCLUSIVE, aDriveInfo.meComparisonOp);
aDriveInfo = aDriveInfos[i++];
CPPUNIT_ASSERT_EQUAL(bIsWhitelisted, aDriveInfo.mbWhitelisted);
CPPUNIT_ASSERT_EQUAL(WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorAll), aDriveInfo.maAdapterVendor);
CPPUNIT_ASSERT_EQUAL(wgl::VersionComparisonOp::DRIVER_BETWEEN_INCLUSIVE, aDriveInfo.meComparisonOp);
aDriveInfo = aDriveInfos[i++];
CPPUNIT_ASSERT_EQUAL(bIsWhitelisted, aDriveInfo.mbWhitelisted);
CPPUNIT_ASSERT_EQUAL(WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorAll), aDriveInfo.maAdapterVendor);
CPPUNIT_ASSERT_EQUAL(wgl::VersionComparisonOp::DRIVER_BETWEEN_INCLUSIVE_START, aDriveInfo.meComparisonOp);
aDriveInfo = aDriveInfos[i++];
CPPUNIT_ASSERT_EQUAL(bIsWhitelisted, aDriveInfo.mbWhitelisted);
CPPUNIT_ASSERT_EQUAL(WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorAll), aDriveInfo.maAdapterVendor);
CPPUNIT_ASSERT_EQUAL(wgl::VersionComparisonOp::DRIVER_COMPARISON_IGNORED, aDriveInfo.meComparisonOp);
}
}
void BlocklistParserTest::testEvaluate()
{
std::vector<wgl::DriverInfo> aDriveInfos;
WinBlocklistParser aBlocklistParser(getURLFromSrc("vcl/qa/cppunit/") + "test_blocklist_evaluate.xml", aDriveInfos);
aBlocklistParser.parse();
OUString vendorAMD = WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorAMD);
OUString vendorNVIDIA = WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorNVIDIA);
OUString vendorIntel = WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorIntel);
OUString vendorMicrosoft = WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorMicrosoft);
uint32_t osWindowsXP = 0x00050001;
uint32_t osWindowsVista = 0x00060000;
uint32_t osWindows7 = 0x00060001;
uint32_t osWindows8 = 0x00060002;
uint32_t osWindows10 = 0x000A0000;
// Check OS
CPPUNIT_ASSERT_EQUAL(true, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
aDriveInfos, "10.20.30.40", vendorNVIDIA, "all", osWindowsXP));
CPPUNIT_ASSERT_EQUAL(true, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
aDriveInfos, "10.20.30.40", vendorNVIDIA, "all", osWindowsVista));
CPPUNIT_ASSERT_EQUAL(false, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
aDriveInfos, "10.20.30.40", vendorNVIDIA, "all", osWindows7));
CPPUNIT_ASSERT_EQUAL(false, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
aDriveInfos, "10.20.30.40", vendorNVIDIA, "all", osWindows8));
CPPUNIT_ASSERT_EQUAL(false, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
aDriveInfos, "10.20.30.40", vendorNVIDIA, "all", osWindows10));
// Check Vendors
CPPUNIT_ASSERT_EQUAL(true, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
aDriveInfos, "10.20.30.40", vendorMicrosoft, "all", osWindows7));
CPPUNIT_ASSERT_EQUAL(true, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
aDriveInfos, "10.20.30.40", vendorMicrosoft, "all", osWindows10));
// Check Versions
CPPUNIT_ASSERT_EQUAL(true, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
aDriveInfos, "10.20.30.39", vendorAMD, "all", osWindows7));
CPPUNIT_ASSERT_EQUAL(false, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
aDriveInfos, "10.20.30.40", vendorAMD, "all", osWindows7));
CPPUNIT_ASSERT_EQUAL(false, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
aDriveInfos, "10.20.30.41", vendorAMD, "all", osWindows7));
// Check
CPPUNIT_ASSERT_EQUAL(true, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
aDriveInfos, "9.17.10.4229", vendorIntel, "all", osWindows7));
}
} // namespace
CPPUNIT_TEST_SUITE_REGISTRATION(BlocklistParserTest);
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<!--
entry attributes:
os - "all", "xp", "server2003", "vista", "7", "8", "8_1", "10"
vendor - "all", "intel", "ati", "amd", "nvidia", "microsoft"
compare - "less", "less_equal", "greater", "greater_equal", "equal", "not_equal", "between_exclusive", "between_inclusive", "between_inclusive_start"
version
minVersion
maxVersion
-->
<root>
<whitelist>
</whitelist>
<blacklist>
<entry os="xp" vendor="all">
<device id="all"/>
</entry>
<entry os="server2003" vendor="all">
<device id="all"/>
</entry>
<entry os="vista" vendor="all">
<device id="all"/>
</entry>
<entry os="all" vendor="amd" compare="less" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="all" vendor="microsoft">
<device id="all"/>
</entry>
<entry os="all" vendor="intel" compare="less" version="10.18.14.4264">
<device id="all"/>
</entry>
</blacklist>
</root>
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<root>
<whitelist>
<entry os="all" vendor="all" compare="less" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="xp" vendor="intel" compare="less_equal" version="11.21.31.41">
<device id="all"/>
</entry>
<entry os="server2003" vendor="ati" compare="greater" version="12.22.32.42">
<device id="all"/>
</entry>
<entry os="vista" vendor="amd" compare="greater_equal" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="7" vendor="nvidia" compare="equal" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="8" vendor="microsoft" compare="not_equal" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="8_1" compare="between_exclusive" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="10" compare="between_inclusive" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="all" compare="between_inclusive_start" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="all">
<device id="all"/>
</entry>
</whitelist>
<blacklist>
<entry os="all" vendor="all" compare="less" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="xp" vendor="intel" compare="less_equal" version="11.21.31.41">
<device id="all"/>
</entry>
<entry os="server2003" vendor="ati" compare="greater" version="12.22.32.42">
<device id="all"/>
</entry>
<entry os="vista" vendor="amd" compare="greater_equal" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="7" vendor="nvidia" compare="equal" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="8" vendor="microsoft" compare="not_equal" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="8_1" compare="between_exclusive" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="10" compare="between_inclusive" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="all" compare="between_inclusive_start" version="10.20.30.40">
<device id="all"/>
</entry>
<entry os="all">
<device id="all"/>
</entry>
</blacklist>
</root>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment