@@ -65,15 +65,15 @@ TEST_F(TensorUtilTest, SameShapesDifferentDtypes) {
6565 ET_CHECK_SAME_SHAPE3 (a, b, c);
6666
6767 // Not the same dtypes. Check both positions.
68- ET_EXPECT_DEATH (ET_CHECK_SAME_DTYPE2 (a, b), " " );
69- ET_EXPECT_DEATH (ET_CHECK_SAME_DTYPE2 (b, a), " " );
70- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE2 (a, b), " " );
71- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE2 (b, a), " " );
68+ ET_EXPECT_DEATH (ET_CHECK_SAME_DTYPE2 (a, b), " Tensors do not match " );
69+ ET_EXPECT_DEATH (ET_CHECK_SAME_DTYPE2 (b, a), " Tensors do not match " );
70+ ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE2 (a, b), " Tensors do not match " );
71+ ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE2 (b, a), " Tensors do not match " );
7272
7373 // Test with a mismatching tensor in all positions, where the other two agree.
74- ET_EXPECT_DEATH (ET_CHECK_SAME_DTYPE3 (a, b, b), " " );
75- ET_EXPECT_DEATH (ET_CHECK_SAME_DTYPE3 (b, a, b), " " );
76- ET_EXPECT_DEATH (ET_CHECK_SAME_DTYPE3 (b, b, a), " " );
74+ ET_EXPECT_DEATH (ET_CHECK_SAME_DTYPE3 (a, b, b), " Tensors do not match " );
75+ ET_EXPECT_DEATH (ET_CHECK_SAME_DTYPE3 (b, a, b), " Tensors do not match " );
76+ ET_EXPECT_DEATH (ET_CHECK_SAME_DTYPE3 (b, b, a), " Tensors do not match " );
7777 ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE3 (a, b, b), " " );
7878 ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE3 (b, a, b), " " );
7979 ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE3 (b, b, a), " " );
@@ -88,13 +88,13 @@ TEST_F(TensorUtilTest, DifferentShapesSameDtypes) {
8888 Tensor b2 = tf_int_.ones ({2 , 2 });
8989
9090 // The different tensors are not the same shape. Check both positions.
91- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE2 (a, b), " " );
92- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE2 (b, a), " " );
91+ ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE2 (a, b), " Tensors do not match " );
92+ ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE2 (b, a), " Tensors do not match " );
9393
9494 // Test with the different tensor in all positions.
95- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE3 (a, b, b2), " " );
96- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE3 (b, a, b2), " " );
97- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE3 (b, b2, a), " " );
95+ ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE3 (a, b, b2), " Tensors do not match " );
96+ ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE3 (b, a, b2), " Tensors do not match " );
97+ ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE3 (b, b2, a), " Tensors do not match " );
9898
9999 // They are the same dtypes.
100100 ET_CHECK_SAME_DTYPE2 (a, b);
@@ -104,11 +104,14 @@ TEST_F(TensorUtilTest, DifferentShapesSameDtypes) {
104104 ET_CHECK_SAME_DTYPE3 (b, b2, a);
105105
106106 // But not the same shape-and-dtype.
107- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE2 (a, b), " " );
108- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE2 (b, a), " " );
109- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE3 (a, b, b2), " " );
110- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE3 (b, a, b2), " " );
111- ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE3 (b, b2, a), " " );
107+ ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE2 (a, b), " Tensors do not match" );
108+ ET_EXPECT_DEATH (ET_CHECK_SAME_SHAPE_AND_DTYPE2 (b, a), " Tensors do not match" );
109+ ET_EXPECT_DEATH (
110+ ET_CHECK_SAME_SHAPE_AND_DTYPE3 (a, b, b2), " Tensors do not match" );
111+ ET_EXPECT_DEATH (
112+ ET_CHECK_SAME_SHAPE_AND_DTYPE3 (b, a, b2), " Tensors do not match" );
113+ ET_EXPECT_DEATH (
114+ ET_CHECK_SAME_SHAPE_AND_DTYPE3 (b, b2, a), " Tensors do not match" );
112115}
113116
114117TEST_F (TensorUtilTest, ZeroDimensionalTensor) {
@@ -163,9 +166,15 @@ TEST_F(TensorUtilTest, GetLeadingDimsInputOutOfBoundDies) {
163166 Tensor t = tf_int_.ones ({2 , 3 , 4 });
164167
165168 // dim needs to be in the range [0, t.dim()]
166- ET_EXPECT_DEATH (executorch::ET_RUNTIME_NAMESPACE::getLeadingDims (t, -2 ), " " );
167- ET_EXPECT_DEATH (executorch::ET_RUNTIME_NAMESPACE::getLeadingDims (t, -1 ), " " );
168- ET_EXPECT_DEATH (executorch::ET_RUNTIME_NAMESPACE::getLeadingDims (t, 4 ), " " );
169+ ET_EXPECT_DEATH (
170+ executorch::ET_RUNTIME_NAMESPACE::getLeadingDims (t, -2 ),
171+ " Ending dimension.*should be in the range" );
172+ ET_EXPECT_DEATH (
173+ executorch::ET_RUNTIME_NAMESPACE::getLeadingDims (t, -1 ),
174+ " Ending dimension.*should be in the range" );
175+ ET_EXPECT_DEATH (
176+ executorch::ET_RUNTIME_NAMESPACE::getLeadingDims (t, 4 ),
177+ " Ending dimension.*should be in the range" );
169178}
170179
171180TEST_F (TensorUtilTest, GetTrailingDimsSmokeTest) {
@@ -187,9 +196,15 @@ TEST_F(TensorUtilTest, GetTrailingDimsInputOutOfBoundDies) {
187196 Tensor t = tf_int_.ones ({2 , 3 , 4 });
188197
189198 // dim needs to be in the range [-1, t.dim() - 1)
190- ET_EXPECT_DEATH (executorch::ET_RUNTIME_NAMESPACE::getTrailingDims (t, -2 ), " " );
191- ET_EXPECT_DEATH (executorch::ET_RUNTIME_NAMESPACE::getTrailingDims (t, 3 ), " " );
192- ET_EXPECT_DEATH (executorch::ET_RUNTIME_NAMESPACE::getTrailingDims (t, 4 ), " " );
199+ ET_EXPECT_DEATH (
200+ executorch::ET_RUNTIME_NAMESPACE::getTrailingDims (t, -2 ),
201+ " Starting dimension.*should be in the range" );
202+ ET_EXPECT_DEATH (
203+ executorch::ET_RUNTIME_NAMESPACE::getTrailingDims (t, 3 ),
204+ " Starting dimension.*should be in the range" );
205+ ET_EXPECT_DEATH (
206+ executorch::ET_RUNTIME_NAMESPACE::getTrailingDims (t, 4 ),
207+ " Starting dimension.*should be in the range" );
193208}
194209
195210TEST_F (TensorUtilTest, ContiguousCheckSupported) {
@@ -208,7 +223,8 @@ TEST_F(TensorUtilTest, ContiguousCheckSupported) {
208223 ET_CHECK_CONTIGUOUS (t_contiguous);
209224
210225 // Assert t_incontiguous is incontiguous.
211- ET_EXPECT_DEATH (ET_CHECK_CONTIGUOUS (t_incontiguous), " " );
226+ ET_EXPECT_DEATH (
227+ ET_CHECK_CONTIGUOUS (t_incontiguous), " stride.*(shall be 1|shall equal)" );
212228}
213229
214230TEST_F (TensorUtilTest, CheckSameContiguousStrideSupported) {
@@ -241,7 +257,9 @@ TEST_F(TensorUtilTest, CheckSameContiguousStrideSupported) {
241257 // `different_stride`.
242258 for (const auto i : c10::irange (same_stride_tensor_list.size ())) {
243259 auto ti = same_stride_tensor_list[i];
244- ET_EXPECT_DEATH (ET_CHECK_SAME_STRIDES2 (ti, different_stride), " " );
260+ ET_EXPECT_DEATH (
261+ ET_CHECK_SAME_STRIDES2 (ti, different_stride),
262+ " strides.*shall (equal|have same)" );
245263 }
246264
247265 // Any three tensors in same_stride_tensor_list have same strides. The three
@@ -263,7 +281,9 @@ TEST_F(TensorUtilTest, CheckSameContiguousStrideSupported) {
263281 for (const auto j : c10::irange (i, same_stride_tensor_list.size ())) {
264282 auto ti = same_stride_tensor_list[i];
265283 auto tj = same_stride_tensor_list[j];
266- ET_EXPECT_DEATH (ET_CHECK_SAME_STRIDES3 (ti, tj, different_stride), " " );
284+ ET_EXPECT_DEATH (
285+ ET_CHECK_SAME_STRIDES3 (ti, tj, different_stride),
286+ " strides.*shall (share same|have same)" );
267287 }
268288 }
269289}
0 commit comments