Browse Source

[peerdist] Include trimmed range within content information block

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
f0d594557c
3 changed files with 76 additions and 37 deletions
  1. 2
    0
      src/include/ipxe/pccrc.h
  2. 19
    4
      src/net/pccrc.c
  3. 55
    33
      src/tests/pccrc_test.c

+ 2
- 0
src/include/ipxe/pccrc.h View File

402
 	 * Note that this range may exceed the overall content range.
402
 	 * Note that this range may exceed the overall content range.
403
 	 */
403
 	 */
404
 	struct peerdist_range range;
404
 	struct peerdist_range range;
405
+	/** Trimmed content range */
406
+	struct peerdist_range trim;
405
 	/** Block hash */
407
 	/** Block hash */
406
 	uint8_t hash[PEERDIST_DIGEST_MAX_SIZE];
408
 	uint8_t hash[PEERDIST_DIGEST_MAX_SIZE];
407
 };
409
 };

+ 19
- 4
src/net/pccrc.c View File

747
 	if ( ( rc = info->op->segment ( segment ) ) != 0 )
747
 	if ( ( rc = info->op->segment ( segment ) ) != 0 )
748
 		return rc;
748
 		return rc;
749
 
749
 
750
-	DBGC2 ( info, "PCCRC %p segment %d covers [%08zx,%08zx) with %d "
750
+	DBGC2 ( info, "PCCRC %p segment %d range [%08zx,%08zx) with %d "
751
 		"blocks\n", info, segment->index, segment->range.start,
751
 		"blocks\n", info, segment->index, segment->range.start,
752
 		segment->range.end, segment->blocks );
752
 		segment->range.end, segment->blocks );
753
 	DBGC2 ( info, "PCCRC %p segment %d digest %s\n", info, segment->index,
753
 	DBGC2 ( info, "PCCRC %p segment %d digest %s\n", info, segment->index,
771
 			  struct peerdist_info_block *block,
771
 			  struct peerdist_info_block *block,
772
 			  unsigned int index ) {
772
 			  unsigned int index ) {
773
 	const struct peerdist_info *info = segment->info;
773
 	const struct peerdist_info *info = segment->info;
774
+	size_t start;
775
+	size_t end;
774
 	int rc;
776
 	int rc;
775
 
777
 
776
 	/* Sanity checks */
778
 	/* Sanity checks */
793
 	if ( ( rc = info->op->block ( block ) ) != 0 )
795
 	if ( ( rc = info->op->block ( block ) ) != 0 )
794
 		return rc;
796
 		return rc;
795
 
797
 
798
+	/* Calculate trimmed range */
799
+	start = block->range.start;
800
+	if ( start < info->trim.start )
801
+		start = info->trim.start;
802
+	end = block->range.end;
803
+	if ( end > info->trim.end )
804
+		end = info->trim.end;
805
+	if ( end < start )
806
+		end = start;
807
+	block->trim.start = start;
808
+	block->trim.end = end;
809
+
796
 	DBGC2 ( info, "PCCRC %p segment %d block %d hash %s\n",
810
 	DBGC2 ( info, "PCCRC %p segment %d block %d hash %s\n",
797
 		info, segment->index, block->index,
811
 		info, segment->index, block->index,
798
 		peerdist_info_hash_ntoa ( info, block->hash ) );
812
 		peerdist_info_hash_ntoa ( info, block->hash ) );
799
-	DBGC2 ( info, "PCCRC %p segment %d block %d covers [%08zx,%08zx)\n",
800
-		info, segment->index, block->index, block->range.start,
801
-		block->range.end );
813
+	DBGC2 ( info, "PCCRC %p segment %d block %d range [%08zx,%08zx) covers "
814
+		"[%08zx,%08zx)\n", info, segment->index, block->index,
815
+		block->range.start, block->range.end, block->trim.start,
816
+		block->trim.end );
802
 	return 0;
817
 	return 0;
803
 }
818
 }

+ 55
- 33
src/tests/pccrc_test.c View File

45
 /** Define inline raw data */
45
 /** Define inline raw data */
46
 #define DATA(...) { __VA_ARGS__ }
46
 #define DATA(...) { __VA_ARGS__ }
47
 
47
 
