Skip to content

Commit 8079496

Browse files
dbortfacebook-github-bot
authored andcommitted
Consolidate serialization tests
Summary: `test_program.py` already has a thorough set of serialization tests. Move over the one regression test from `test_serialize.py` and delete the old file and target. Reviewed By: larryliu0820 Differential Revision: D48366596 fbshipit-source-id: 39f7d5c556a5d7081ab119dceb0ee76297b139ef
1 parent 9b13bf0 commit 8079496

File tree

3 files changed

+12
-49
lines changed

3 files changed

+12
-49
lines changed

exir/serialize/test/test_program.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,18 @@ def test_round_trip_no_header_no_segments(self) -> None:
266266
# Programs should be the same.
267267
self.assert_programs_equal(program, program2)
268268

269+
def test_round_trip_large_buffer_sizes(self) -> None:
270+
"""Tests that when the non_const_buffer_sizes contains integers
271+
overflowing a signed/unsigned 32 bit integer, we can still serialize the
272+
model and get the same program by deserialization.
273+
"""
274+
program = get_test_program()
275+
program.execution_plan[0].non_const_buffer_sizes = [0, 2**48]
276+
flatbuffer_from_py = serialize_to_flatbuffer(program)
277+
self.assert_programs_equal(
278+
program, deserialize_from_flatbuffer(flatbuffer_from_py)
279+
)
280+
269281
def test_round_trip_with_header_no_segments(self) -> None:
270282
"""Tests that a Program remains the same after serializing and
271283
deserializing, even when it contains an extended header.

exir/tests/TARGETS

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,6 @@ python_unittest(
111111
],
112112
)
113113

114-
python_unittest(
115-
name = "serialize",
116-
srcs = [
117-
"test_serialize.py",
118-
],
119-
deps = [
120-
":lib",
121-
"//executorch/exir:print_program",
122-
"//executorch/exir/serialize:lib",
123-
],
124-
)
125-
126114
python_unittest(
127115
name = "tensor",
128116
srcs = [

exir/tests/test_serialize.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)