File: test_excludes.cpp

package info (click to toggle)
intel-compute-runtime 25.44.36015.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 79,632 kB
  • sloc: cpp: 931,547; lisp: 2,074; sh: 719; makefile: 162; python: 21
file content (52 lines) | stat: -rw-r--r-- 1,946 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * Copyright (C) 2021 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/test/common/test_macros/test_excludes.h"

#include "shared/source/helpers/debug_helpers.h"

#include <map>
#include <memory>
#include <string>
#include <unordered_set>

using namespace NEO;

PRODUCT_FAMILY productFamily = {};
GFXCORE_FAMILY renderCoreFamily = {};

static std::unique_ptr<std::map<std::string, std::unordered_set<uint32_t>>> pProductExcludesPerTest;
static std::unique_ptr<std::map<std::string, std::unordered_set<uint32_t>>> pGfxExcludesPerTest;

bool isExcluded(const char *testName, const uint32_t family, std::unique_ptr<std::map<std::string, std::unordered_set<uint32_t>>> &pExcludesPerTest) {
    if ((pExcludesPerTest == nullptr) || pExcludesPerTest->count(testName) == 0) {
        return false;
    }
    return (pExcludesPerTest->at(testName).count(family) > 0);
}

void addExclude(const char *testName, const uint32_t family, std::unique_ptr<std::map<std::string, std::unordered_set<uint32_t>>> &pExcludesPerTest) {
    if (pExcludesPerTest == nullptr) {
        pExcludesPerTest = std::make_unique<std::map<std::string, std::unordered_set<uint32_t>>>();
    }
    if (pExcludesPerTest->count(testName) == 0) {
        pExcludesPerTest->insert(std::make_pair(testName, std::unordered_set<uint32_t>{}));
    }
    pExcludesPerTest->at(testName).insert(family);
}

bool TestExcludes::isTestExcluded(const char *testName, const PRODUCT_FAMILY productFamily, const GFXCORE_FAMILY gfxFamily) {
    return (isExcluded(testName, productFamily, pProductExcludesPerTest) || isExcluded(testName, gfxFamily, pGfxExcludesPerTest));
}

void TestExcludes::addTestExclude(const char *testName, const PRODUCT_FAMILY family) {
    addExclude(testName, family, pProductExcludesPerTest);
}

void TestExcludes::addTestExclude(const char *testName, const GFXCORE_FAMILY family) {
    addExclude(testName, family, pGfxExcludesPerTest);
}