48
+/**
49
+ * Define an inline content range
50
+ *
51
+ * @v START		Start offset
52
+ * @v END		End offset
53
+ * @ret range		Content range
54
+ */
55
+#define RANGE( START, END ) { .start = START, .end = END }
56
+
57
+/**
58
+ * Define an inline trimmed content range
59
+ *
60
+ * @v START		Start offset
61
+ * @v END		End offset
62
+ * @ret trim		Trimmed content range
63
+ */
64
+#define TRIM( START, END ) { .start = START, .end = END }
65
+
48
 /** A content information test */
66
 /** A content information test */
49
 struct peerdist_info_test {
67
 struct peerdist_info_test {
50
 	/** Raw content information */
68
 	/** Raw content information */
55
 	struct digest_algorithm *expected_digest;
73
 	struct digest_algorithm *expected_digest;
56
 	/** Expected digest size */
74
 	/** Expected digest size */
57
 	size_t expected_digestsize;
75
 	size_t expected_digestsize;
76
+	/** Expected content range */
77
+	struct peerdist_range expected_range;
58
 	/** Expected trimmed content range */
78
 	/** Expected trimmed content range */
59
 	struct peerdist_range expected_trim;
79
 	struct peerdist_range expected_trim;
60
 	/** Expected number of segments */
80
 	/** Expected number of segments */
68
  * @v DATA		Raw content information
88
  * @v DATA		Raw content information
69
  * @v DIGEST		Expected digest algorithm
89
  * @v DIGEST		Expected digest algorithm
70
  * @v DIGESTSIZE	Expected digest size
90
  * @v DIGESTSIZE	Expected digest size
71
- * @v START		Expected trimmed content range start offset
72
- * @v END		Expected trimmed content range end offset
91
+ * @v RANGE		Expected content range
92
+ * @v TRIM		Expected trimmer content range
73
  * @v SEGMENTS		Expected number of segments
93
  * @v SEGMENTS		Expected number of segments
74
  * @ret test		Content information test
94
  * @ret test		Content information test
75
  *
95
  *
93
  *   X-P2P-PeerDist: Version=1.1
113
  *   X-P2P-PeerDist: Version=1.1
94
  *   X-P2P-PeerDistEx: MinContentInformation=2.0, MaxContentInformation=2.0
114
  *   X-P2P-PeerDistEx: MinContentInformation=2.0, MaxContentInformation=2.0
95
  */
115
  */
96
-#define PEERDIST_INFO_TEST( name, DATA, DIGEST, DIGESTSIZE, START, END,	\
97
-			    SEGMENTS )					\
116
+#define PEERDIST_INFO_TEST( name, DATA, DIGEST, DIGESTSIZE, RANGE,	\
117
+			    TRIM, SEGMENTS )				\
98
 	static const uint8_t name ## _data[] = DATA;			\
118
 	static const uint8_t name ## _data[] = DATA;			\
99
 	static struct peerdist_info_test name = {			\
119
 	static struct peerdist_info_test name = {			\
100
 		.data = name ## _data,					\
120
 		.data = name ## _data,					\
101
 		.len = sizeof ( name ## _data ),			\
121
 		.len = sizeof ( name ## _data ),			\
102
 		.expected_digest = DIGEST,				\
122
 		.expected_digest = DIGEST,				\
103
 		.expected_digestsize = DIGESTSIZE,			\
123
 		.expected_digestsize = DIGESTSIZE,			\
104
-		.expected_trim = {					\
105
-			.start = START,					\
106
-			.end = END,					\
107
-		},							\
124
+		.expected_range = RANGE,				\
125
+		.expected_trim = TRIM,					\
108
 		.expected_segments = SEGMENTS,				\
126
 		.expected_segments = SEGMENTS,				\
109
 	}
127
 	}
110
 
128
 
131
  *
149
  *
132
  * @v name		Test name
150
  * @v name		Test name
133
  * @v INDEX		Segment index
151
  * @v INDEX		Segment index
134
- * @v START		Expected content range start offset
135
- * @v END		Expected content range end offset
152
+ * @v RANGE		Expected content range
136
  * @v BLOCKS		Expected number of blocks
153
  * @v BLOCKS		Expected number of blocks
137
  * @v BLKSIZE		Expected block size
154
  * @v BLKSIZE		Expected block size
138
  * @v HASH		Expected segment hash of data
155
  * @v HASH		Expected segment hash of data
140
  * @v ID		Expected segment identifier
157
  * @v ID		Expected segment identifier
141
  * @ret test		Content information segment test
158
  * @ret test		Content information segment test
142
  */
159
  */
143
-#define PEERDIST_INFO_SEGMENT_TEST( name, INDEX, START, END, BLOCKS,	\
160
+#define PEERDIST_INFO_SEGMENT_TEST( name, INDEX, RANGE, BLOCKS,		\
144
 				    BLKSIZE, HASH, SECRET, ID )		\
161
 				    BLKSIZE, HASH, SECRET, ID )		\
