@@ -31,7 +31,7 @@ class critical_path_log:
31
31
potential_improvement_duration : str
32
32
33
33
34
- async def do_critical_path (buck : Buck , correct_analysis : bool ) -> None :
34
+ async def do_critical_path (buck : Buck ) -> None :
35
35
await buck .build ("//:step_3" , "--no-remote-cache" )
36
36
37
37
critical_path = (await buck .log ("critical-path" )).stdout .strip ().splitlines ()
@@ -57,13 +57,7 @@ async def do_critical_path(buck: Buck, correct_analysis: bool) -> None:
57
57
("materialization" , "root//:step_3" ),
58
58
("compute-critical-path" , "" ),
59
59
]
60
- if correct_analysis :
61
- assert len (critical_path ) == len (expected )
62
- else :
63
- # If correct_analysis = False (i.e. backend is the default), analysis nodes are not handled properly.
64
- # There is now non-determinism in this test since what we get back depends on
65
- # where the analysis becomes the longest path.
66
- assert len (trimmed_critical_path ) > 0
60
+ assert len (critical_path ) == len (expected )
67
61
68
62
for s , e in zip (reversed (trimmed_critical_path ), reversed (expected )):
69
63
if s .kind == "action" :
@@ -72,23 +66,16 @@ async def do_critical_path(buck: Buck, correct_analysis: bool) -> None:
72
66
else :
73
67
assert s .execution_kind == ""
74
68
75
- if not correct_analysis and s .kind == "analysis" :
76
- break
77
69
assert s .kind == e [0 ]
78
70
assert s .name == e [1 ]
79
71
80
72
81
- @buck_test ()
82
- async def test_critical_path (buck : Buck ) -> None :
83
- await do_critical_path (buck , False )
84
-
85
-
86
73
@buck_test ()
87
74
async def test_critical_path_longest_path_graph (buck : Buck ) -> None :
88
75
with open (buck .cwd / ".buckconfig" , "a" ) as f :
89
76
f .write ("[buck2]\n " )
90
77
f .write ("critical_path_backend2 = longest-path-graph\n " )
91
- await do_critical_path (buck , True )
78
+ await do_critical_path (buck )
92
79
93
80
94
81
@buck_test ()
@@ -103,7 +90,6 @@ async def test_critical_path_json(buck: Buck) -> None:
103
90
)
104
91
critical_path = [json .loads (e ) for e in critical_path ]
105
92
106
- assert len (critical_path ) > 0
107
93
expected = [
108
94
("time-spent-synchronizing-and-waiting" , None ),
109
95
("listing" , "root//" ),
@@ -119,15 +105,9 @@ async def test_critical_path_json(buck: Buck) -> None:
119
105
("materialization" , "root//:step_3" ),
120
106
("compute-critical-path" , None ),
121
107
]
108
+ assert len (critical_path ) == len (expected )
122
109
123
110
for critical , exp in zip (reversed (critical_path ), reversed (expected )):
124
- if critical ["kind" ] == "analysis" :
125
- # When the backend is the default, analysis nodes are not handled properly.
126
- # There is now non-determinism in this test since what we get back depends on
127
- # where the analysis becomes the longest path.
128
- # This is fixed when critical_path_backend2 = longest-path-graph.
129
- break
130
-
131
111
assert "kind" in critical
132
112
assert critical ["kind" ] == exp [0 ]
133
113
0 commit comments