File: debug_settings_manager_fixture.h

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 (62 lines) | stat: -rw-r--r-- 1,802 bytes parent folder | download
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
53
54
55
56
57
58
59
60
61
62
/*
 * Copyright (C) 2019-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#pragma once

#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/utilities/directory.h"
#include "shared/source/utilities/stackvec.h"

#include <map>

using namespace NEO;

#undef DECLARE_DEBUG_VARIABLE

namespace NEO {
extern std::unique_ptr<SettingsReader> mockSettingsReader;
extern const StackVec<DebugVarPrefix, 4> *validUltPrefixTypesOverride;
} // namespace NEO

class TestDebugFlagsChecker {
  public:
    static bool isEqual(int32_t returnedValue, bool defaultValue) {
        if (returnedValue == 0) {
            return !defaultValue;
        } else {
            return defaultValue;
        }
    }

    static bool isEqual(int32_t returnedValue, int32_t defaultValue) {
        return returnedValue == defaultValue;
    }

    static bool isEqual(int64_t returnedValue, int64_t defaultValue) {
        return returnedValue == defaultValue;
    }

    static bool isEqual(std::string returnedValue, std::string defaultValue) {
        return returnedValue == defaultValue;
    }
};

template <DebugFunctionalityLevel debugLevel>
class TestDebugSettingsManager : public DebugSettingsManager<debugLevel> {
  public:
    using DebugSettingsManager<debugLevel>::dumpFlags;
    using DebugSettingsManager<debugLevel>::settingsDumpFileName;

    TestDebugSettingsManager() : DebugSettingsManager<debugLevel>("") {}
    SettingsReader *getSettingsReader() {
        return DebugSettingsManager<debugLevel>::readerImpl.get();
    }
};

using FullyEnabledTestDebugManager = TestDebugSettingsManager<DebugFunctionalityLevel::full>;
using FullyDisabledTestDebugManager = TestDebugSettingsManager<DebugFunctionalityLevel::none>;