145
 	static struct peerdist_info_segment_test name = {		\
162
 	static struct peerdist_info_segment_test name = {		\
146
 		.index = INDEX,						\
163
 		.index = INDEX,						\
147
-		.expected_range = {					\
148
-			.start = START,					\
149
-			.end = END,					\
150
-		},							\
164
+		.expected_range = RANGE,				\
151
 		.expected_blocks = BLOCKS,				\
165
 		.expected_blocks = BLOCKS,				\
152
 		.expected_blksize = BLKSIZE,				\
166
 		.expected_blksize = BLKSIZE,				\
153
 		.expected_hash = HASH,					\
167
 		.expected_hash = HASH,					\
161
 	unsigned int index;
175
 	unsigned int index;
162
 	/** Expected content range */
176
 	/** Expected content range */
163
 	struct peerdist_range expected_range;
177
 	struct peerdist_range expected_range;
178
+	/** Expected trimmed content range */
179
+	struct peerdist_range expected_trim;
164
 	/** Expected hash of data */
180
 	/** Expected hash of data */
165
 	uint8_t expected_hash[PEERDIST_DIGEST_MAX_SIZE];
181
 	uint8_t expected_hash[PEERDIST_DIGEST_MAX_SIZE];
166
 };
182
 };
170
  *
186
  *
171
  * @v name		Test name
187
  * @v name		Test name
172
  * @v INDEX		Block index
188
  * @v INDEX		Block index
173
- * @v START		Expected content range start offset
174
- * @v END		Expected content range end offset
189
+ * @v RANGE		Expected content range
190
+ * @v TRIM		Expected trimmed content range
175
  * @v HASH		Expected hash of data
191
  * @v HASH		Expected hash of data
176
  * @ret test		Content information block test
192
  * @ret test		Content information block test
177
  */
193
  */
178
-#define PEERDIST_INFO_BLOCK_TEST( name, INDEX, START, END, HASH )	\
194
+#define PEERDIST_INFO_BLOCK_TEST( name, INDEX, RANGE, TRIM, HASH )	\
179
 	static struct peerdist_info_block_test name = {			\
195
 	static struct peerdist_info_block_test name = {			\
180
 		.index = INDEX,						\
196
 		.index = INDEX,						\
181
-		.expected_range = {					\
182
-			.start = START,					\
183
-			.end = END,					\
184
-		},							\
197
+		.expected_range = RANGE,				\
198
+		.expected_trim = TRIM,					\
185
 		.expected_hash = HASH,					\
199
 		.expected_hash = HASH,					\
186
 	}
200
 	}
187
 
201
 
242
 	       0xaf, 0xe4, 0x57, 0xa9, 0x50, 0x3b, 0x45, 0x48, 0xf6, 0x6e, 0xd3,
256
 	       0xaf, 0xe4, 0x57, 0xa9, 0x50, 0x3b, 0x45, 0x48, 0xf6, 0x6e, 0xd3,
243
 	       0xb1, 0x88, 0xdc, 0xfd, 0xa0, 0xac, 0x38, 0x2b, 0x09, 0x71, 0x1a,
257
 	       0xb1, 0x88, 0xdc, 0xfd, 0xa0, 0xac, 0x38, 0x2b, 0x09, 0x71, 0x1a,
244
 	       0xcc ),
258
 	       0xcc ),
245
-	&sha256_algorithm, 32, 0, 99710, 1 );
259
+	&sha256_algorithm, 32, RANGE ( 0, 99710 ), TRIM ( 0, 99710 ), 1 );
246
 
260
 
247
 /** IIS logo (iis-85.png) content information version 1 segment 0 */
261
 /** IIS logo (iis-85.png) content information version 1 segment 0 */
