forked from Open-CMSIS-Pack/devtools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CBuildAC6Tests.cpp
182 lines (147 loc) · 5.06 KB
/
CBuildAC6Tests.cpp
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
* Copyright (c) 2020-2021 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Integration tests for cbuild.sh
*
* The tests validate different configurations and
* features of cbuild.sh with AC6 toolchain
*
*/
#include "CBuildTestFixture.h"
using namespace std;
class CBuildAC6Tests : public CBuildTestFixture {
public:
void SetUp();
};
void CBuildAC6Tests::SetUp() {
string toolchainPath = CrossPlatformUtils::GetEnv("AC6_TOOLCHAIN_ROOT");
if (!fs::exists(CBuildIntegTestEnv::ac6_toolchain_path)) {
GTEST_SKIP();
}
}
// Validate successful build of C example
// using latest pack versions available
TEST_F(CBuildAC6Tests, Build_AC6) {
TestParam param = { "AC6/Build_AC6", "Simulation" };
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
}
// Validate successful generation and compilation
// of cprj using "--update" option with fixed pack versions
TEST_F(CBuildAC6Tests, Build_AC6_Fixed) {
TestParam param = {
"AC6/Build_AC6", "Simulation",
"--update=Simulation.fixed.cprj", "", true
};
RunCBuildScriptClean (param);
RunCBuildScriptWithArgs (param);
param = { "AC6/Build_AC6", "Simulation.fixed" };
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
}
// Validate successful compilation of C++ example
TEST_F(CBuildAC6Tests, Build_AC6PP) {
TestParam param = { "AC6/Build_AC6PP", "Simulation" };
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
}
// Validate project compilation with inclusion of
// files or directory paths having whitespaces
TEST_F(CBuildAC6Tests, Whitespace) {
TestParam param = { "AC6/Whitespace", "Target_Name" };
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
}
// Validate project compilation having flag definitions and their usage
TEST_F(CBuildAC6Tests, Flags) {
TestParam param = { "AC6/Flags", "Target" };
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
}
// Verify and build project with assembly files
TEST_F(CBuildAC6Tests, Asm) {
TestParam param = { "AC6/Asm", "Target" };
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
}
// Verify and build project with single legacy assembly file
TEST_F(CBuildAC6Tests, ArmAsm) {
TestParam param = { "AC6/ArmAsm", "Target" };
RunCBuildScriptClean(param);
RunCBuildScript(param);
CheckCMakeLists(param);
const string outputFile = examples_folder + "/" + param.name + "/OutDir/Blinky.axf";
ASSERT_TRUE(fs::exists(outputFile));
}
// Validate project compilation having minimal configurations
TEST_F(CBuildAC6Tests, Minimal) {
TestParam param = { "AC6/Minimal", "MyProject" };
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
}
// Validate project with usage of nested groups and
// inheritance of flags in each group
TEST_F(CBuildAC6Tests, NestedGroups) {
TestParam param = { "AC6/NestedGroups", "Project" };
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
}
// Test project with directory inclusion with relative paths
TEST_F(CBuildAC6Tests, RelativePath) {
TestParam param = { "AC6/RelativePath", "Project" };
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
}
// Validate compilation of library
TEST_F(CBuildAC6Tests, Library) {
TestParam param = { "AC6/Library", "project" };
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
}
// Validate usage of secure objects in non secure project
TEST_F(CBuildAC6Tests, TrustZone_AC6) {
TestParam param = { "AC6/TrustZone/CM33_s", "FVP_Simulation_Model" };
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
param.name = "AC6/TrustZone/CM33_ns";
RunCBuildScriptClean (param);
RunCBuildScript (param);
CheckCMakeLists (param);
}
// Validate project with preincluded header paths and their usage
TEST_F(CBuildAC6Tests, PreInclude) {
TestParam param = { "Mixed/Pre Include", "Target", "", "", true };
RunScript("preinclude.sh", testout_folder);
RunCBuildScriptClean (param);
RunCBuildScriptWithArgs (param);
CheckCMakeLists (param);
}
// Validate RTE custom folder
TEST_F(CBuildAC6Tests, Build_AC6_CustomRTE) {
TestParam param = { "AC6/Build_AC6", "CustomRTE" };
RunCBuildScriptClean(param);
RunCBuildScript(param);
CheckRteDir(param, "Custom/RTEDIR");
}
// Validate Branch Protection
TEST_F(CBuildAC6Tests, Build_AC6_BranchProtection) {
TestParam param = { "AC6/BranchProtection", "Project" };
RunCBuildScriptClean(param);
RunCBuildScript(param);
CheckCMakeLists(param);
CheckCompileCommand(param.name, "-mbranch-protection=bti");
}