Skip to content

Commit 59c31eb

Browse files
dbortfacebook-github-bot
authored andcommitted
Add warning to test_profiler_e2e when building without prof_enabled=true
Summary: This test needs to be run in a special way but I didn't realize it when I was looking into a failure. Add some comments and assertions to save some time for the next person. Reviewed By: tarun292 Differential Revision: D47725995 fbshipit-source-id: 0d578d440f9acd33bc43d82c1b17fd98c5d76917
1 parent 2e97726 commit 59c31eb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

profiler/test/test_profiler_e2e.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
"""End-to-end profiler tests.
2+
3+
This must be built and run with `buck2 -c executorch.prof_enabled=true`.
4+
"""
5+
16
import unittest
27

38
import torch
@@ -50,6 +55,9 @@ def setUpClass(cls) -> None:
5055
cls.module.run_method("forward", tuple(cls.inputs_flattened))
5156
# pyre-ignore: Undefined attribute [16]: Module `executorch.extension.pybindings` has no attribute `portable`.
5257
prof_dump = _dump_profile_results()
58+
assert (
59+
len(prof_dump) > 0
60+
), "prof_dump is empty; may need to build with `-c executorch.prof_enabled=true`"
5361
cls.prof_results, cls.mem_results = deserialize_profile_results(prof_dump)
5462
cls.expect_ops = ["native_call_add.out", "native_call_mul.out"]
5563

@@ -65,6 +73,11 @@ def test_profiler_new_block(self) -> None:
6573
self.module.run_method("forward", tuple(self.inputs_flattened))
6674
# pyre-ignore: Undefined attribute [16]: Module `executorch.extension.pybindings` has no attribute `portable`.
6775
prof_dump = _dump_profile_results()
76+
self.assertGreater(
77+
len(prof_dump),
78+
0,
79+
"prof_dump is empty; may need to build with `-c executorch.prof_enabled=true`",
80+
)
6881
prof_results, mem_results = deserialize_profile_results(prof_dump)
6982
for i, (block_name_, _) in enumerate(prof_results.items()):
7083
self.assertTrue(block_names[i] == block_name_)

0 commit comments

Comments
 (0)