248
 PEERDIST_INFO_SEGMENT_TEST ( iis_85_png_v1_s0, 0,
262
 PEERDIST_INFO_SEGMENT_TEST ( iis_85_png_v1_s0, 0,
249
-	0, 99710, 2, 65536,
263
+	RANGE ( 0, 99710 ), 2, 65536,
250
 	DATA ( 0xd8, 0xd9, 0x76, 0x35, 0x4a, 0x48, 0x72, 0xe9, 0x25, 0x76, 0x18,
264
 	DATA ( 0xd8, 0xd9, 0x76, 0x35, 0x4a, 0x48, 0x72, 0xe9, 0x25, 0x76, 0x18,
251
 	       0x03, 0xf4, 0x58, 0xd9, 0xda, 0xaa, 0x67, 0xf8, 0xe3, 0x1c, 0x63,
265
 	       0x03, 0xf4, 0x58, 0xd9, 0xda, 0xaa, 0x67, 0xf8, 0xe3, 0x1c, 0x63,
252
 	       0x0f, 0xb7, 0x4e, 0x6a, 0x31, 0x2e, 0xf8, 0xa2, 0x5a, 0xba ),
266
 	       0x0f, 0xb7, 0x4e, 0x6a, 0x31, 0x2e, 0xf8, 0xa2, 0x5a, 0xba ),
259
 
273
 
260
 /** IIS logo (iis-85.png) content information version 1 segment 0 block 0 */
274
 /** IIS logo (iis-85.png) content information version 1 segment 0 block 0 */
261
 PEERDIST_INFO_BLOCK_TEST ( iis_85_png_v1_s0_b0, 0,
275
 PEERDIST_INFO_BLOCK_TEST ( iis_85_png_v1_s0_b0, 0,
262
-	0, 65536,
276
+	RANGE ( 0, 65536 ),
277
+	TRIM ( 0, 65536 ),
263
 	DATA ( 0x73, 0xc1, 0x8a, 0xb8, 0x54, 0x91, 0x10, 0xf8, 0xe9, 0x0e, 0x71,
278
 	DATA ( 0x73, 0xc1, 0x8a, 0xb8, 0x54, 0x91, 0x10, 0xf8, 0xe9, 0x0e, 0x71,
264
 	       0xbb, 0xc3, 0xab, 0x2a, 0xa8, 0xc4, 0x4d, 0x13, 0xf4, 0x92, 0x94,
279
 	       0xbb, 0xc3, 0xab, 0x2a, 0xa8, 0xc4, 0x4d, 0x13, 0xf4, 0x92, 0x94,
265
 	       0x99, 0x25, 0x5b, 0x66, 0x0f, 0x24, 0xec, 0x77, 0x80, 0x0b ) );
280
 	       0x99, 0x25, 0x5b, 0x66, 0x0f, 0x24, 0xec, 0x77, 0x80, 0x0b ) );
266
 
281
 
267
 /** IIS logo (iis-85.png) content information version 1 segment 0 block 1 */
282
 /** IIS logo (iis-85.png) content information version 1 segment 0 block 1 */
268
 PEERDIST_INFO_BLOCK_TEST ( iis_85_png_v1_s0_b1, 1,
283
 PEERDIST_INFO_BLOCK_TEST ( iis_85_png_v1_s0_b1, 1,
269
-	65536, 99710,
284
+	RANGE ( 65536, 99710 ),
285
+	TRIM ( 65536, 99710 ),
270
 	DATA ( 0x97, 0x4b, 0xdd, 0x65, 0x56, 0x7f, 0xde, 0xec, 0xcd, 0xaf, 0xe4,
286
 	DATA ( 0x97, 0x4b, 0xdd, 0x65, 0x56, 0x7f, 0xde, 0xec, 0xcd, 0xaf, 0xe4,
271
 	       0x57, 0xa9, 0x50, 0x3b, 0x45, 0x48, 0xf6, 0x6e, 0xd3, 0xb1, 0x88,
287
 	       0x57, 0xa9, 0x50, 0x3b, 0x45, 0x48, 0xf6, 0x6e, 0xd3, 0xb1, 0x88,
272
 	       0xdc, 0xfd, 0xa0, 0xac, 0x38, 0x2b, 0x09, 0x71, 0x1a, 0xcc ) );
288
 	       0xdc, 0xfd, 0xa0, 0xac, 0x38, 0x2b, 0x09, 0x71, 0x1a, 0xcc ) );
289
 	       0x77, 0x83, 0xe4, 0xf8, 0x07, 0x64, 0x7b, 0x63, 0xf1, 0x46, 0xb5,
305
 	       0x77, 0x83, 0xe4, 0xf8, 0x07, 0x64, 0x7b, 0x63, 0xf1, 0x46, 0xb5,
290
 	       0x2f, 0x4a, 0xc8, 0x9c, 0xcc, 0x7a, 0xbf, 0x5f, 0xa1, 0x1a, 0xca,
306
 	       0x2f, 0x4a, 0xc8, 0x9c, 0xcc, 0x7a, 0xbf, 0x5f, 0xa1, 0x1a, 0xca,
291
 	       0xfc, 0x2a, 0xcf, 0x50, 0x28, 0x58, 0x6c ),
307
 	       0xfc, 0x2a, 0xcf, 0x50, 0x28, 0x58, 0x6c ),
