aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/mcusupport/test/unittest.h
blob: b0f5c09f89e0c6112860e39df334ea26f3927ae3 (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/

#pragma once

#include "mcutarget.h"
#include "mcutargetfactory.h"
#include "packagemock.h"
#include "settingshandlermock.h"

#include <projectexplorer/kit.h>

#include <QObject>
#include <QSignalSpy>
#include <QTest>

namespace McuSupport::Internal::Test {

class McuSupportTest : public QObject
{
    Q_OBJECT

public:
    McuSupportTest();

private slots:
    void initTestCase();
    void init();
    void cleanup();

    void test_addNewKit();
    void test_parseBasicInfoFromJson();
    void test_parseCmakeEntries();
    void test_parseToolchainFromJSON_data();
    void test_parseToolchainFromJSON();
    void test_mapParsedToolchainIdToCorrespondingType_data();
    void test_mapParsedToolchainIdToCorrespondingType();
    void test_legacy_createPackagesWithCorrespondingSettings();
    void test_legacy_createPackagesWithCorrespondingSettings_data();
    void test_legacy_createTargetWithToolchainPackages_data();
    void test_legacy_createTargetWithToolchainPackages();
    void test_createTargetWithToolchainPackages_data();
    void test_createTargetWithToolchainPackages();
    void test_legacy_createQtMCUsPackage();

    void test_createTargets();
    void test_createPackages();
    void test_legacy_createIarToolchain();
    void test_createIarToolchain();
    void test_legacy_createDesktopGccToolchain();
    void test_createDesktopGccToolchain();
    void test_legacy_createDesktopMsvcToolchain();
    void test_createDesktopMsvcToolchain();
    void test_verifyManuallyCreatedArmGccToolchain();
    void test_legacy_createArmGccToolchain();
    void test_createArmGccToolchain_data();
    void test_createArmGccToolchain();
    void test_removeRtosSuffixFromEnvironmentVariable_data();
    void test_removeRtosSuffixFromEnvironmentVariable();
    void test_useFallbackPathForToolchainWhenPathFromSettingsIsNotAvailable();
    void test_usePathFromSettingsForToolchainPath();

    void test_twoDotOneUsesLegacyImplementation();
    void test_addToolchainFileInfoToKit();
    void test_getFullToolchainFilePathFromTarget();
    void test_legacy_getPredefinedToolchainFilePackage();
    void test_legacy_createUnsupportedToolchainFilePackage();
    void test_legacy_supportMultipleToolchainVersions();

    void test_passExecutableVersionDetectorToToolchainPackage_data();
    void test_passExecutableVersionDetectorToToolchainPackage();
    void test_legacy_passExecutableVersionDetectorToToolchainPackage_data();
    void test_legacy_passExecutableVersionDetectorToToolchainPackage();
    void test_legacy_passXMLVersionDetectorToNxpAndStmBoardSdkPackage_data();
    void test_legacy_passXMLVersionDetectorToNxpAndStmBoardSdkPackage();
    void test_passXMLVersionDetectorToNxpAndStmBoardSdkPackage_data();
    void test_passXMLVersionDetectorToNxpAndStmBoardSdkPackage();
    void test_passDirectoryVersionDetectorToRenesasBoardSdkPackage();

    void test_legacy_createBoardSdk_data();
    void test_legacy_createBoardSdk();
    void test_createBoardSdk_data();
    void test_createBoardSdk();

    void test_legacy_doNOTcreateFreeRtosPackageForMetalVariants_data();
    void test_legacy_doNOTcreateFreeRtosPackageForMetalVariants();
    void test_legacy_createFreeRtosPackage_data();
    void test_legacy_createFreeRtosPackage();
    void test_createFreeRtosPackage_data();
    void test_createFreeRtosPackage();

    void test_resolveEnvironmentVariablesInDefaultPath();
    void test_resolveCmakeVariablesInDefaultPath();

private:
    QVersionNumber currentQulVersion{2, 0};
    PackageMock *freeRtosPackage{new PackageMock};
    PackageMock *sdkPackage{new PackageMock};
    McuPackagePtr freeRtosPackagePtr{freeRtosPackage};
    McuPackagePtr sdkPackagePtr{sdkPackage};

    QSharedPointer<SettingsHandlerMock> settingsMockPtr{new SettingsHandlerMock};
    McuTargetFactory targetFactory;
    PackageDescription compilerDescription;
    PackageDescription toochainFileDescription;
    McuTargetDescription targetDescription;
    McuToolChainPackagePtr toolchainPackagePtr;
    McuToolChainPackagePtr armGccToolchainPackagePtr;
    McuToolChainPackagePtr iarToolchainPackagePtr;
    PackageMock *armGccToolchainFilePackage{new PackageMock};
    McuPackagePtr armGccToolchainFilePackagePtr{armGccToolchainFilePackage};
    McuTarget::Platform platform;
    McuTarget mcuTarget;
    ProjectExplorer::Kit kit;
}; // class McuSupportTest

} // namespace McuSupport::Internal::Test