Enable Render test CI (#837)

Co-authored-by: wei chen <wei.chen@grabtaxi.com>
This commit is contained in:
Wei Chen
2023-02-22 19:48:24 +08:00
committed by GitHub
parent c967074af3
commit ea9091fc98
70 changed files with 716 additions and 130 deletions

View File

@@ -158,7 +158,7 @@ jobs:
- name: Run render tests on macOS
if: runner.os == 'macOS'
run: ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json
run: set -o pipefail && ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json
- name: Upload render test artifacts
uses: actions/upload-artifact@v3

View File

@@ -13,7 +13,7 @@
],
"gfx": [
[
"probeGFX - default - end",
"probeGFX - default1 - end",
2,
6,
12,

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
0,
0
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
4,
9,
13,
1,
[
65552,
65552
],
[
94,
94
],
[
448,
448
]
]
]
}

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
4,
13,
21,
19,
1,
[
87892,
87892
87924,
87924
],
[
1578,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
4,
13,
21,
19,
1,
[
87892,
87892
87924,
87924
],
[
102,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
4,
13,
21,
19,
1,
[
156088,
156088
156120,
156120
],
[
790,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
2,
4,
6,
12,
1,
[
71936,
71936
71944,
71944
],
[
30814,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
2,
4,
6,
12,
1,
[
71936,
71936
71944,
71944
],
[
30814,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
4,
5,
8,
19,
1,
[
36896,
36896
36908,
36908
],
[
26342,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
16,
25,
41,
61,
1,
[
276736,
276736
276800,
276800
],
[
51862,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
16,
36,
60,
61,
1,
[
413280,
413280
413376,
413376
],
[
7062,

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
0,
0
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
3,
3,
10,
1,
[
32768,
32768
],
[
214,
214
],
[
664,
664
]
]
]
}

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
2,
4,
6,
12,
1,
[
21120,
21120
21128,
21128
],
[
50,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
6,
7,
7,
1,
[
2139136,
2139136
2139140,
2139140
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
13,
14,
7,
1,
[
2253824,
2253824
2253828,
2253828
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
6,
7,
7,
1,
[
2139136,
2139136
2139140,
2139140
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
6,
7,
7,
1,
[
2139136,
2139136
2139140,
2139140
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
6,
7,
7,
1,
[
2139136,
2139136
2139140,
2139140
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
6,
7,
7,
1,
[
2139136,
2139136
2139140,
2139140
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
3,
4,
7,
1,
[
2089984,
2089984
2089988,
2089988
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
6,
7,
7,
1,
[
2139136,
2139136
2139140,
2139140
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
6,
7,
7,
1,
[
2139136,
2139136
2139140,
2139140
],
[
34,

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
0,
0
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
6,
8,
20,
1,
[
34048,
34048
],
[
58,
58
],
[
784,
784
]
]
]
}

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
0,
0
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
4,
6,
9,
1,
[
66560,
66560
],
[
94,
94
],
[
192,
192
]
]
]
}

View File

@@ -2,8 +2,8 @@
"network": [
[
"probeNetwork - default - end",
8,
246523
5,
178378
],
[
"probeNetwork - default - start",
@@ -14,21 +14,21 @@
"gfx": [
[
"probeGFX - default - end",
103,
15,
207,
23,
8,
51,
1,
[
207972,
207972
53024,
53024
],
[
162572,
162572
43734,
43734
],
[
512168,
512168
151604,
151604
]
]
]

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
3,
4,
7,
1,
[
2089984,
2089984
2089988,
2089988
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
3,
4,
7,
1,
[
2089984,
2089984
2089988,
2089988
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
2,
4,
5,
7,
1,
[
2106368,
2106368
2106372,
2106372
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
1,
3,
4,
7,
1,
[
2089984,
2089984
2089988,
2089988
],
[
34,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
2,
4,
6,
12,
1,
[
35828,
35828
35836,
35836
],
[
86,

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
0,
0
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
2,
3,
7,
1,
[
32768,
32768
],
[
34,
34
],
[
96,
96
]
]
]
}

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
4,
45,
85,
19,
1,
[
662656,
662656
662816,
662816
],
[
438,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
2,
60,
110,
12,
1,
[
864279,
864279
864479,
864479
],
[
898,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
4,
7,
11,
9,
1,
[
92941,
92941
92957,
92957
],
[
358,

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
6,
268053
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
10,
22,
32,
4,
[
158509,
158509
],
[
712,
712
],
[
4576,
4576
]
]
]
}

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
8,
1755006
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
20,
24,
60,
4,
[
131780,
131780
],
[
102328,
102328
],
[
600256,
600256
]
]
]
}

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
8,
9,
15,
25,
1,
[
98642,
98642
98666,
98666
],
[
40606,

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
2,
211659
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
3,
7,
13,
1,
[
53920,
53920
],
[
58,
58
],
[
544,
544
]
]
]
}

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
2,
4,
6,
12,
1,
[
35828,
35828
35836,
35836
],
[
86,

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
1,
84942
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
1,
21,
9,
1,
[
215688,
215688
],
[
58,
58
],
[
544,
544
]
]
]
}

View File

@@ -2,8 +2,8 @@
"network": [
[
"probeNetwork - default - end",
13,
2413450
16,
2668276
],
[
"probeNetwork - default - start",
@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
8,
16,
24,
36,
4,
[
143312,
143312
143344,
143344
],
[
194056,

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
4,
4,
6,
19,
1,
[
32035,
32035
32043,
32043
],
[
422,

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
22,
3183754
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
12,
24,
52,
4,
[
296872,
296872
],
[
79084,
79084
],
[
1053536,
1053536
]
]
]
}

View File

@@ -15,12 +15,12 @@
[
"probeGFX - default - end",
8,
15,
25,
33,
1,
[
176080,
176080
176120,
176120
],
[
101270,

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
0,
0
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
4,
4,
10,
1,
[
49152,
49152
],
[
66,
66
],
[
100,
100
]
]
]
}

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
1,
84942
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
13,
17,
21,
1,
[
207208,
207208
],
[
210,
210
],
[
944,
944
]
]
]
}

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
0,
0
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
16,
13,
29,
1,
[
196608,
196608
],
[
246,
246
],
[
528,
528
]
]
]
}

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
2,
211659
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
13,
17,
22,
1,
[
154848,
154848
],
[
174,
174
],
[
528,
528
]
]
]
}

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
0,
0
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
5,
4,
13,
1,
[
49152,
49152
],
[
286,
286
],
[
528,
528
]
]
]
}