292
-	&sha512_algorithm, 32, 0, 99710, 2 );
308
+	&sha512_algorithm, 32, RANGE ( 0, 99710 ), TRIM ( 0, 99710 ), 2 );
293
 
309
 
294
 /** IIS logo (iis-85.png) content information version 2 segment 0 */
310
 /** IIS logo (iis-85.png) content information version 2 segment 0 */
295
 PEERDIST_INFO_SEGMENT_TEST ( iis_85_png_v2_s0, 0,
311
 PEERDIST_INFO_SEGMENT_TEST ( iis_85_png_v2_s0, 0,
296
-	0, 39390, 1, 39390,
312
+	RANGE ( 0, 39390 ), 1, 39390,
297
 	DATA ( 0xe0, 0xd0, 0xc3, 0x58, 0xe2, 0x68, 0x4b, 0x62, 0x33, 0x0d, 0x32,
313
 	DATA ( 0xe0, 0xd0, 0xc3, 0x58, 0xe2, 0x68, 0x4b, 0x62, 0x33, 0x0d, 0x32,
298
 	       0xb5, 0xf1, 0x97, 0x87, 0x24, 0xa0, 0xd0, 0xa5, 0x2b, 0xdc, 0x5e,
314
 	       0xb5, 0xf1, 0x97, 0x87, 0x24, 0xa0, 0xd0, 0xa5, 0x2b, 0xdc, 0x5e,
299
 	       0x78, 0x1f, 0xae, 0x71, 0xff, 0x57, 0xa8, 0xbe, 0x3d, 0xd4 ),
315
 	       0x78, 0x1f, 0xae, 0x71, 0xff, 0x57, 0xa8, 0xbe, 0x3d, 0xd4 ),
306
 
322
 
307
 /** IIS logo (iis-85.png) content information version 2 segment 0 block 0 */
323
 /** IIS logo (iis-85.png) content information version 2 segment 0 block 0 */
308
 PEERDIST_INFO_BLOCK_TEST ( iis_85_png_v2_s0_b0, 0,
324
 PEERDIST_INFO_BLOCK_TEST ( iis_85_png_v2_s0_b0, 0,
309
-	0, 39390,
325
+	RANGE ( 0, 39390 ),
326
+	TRIM ( 0, 39390 ),
310
 	DATA ( 0xe0, 0xd0, 0xc3, 0x58, 0xe2, 0x68, 0x4b, 0x62, 0x33, 0x0d, 0x32,
327
 	DATA ( 0xe0, 0xd0, 0xc3, 0x58, 0xe2, 0x68, 0x4b, 0x62, 0x33, 0x0d, 0x32,
311
 	       0xb5, 0xf1, 0x97, 0x87, 0x24, 0xa0, 0xd0, 0xa5, 0x2b, 0xdc, 0x5e,
328
 	       0xb5, 0xf1, 0x97, 0x87, 0x24, 0xa0, 0xd0, 0xa5, 0x2b, 0xdc, 0x5e,
312
 	       0x78, 0x1f, 0xae, 0x71, 0xff, 0x57, 0xa8, 0xbe, 0x3d, 0xd4 ) );
329
 	       0x78, 0x1f, 0xae, 0x71, 0xff, 0x57, 0xa8, 0xbe, 0x3d, 0xd4 ) );
313
 
330
 
314
 /** IIS logo (iis-85.png) content information version 2 segment 1 */
331
 /** IIS logo (iis-85.png) content information version 2 segment 1 */
315
 PEERDIST_INFO_SEGMENT_TEST ( iis_85_png_v2_s1, 1,
332
 PEERDIST_INFO_SEGMENT_TEST ( iis_85_png_v2_s1, 1,
316
-	39390, 99710, 1, 60320,
333
+	RANGE ( 39390, 99710 ), 1, 60320,
317
 	DATA ( 0x33, 0x81, 0xd0, 0xd0, 0xcb, 0x74, 0xf4, 0xb6, 0x13, 0xd8, 0x21,
334
 	DATA ( 0x33, 0x81, 0xd0, 0xd0, 0xcb, 0x74, 0xf4, 0xb6, 0x13, 0xd8, 0x21,
318
 	       0x0f, 0x37, 0xf0, 0x02, 0xa0, 0x6f, 0x39, 0x10, 0x58, 0x60, 0x96,
335
 	       0x0f, 0x37, 0xf0, 0x02, 0xa0, 0x6f, 0x39, 0x10, 0x58, 0x60, 0x96,
319
 	       0xa1, 0x30, 0xd3, 0x43, 0x98, 0xc0, 0x8e, 0x66, 0xd7, 0xbc ),
336
 	       0xa1, 0x30, 0xd3, 0x43, 0x98, 0xc0, 0x8e, 0x66, 0xd7, 0xbc ),
326
 
343
 
327
 /** IIS logo (iis-85.png) content information version 2 segment 1 block 0 */
344
 /** IIS logo (iis-85.png) content information version 2 segment 1 block 0 */
328
 PEERDIST_INFO_BLOCK_TEST ( iis_85_png_v2_s1_b0, 0,
345
 PEERDIST_INFO_BLOCK_TEST ( iis_85_png_v2_s1_b0, 0,
329
-	39390, 99710,
346
+	RANGE ( 39390, 99710 ),
347
+	TRIM ( 39390, 99710 ),
330
 	DATA ( 0x33, 0x81, 0xd0, 0xd0, 0xcb, 0x74, 0xf4, 0xb6, 0x13, 0xd8, 0x21,
348
 	DATA ( 0x33, 0x81, 0xd0, 0xd0, 0xcb, 0x74, 0xf4, 0xb6, 0x13, 0xd8, 0x21,
331
 	       0x0f, 0x37, 0xf0, 0x02, 0xa0, 0x6f, 0x39, 0x10, 0x58, 0x60, 0x96,
349
 	       0x0f, 0x37, 0xf0, 0x02, 0xa0, 0x6f, 0x39, 0x10, 0x58, 0x60, 0x96,
332
 	       0xa1, 0x30, 0xd3, 0x43, 0x98, 0xc0, 0x8e, 0x66, 0xd7, 0xbc ) );
350
 	       0xa1, 0x30, 0xd3, 0x43, 0x98, 0xc0, 0x8e, 0x66, 0xd7, 0xbc ) );
352
 	okx ( info->raw.len == test->len, file, line );
370
 	okx ( info->raw.len == test->len, file, line );
353
 	okx ( info->digest == test->expected_digest, file, line );
371
 	okx ( info->digest == test->expected_digest, file, line );
354
 	okx ( info->digestsize == test->expected_digestsize, file, line );
372
 	okx ( info->digestsize == test->expected_digestsize, file, line );
355
-	okx ( info->trim.start >= info->range.start, file, line );
373
+	okx ( info->range.start == test->expected_range.start, file, line );
374
+	okx ( info->range.end == test->expected_range.end, file, line );
356
 	okx ( info->trim.start == test->expected_trim.start, file, line );
375
 	okx ( info->trim.start == test->expected_trim.start, file, line );
357
-	okx ( info->trim.end <= info->range.end, file, line );
358
 	okx ( info->trim.end == test->expected_trim.end, file, line );
376
 	okx ( info->trim.end == test->expected_trim.end, file, line );
377
+	okx ( info->trim.start >= info->range.start, file, line );
378
+	okx ( info->trim.end <= info->range.end, file, line );
359
 	okx ( info->segments == test->expected_segments, file, line );
379
 	okx ( info->segments == test->expected_segments, file, line );
360
 }
380
 }
361
 #define peerdist_info_ok( test, info ) \
381
 #define peerdist_info_ok( test, info ) \
423
 	okx ( block->index == test->index, file, line );
443
 	okx ( block->index == test->index, file, line );
424
 	okx ( block->range.start == test->expected_range.start, file, line );
444
 	okx ( block->range.start == test->expected_range.start, file, line );
425
 	okx ( block->range.end == test->expected_range.end, file, line );
445
 	okx ( block->range.end == test->expected_range.end, file, line );
446
+	okx ( block->trim.start == test->expected_trim.start, file, line );
447
+	okx ( block->trim.end == test->expected_trim.end, file, line );
426
 	okx ( memcmp ( block->hash, test->expected_hash,
448
 	okx ( memcmp ( block->hash, test->expected_hash,
427
 		       digestsize ) == 0, file, line );
449
 		       digestsize ) == 0, file, line );
428
 }
450
 }

Loading…
Cancel
Save