Skip to content

Commit 09e65c7

Browse files
NickGerlemanmeta-codesync[bot]
authored andcommitted
Make gentest faster and more reliable (#1889)
Summary: Pull Request resolved: #1889 This change used Claude to make some major quality of life changes to `yarn gentest`. The bulk of the logic is now run in the driver, instead of the browser, and the scripts are typechecked. We rely on attributes, instead of declared style in DOM, so that we don't miss inputs the browser massages. We no longer preprocess the fixtures, to remap invalid CSS properties to valid ones. Generation now happens in parallel. We avoid outputting temp files to source root. From there, I looked over major parts, and had it clean up a lot of things to taste, but I let it try to do a full rewrite for simplicity, using the original as reference. It is about neutral in terms of line count Reviewed By: sammy-SC Differential Revision: D94005983
1 parent 03e076d commit 09e65c7

100 files changed

Lines changed: 9831 additions & 10851 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

gentest/fixtures/YGAbsolutePositionTest.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div id="absolute_layout_width_height_start_top" style="width: 100px; height: 100px;">
2-
<div style="width:10px; height: 10px; position: absolute; start: 10px; top: 10px;"></div>
2+
<div style="width:10px; height: 10px; position: absolute; inset-inline-start: 10px; top: 10px;"></div>
33
</div>
44

55
<div id="absolute_layout_width_height_left_auto_right" style="width: 100px; height: 100px">
@@ -15,20 +15,20 @@
1515
</div>
1616

1717
<div id="absolute_layout_width_height_end_bottom" style="width: 100px; height: 100px;">
18-
<div style="width:10px; height: 10px; position: absolute; end: 10px; bottom: 10px;"></div>
18+
<div style="width:10px; height: 10px; position: absolute; inset-inline-end: 10px; bottom: 10px;"></div>
1919
</div>
2020

2121
<div id="absolute_layout_start_top_end_bottom" style="width: 100px; height: 100px;">
22-
<div style="position: absolute; start: 10px; top: 10px; end: 10px; bottom: 10px;"></div>
22+
<div style="position: absolute; inset-inline-start: 10px; top: 10px; inset-inline-end: 10px; bottom: 10px;"></div>
2323
</div>
2424

2525
<div id="absolute_layout_width_height_start_top_end_bottom" style="width: 100px; height: 100px;">
26-
<div style="width:10px; height: 10px; position: absolute; start: 10px; top: 10px; end: 10px; bottom: 10px;"></div>
26+
<div style="width:10px; height: 10px; position: absolute; inset-inline-start: 10px; top: 10px; inset-inline-end: 10px; bottom: 10px;"></div>
2727
</div>
2828

2929
<div id="do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent"
3030
style="height: 50px; width: 50px; overflow: hidden; flex-direction: row;">
31-
<div style="position: absolute; start: 0px; top: 0px;">
31+
<div style="position: absolute; inset-inline-start: 0px; top: 0px;">
3232
<div style="width: 100px; height: 100px;"></div>
3333
</div>
3434
</div>

gentest/fixtures/YGAndroidNewsFeed.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div layout="width: 1080; height: 444; top: 0; left: 0;" style="flex-shrink: 0; " >
33
<div layout="width: 1080; height: 444; top: 0; left: 0;" style="align-content: stretch; " >
44
<div layout="width: 1080; height: 226; top: 0; left: 0;" style="align-content: stretch; " >
5-
<div layout="width: 1044; height: 202; top: 24; left: 36;" style="flex-direction: row; align-items: flex-start; align-content: stretch; margin-top: 24px; margin-start: 36px; " >
5+
<div layout="width: 1044; height: 202; top: 24; left: 36;" style="flex-direction: row; align-items: flex-start; align-content: stretch; margin-top: 24px; margin-inline-start: 36px; " >
66
<div layout="width: 120; height: 120; top: 0; left: 0;" style="flex-direction: row; align-content: stretch; flex-shrink: 0; " >
77
<div layout="width: 120; height: 120; top: 0; left: 0;" style="align-content: stretch; flex-shrink: 0; width: 120px; height: 120px; " has-custom-measure="true"></div>
88
</div>
@@ -13,7 +13,7 @@
1313
</div>
1414
</div>
1515
<div layout="width: 1080; height: 218; top: 226; left: 0;" style="align-content: stretch; " >
16-
<div layout="width: 906; height: 194; top: 24; left: 174;" style="flex-direction: row; align-items: flex-start; align-content: stretch; margin-top: 24px; margin-start: 174px; " >
16+
<div layout="width: 906; height: 194; top: 24; left: 174;" style="flex-direction: row; align-items: flex-start; align-content: stretch; margin-top: 24px; margin-inline-start: 174px; " >
1717
<div layout="width: 72; height: 72; top: 12; left: 0;" style="flex-direction: row; align-content: stretch; flex-shrink: 0; " >
1818
<div layout="width: 72; height: 72; top: 0; left: 0;" style="align-content: stretch; flex-shrink: 0; width: 72px; height: 72px; " has-custom-measure="true"></div>
1919
</div>

gentest/fixtures/YGBorderTest.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
<div style="height: 10px;"></div>
1414
</div>
1515

16-
<div id="border_center_child" style="width: 100px; height: 100px; border-start-width: 10px; border-top-width: 10; border-end-width: 20px; border-bottom-width: 20px; align-items: center; justify-content: center;">
16+
<div id="border_center_child" style="width: 100px; height: 100px; border-inline-start-width: 10px; border-top-width: 10; border-inline-end-width: 20px; border-bottom-width: 20px; align-items: center; justify-content: center;">
1717
<div style="height: 10px; width: 10px;"></div>
1818
</div>

gentest/fixtures/YGBoxSizingTest.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,33 +220,33 @@
220220
</div>
221221

222222
<div id="box_sizing_content_box_padding_start"
223-
style="width: 100px; height: 100px; padding-start: 5px; box-sizing: content-box">
223+
style="width: 100px; height: 100px; padding-inline-start: 5px; box-sizing: content-box">
224224
</div>
225225

226226
<div id="box_sizing_border_box_padding_start"
227-
style="width: 100px; height: 100px; padding-start: 5px; box-sizing: border-box">
227+
style="width: 100px; height: 100px; padding-inline-start: 5px; box-sizing: border-box">
228228
</div>
229229

230230
<div id="box_sizing_content_box_padding_end"
231-
style="width: 100px; height: 100px; padding-end: 5px; box-sizing: content-box">
231+
style="width: 100px; height: 100px; padding-inline-end: 5px; box-sizing: content-box">
232232
</div>
233233

234234
<div id="box_sizing_border_box_padding_end"
235-
style="width: 100px; height: 100px; padding-end: 5px; box-sizing: border-box">
235+
style="width: 100px; height: 100px; padding-inline-end: 5px; box-sizing: border-box">
236236
</div>
237237

238238
<div id="box_sizing_content_box_border_start"
239-
style="width: 100px; height: 100px; border-start-width: 5px; box-sizing: content-box">
239+
style="width: 100px; height: 100px; border-inline-start-width: 5px; box-sizing: content-box">
240240
</div>
241241

242242
<div id="box_sizing_border_box_border_start"
243-
style="width: 100px; height: 100px; border-start-width: 5px; box-sizing: border-box">
243+
style="width: 100px; height: 100px; border-inline-start-width: 5px; box-sizing: border-box">
244244
</div>
245245

246246
<div id="box_sizing_content_box_border_end"
247-
style="width: 100px; height: 100px; border-end-width: 5px; box-sizing: content-box">
247+
style="width: 100px; height: 100px; border-inline-end-width: 5px; box-sizing: content-box">
248248
</div>
249249

250250
<div id="box_sizing_border_box_border_end"
251-
style="width: 100px; height: 100px; border-end-width: 5px; box-sizing: border-box">
251+
style="width: 100px; height: 100px; border-inline-end-width: 5px; box-sizing: border-box">
252252
</div>

gentest/fixtures/YGFlexDirectionTest.html

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
<div style="width: 10px;"></div>
4242
</div>
4343

44-
<!-- gentest.rb will swap margin-start to margin-left. This is needed to use YGEdgeStart instead of YGEdgeLeft in the generated tests -->
44+
<!-- margin-inline-start maps to YGEdgeStart in the generated tests -->
4545
<div id="flex_direction_row_reverse_margin_start"
46-
style="height: 100px; width: 100px; flex-direction: row-reverse; margin-start: 100px;">
46+
style="height: 100px; width: 100px; flex-direction: row-reverse; margin-inline-start: 100px;">
4747
<div style="width: 10px;"></div>
4848
<div style="width: 10px;"></div>
4949
<div style="width: 10px;"></div>
@@ -57,7 +57,7 @@
5757
</div>
5858

5959
<div id="flex_direction_row_reverse_margin_end"
60-
style="height: 100px; width: 100px; flex-direction: row-reverse; margin-end: 100px;">
60+
style="height: 100px; width: 100px; flex-direction: row-reverse; margin-inline-end: 100px;">
6161
<div style="width: 10px;"></div>
6262
<div style="width: 10px;"></div>
6363
<div style="width: 10px;"></div>
@@ -85,7 +85,7 @@
8585
</div>
8686

8787
<div id="flex_direction_row_reverse_padding_start"
88-
style="height: 100px; width: 100px; flex-direction: row-reverse; padding-start: 100px;">
88+
style="height: 100px; width: 100px; flex-direction: row-reverse; padding-inline-start: 100px;">
8989
<div style="width: 10px;"></div>
9090
<div style="width: 10px;"></div>
9191
<div style="width: 10px;"></div>
@@ -99,7 +99,7 @@
9999
</div>
100100

101101
<div id="flex_direction_row_reverse_padding_end"
102-
style="height: 100px; width: 100px; flex-direction: row-reverse; padding-end: 100px;">
102+
style="height: 100px; width: 100px; flex-direction: row-reverse; padding-inline-end: 100px;">
103103
<div style="width: 10px;"></div>
104104
<div style="width: 10px;"></div>
105105
<div style="width: 10px;"></div>
@@ -127,7 +127,7 @@
127127
</div>
128128

129129
<div id="flex_direction_row_reverse_border_start"
130-
style="height: 100px; width: 100px; flex-direction: row-reverse; border-start-width: 100px;">
130+
style="height: 100px; width: 100px; flex-direction: row-reverse; border-inline-start-width: 100px;">
131131
<div style="width: 10px;"></div>
132132
<div style="width: 10px;"></div>
133133
<div style="width: 10px;"></div>
@@ -141,7 +141,7 @@
141141
</div>
142142

143143
<div id="flex_direction_row_reverse_border_end"
144-
style="height: 100px; width: 100px; flex-direction: row-reverse; border-end-width: 100px;">
144+
style="height: 100px; width: 100px; flex-direction: row-reverse; border-inline-end-width: 100px;">
145145
<div style="width: 10px;"></div>
146146
<div style="width: 10px;"></div>
147147
<div style="width: 10px;"></div>
@@ -170,7 +170,7 @@
170170
</div>
171171

172172
<div id="flex_direction_row_reverse_pos_start" style="height: 100px; width: 100px;">
173-
<div style="height: 100px; width: 100px; flex-direction: row-reverse; start: 100px;">
173+
<div style="height: 100px; width: 100px; flex-direction: row-reverse; inset-inline-start: 100px;">
174174
<div style="width: 10px;"></div>
175175
<div style="width: 10px;"></div>
176176
<div style="width: 10px;"></div>
@@ -186,7 +186,7 @@
186186
</div>
187187

188188
<div id="flex_direction_row_reverse_pos_end" style="height: 100px; width: 100px;">
189-
<div style="height: 100px; width: 100px; flex-direction: row-reverse; end: 100px;">
189+
<div style="height: 100px; width: 100px; flex-direction: row-reverse; inset-inline-end: 100px;">
190190
<div style="width: 10px;"></div>
191191
<div style="width: 10px;"></div>
192192
<div style="width: 10px;"></div>
@@ -243,15 +243,15 @@
243243

244244
<div id="flex_direction_row_reverse_inner_pos_start" data-disabled="true" style="height: 100px; width: 100px;">
245245
<div style="height: 100px; width: 100px; flex-direction: row-reverse; ">
246-
<div style="width: 10px; height: 10px; position: absolute; start: 10px"></div>
246+
<div style="width: 10px; height: 10px; position: absolute; inset-inline-start: 10px"></div>
247247
<div style="width: 10px;"></div>
248248
<div style="width: 10px;"></div>
249249
</div>
250250
</div>
251251

252252
<div id="flex_direction_row_reverse_inner_pos_end" data-disabled="true" style="height: 100px; width: 100px;">
253253
<div style="height: 100px; width: 100px; flex-direction: row-reverse; ">
254-
<div style="width: 10px; height: 10px; position: absolute; end: 10px"></div>
254+
<div style="width: 10px; height: 10px; position: absolute; inset-inline-end: 10px"></div>
255255
<div style="width: 10px;"></div>
256256
<div style="width: 10px;"></div>
257257
</div>
@@ -291,15 +291,15 @@
291291

292292
<div id="flex_direction_row_reverse_inner_marign_start" style="height: 100px; width: 100px;">
293293
<div style="height: 100px; width: 100px; flex-direction: row-reverse; ">
294-
<div style="width: 10px; height: 10px; position: absolute; margin-start: 10px"></div>
294+
<div style="width: 10px; height: 10px; position: absolute; margin-inline-start: 10px"></div>
295295
<div style="width: 10px;"></div>
296296
<div style="width: 10px;"></div>
297297
</div>
298298
</div>
299299

300300
<div id="flex_direction_row_reverse_inner_margin_end" style="height: 100px; width: 100px;">
301301
<div style="height: 100px; width: 100px; flex-direction: row-reverse; ">
302-
<div style="width: 10px; height: 10px; position: absolute; margin-end: 10px"></div>
302+
<div style="width: 10px; height: 10px; position: absolute; margin-inline-end: 10px"></div>
303303
<div style="width: 10px;"></div>
304304
<div style="width: 10px;"></div>
305305
</div>
@@ -339,15 +339,15 @@
339339

340340
<div id="flex_direction_row_reverse_inner_border_start" style="height: 100px; width: 100px;">
341341
<div style="height: 100px; width: 100px; flex-direction: row-reverse; ">
342-
<div style="width: 10px; height: 10px; position: absolute; border-start: 10px solid black"></div>
342+
<div style="width: 10px; height: 10px; position: absolute; border-inline-start: 10px solid black"></div>
343343
<div style="width: 10px;"></div>
344344
<div style="width: 10px;"></div>
345345
</div>
346346
</div>
347347

348348
<div id="flex_direction_row_reverse_inner_border_end" style="height: 100px; width: 100px;">
349349
<div style="height: 100px; width: 100px; flex-direction: row-reverse; ">
350-
<div style="width: 10px; height: 10px; position: absolute; border-end: 10px solid black"></div>
350+
<div style="width: 10px; height: 10px; position: absolute; border-inline-end: 10px solid black"></div>
351351
<div style="width: 10px;"></div>
352352
<div style="width: 10px;"></div>
353353
</div>
@@ -387,15 +387,15 @@
387387

388388
<div id="flex_direction_row_reverse_inner_padding_start" style="height: 100px; width: 100px;">
389389
<div style="height: 100px; width: 100px; flex-direction: row-reverse; ">
390-
<div style="width: 10px; height: 10px; position: absolute; padding-start: 10px"></div>
390+
<div style="width: 10px; height: 10px; position: absolute; padding-inline-start: 10px"></div>
391391
<div style="width: 10px;"></div>
392392
<div style="width: 10px;"></div>
393393
</div>
394394
</div>
395395

396396
<div id="flex_direction_row_reverse_inner_padding_end" style="height: 100px; width: 100px;">
397397
<div style="height: 100px; width: 100px; flex-direction: row-reverse; ">
398-
<div style="width: 10px; height: 10px; position: absolute; padding-end: 10px"></div>
398+
<div style="width: 10px; height: 10px; position: absolute; padding-inline-end: 10px"></div>
399399
<div style="width: 10px;"></div>
400400
<div style="width: 10px;"></div>
401401
</div>

gentest/fixtures/YGFlexWrapTest.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div id="wrap_column" style="height: 100px; flex-wrap: wrap">
1+
<div data-disabled="true" id="wrap_column" style="height: 100px; flex-wrap: wrap">
22
<div style="height: 30px; width: 30px;"></div>
33
<div style="height: 30px; width: 30px;"></div>
44
<div style="height: 30px; width: 30px;"></div>

gentest/fixtures/YGMarginTest.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<div id="margin_start" style="width: 100px; height: 100px; flex-direction: row;">
2-
<div style="width: 10px; margin-start: 10px;"></div>
2+
<div style="width: 10px; margin-inline-start: 10px;"></div>
33
</div>
44

55
<div id="margin_top" style="width: 100px; height: 100px;">
66
<div style="height: 10px; margin-top: 10px;"></div>
77
</div>
88

99
<div id="margin_end" style="width: 100px; height: 100px; flex-direction: row; justify-content: flex-end;">
10-
<div style="width: 10px; margin-end: 10px;"></div>
10+
<div style="width: 10px; margin-inline-end: 10px;"></div>
1111
</div>
1212

1313
<div id="margin_bottom" style="width: 100px; height: 100px; justify-content: flex-end;">
1414
<div style="height: 10px; margin-bottom: 10px;"></div>
1515
</div>
1616

1717
<div id="margin_and_flex_row" style="width: 100px; height: 100px; flex-direction: row;">
18-
<div style="margin-start: 10px; margin-end: 10px; flex-grow: 1;"></div>
18+
<div style="margin-inline-start: 10px; margin-inline-end: 10px; flex-grow: 1;"></div>
1919
</div>
2020

2121
<div id="margin_and_flex_column" style="width: 100px; height: 100px;">
@@ -27,11 +27,11 @@
2727
</div>
2828

2929
<div id="margin_and_stretch_column" style="width: 100px; height: 100px;">
30-
<div style="margin-start: 10px; margin-end: 10px; flex-grow: 1;"></div>
30+
<div style="margin-inline-start: 10px; margin-inline-end: 10px; flex-grow: 1;"></div>
3131
</div>
3232

3333
<div id="margin_with_sibling_row" style="width: 100px; height: 100px; flex-direction: row;">
34-
<div style="margin-end: 10px; flex-grow: 1;"></div>
34+
<div style="margin-inline-end: 10px; flex-grow: 1;"></div>
3535
<div style="flex-grow: 1;"></div>
3636
</div>
3737

@@ -83,12 +83,12 @@
8383
</div>
8484

8585
<div id="margin_auto_start_and_end_column" style="width: 200px; height: 200px; align-items: center; flex-direction: row;">
86-
<div style="width: 50px; height: 50px; margin-start: auto; margin-end: auto;"></div>
86+
<div style="width: 50px; height: 50px; margin-inline-start: auto; margin-inline-end: auto;"></div>
8787
<div style="width: 50px; height: 50px;"></div>
8888
</div>
8989

9090
<div id="margin_auto_start_and_end" style="width: 200px; height: 200px; ">
91-
<div style="width: 50px; height: 50px; margin-start: auto; margin-end: auto;"></div>
91+
<div style="width: 50px; height: 50px; margin-inline-start: auto; margin-inline-end: auto;"></div>
9292
<div style="width: 50px; height: 50px;"></div>
9393
</div>
9494

gentest/fixtures/YGPaddingTest.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</div>
1515

1616
<div id="padding_center_child"
17-
style="width: 100px; height: 100px; padding-start: 10px; padding-top: 10; padding-end: 20px; padding-bottom: 20px; align-items: center; justify-content: center;">
17+
style="width: 100px; height: 100px; padding-inline-start: 10px; padding-top: 10; padding-inline-end: 20px; padding-bottom: 20px; align-items: center; justify-content: center;">
1818
<div style="height: 10px; width: 10px;"></div>
1919
</div>
2020

@@ -24,6 +24,6 @@
2424
</div>
2525

2626
<div id="physical_and_relative_edge_defined"
27-
style="width: 200px; height: 200px; padding-left: 20px; padding-end: 50px;">
27+
style="width: 200px; height: 200px; padding-left: 20px; padding-inline-end: 50px;">
2828
<div style="width: 100%; height: 50px;"></div>
2929
</div>

gentest/fixtures/YGStaticPositionTest.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@
432432
<div
433433
style="height:200px; width: 200px; position: static; margin: 6px 3px 9px 8px; border-width: 10px 2px 1px 8px; padding: 7px 9px 4px 1px">
434434
<div
435-
style="height: 63%; width: 41%; position: absolute; start: 12px; margin: 12px 4px 7px 9px; border-width: 1px 5px 9px 2px; padding: 3px 8px 10px 5px">
435+
style="height: 63%; width: 41%; position: absolute; inset-inline-start: 12px; margin: 12px 4px 7px 9px; border-width: 1px 5px 9px 2px; padding: 3px 8px 10px 5px">
436436
</div>
437437
</div>
438438
</div>
@@ -444,7 +444,7 @@
444444
<div
445445
style="height:200px; width: 200px; position: static; margin: 6px 3px 9px 8px; border-width: 10px 2px 1px 8px; padding: 7px 9px 4px 1px">
446446
<div
447-
style="height: 63%; width: 41%; position: absolute; end: 4px; margin: 12px 4px 7px 9px; border-width: 1px 5px 9px 2px; padding: 3px 8px 10px 5px">
447+
style="height: 63%; width: 41%; position: absolute; inset-inline-end: 4px; margin: 12px 4px 7px 9px; border-width: 1px 5px 9px 2px; padding: 3px 8px 10px 5px">
448448
</div>
449449
</div>
450450
</div>

0 commit comments

Comments
 (0)