View File

@@ -0,0 +1,35 @@
{
"network": [
[
"probeNetwork - default - end",
1,
84942
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
13,
17,
22,
1,
[
207700,
207700
],
[
246,
246
],
[
1680,
1680
]
]
]
}

View File

@@ -31,7 +31,8 @@
"puck_hat.png",
{"pixelRatio": 4.0}
]
]
],
"ignoreProbing": true
}
},
"sources": {

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.766707, 35.693055 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"sources": {

View File

@@ -24,7 +24,8 @@
"puck_shadow.png",
{"pixelRatio": 2.0}
]
]
],
"ignoreProbing": true
}
},
"sources": {

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.766707, 35.693055 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.766707, 35.693055 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.766707, 35.693055 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.766707, 35.693055 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.766707, 35.693055 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.766707, 35.693055 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.766707, 35.693055 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.768885, 35.693125 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.766487, 35.694867 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.766972, 35.687286 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.759723, 35.692799 ],

View File

@@ -20,7 +20,8 @@
"puck_shadow",
"puck_shadow.png"
]
]
],
"ignoreProbing": true
}
},
"center": [ 139.766707, 35.693055 ],

View File

@@ -138,6 +138,11 @@ struct TestMetadata {
bool renderTest = true;
bool outputsImage = true;
bool ignoredTest = false;
// If unit test hasn't metric.json, the unit test will end with
// error message: "Failed to find expectations for..., to prevent
// unit test error by missing metric.json, can turn on 'ignoreProbing'
// to prevent the unit test fail, and just verify the render result.
bool ignoreProbing = false;
mbgl::Size size{ 512u, 512u };
float pixelRatio = 1.0f;

View File

@@ -564,6 +564,12 @@ TestMetadata parseTestMetadata(const TestPaths& paths) {
}
metadata.renderTest = false;
}
if (testValue.HasMember("ignoreProbing")) {
if (testValue["ignoreProbing"].IsBool()) {
metadata.ignoreProbing = testValue["ignoreProbing"].GetBool();
}
}
if (testValue.HasMember("queryOptions")) {
assert(testValue["queryOptions"].IsObject());
@@ -997,7 +1003,6 @@ TestOperations parseTestOperations(TestMetadata& metadata) {
} else if (operationArray[0].GetString() == networkProbeStartOp) {
// probeNetworkStart
result.emplace_back([](TestContext&) {
assert(!mbgl::ProxyFileSource::isTrackingActive());
mbgl::ProxyFileSource::setTrackingActive(true);
return true;
});
@@ -1007,7 +1012,6 @@ TestOperations parseTestOperations(TestMetadata& metadata) {
assert(operationArray[1].IsString());
std::string mark = std::string(operationArray[1].GetString(), operationArray[1].GetStringLength());
result.emplace_back([mark](TestContext& ctx) {
assert(mbgl::ProxyFileSource::isTrackingActive());
ctx.getMetadata().metrics.network.emplace(
std::piecewise_construct,
std::forward_as_tuple(std::move(mark)),
@@ -1018,7 +1022,6 @@ TestOperations parseTestOperations(TestMetadata& metadata) {
} else if (operationArray[0].GetString() == networkProbeEndOp) {
// probeNetworkEnd
result.emplace_back([](TestContext&) {
assert(mbgl::ProxyFileSource::isTrackingActive());
mbgl::ProxyFileSource::setTrackingActive(false);
return true;
});
@@ -1252,7 +1255,6 @@ TestOperations parseTestOperations(TestMetadata& metadata) {
} else if (operationArray[0].GetString() == gfxProbeStartOp) {
// probeGFXStart
result.emplace_back([](TestContext& ctx) {
assert(!ctx.gfxProbeActive);
ctx.gfxProbeActive = true;
ctx.baselineGfxProbe = ctx.activeGfxProbe;
return true;

View File

@@ -225,12 +225,14 @@ int runRenderTests(int argc, char** argv, std::function<void()> testStatus) {
status = "errored";
color = "red";
stats.erroredTests++;
returnCode = 2;
printf(ANSI_COLOR_RED "* errored %s" ANSI_COLOR_RESET "\n", id.c_str());
printf(ANSI_COLOR_RED "* error: %s" ANSI_COLOR_RESET "\n", metadata.errorMessage.c_str());
} else {
status = "failed";
color = "red";
stats.failedTests++;
returnCode = 3;
printf(ANSI_COLOR_RED "* failed %s" ANSI_COLOR_RESET "\n", id.c_str());
}
}

View File

@@ -629,7 +629,6 @@ TestOperations getAfterOperations(const Manifest& manifest) {
}
if (networkProbeOp == probe) {
result.emplace_back([](TestContext& ctx) {
assert(ProxyFileSource::isTrackingActive());
ctx.getMetadata().metrics.network.emplace(
std::piecewise_construct,
std::forward_as_tuple(networkProbeOp + mark),
@@ -864,7 +863,9 @@ void TestRunner::run(TestMetadata& metadata) {
}
if (metadata.renderTest) {
checkProbingResults(metadata);
if (!metadata.ignoreProbing) {
checkProbingResults(metadata);
}
appendLabelCutOffResults(metadata, cutOffLabelsReport, duplicationsReport);
checkRenderTestResults(std::move(result.image), metadata);
} else {