File tree Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,26 @@ int cmd__path_utils(int argc, const char **argv)
311
311
return !!res ;
312
312
}
313
313
314
+ if (argc == 4 && !strcmp (argv [1 ], "skip-n-bytes" )) {
315
+ int fd = open (argv [2 ], O_RDONLY ), offset = atoi (argv [3 ]);
316
+ char buffer [65536 ];
317
+
318
+ if (fd < 0 )
319
+ die_errno ("could not open '%s'" , argv [2 ]);
320
+ if (lseek (fd , offset , SEEK_SET ) < 0 )
321
+ die_errno ("could not skip %d bytes" , offset );
322
+ for (;;) {
323
+ ssize_t count = read (fd , buffer , sizeof (buffer ));
324
+ if (count < 0 )
325
+ die_errno ("could not read '%s'" , argv [2 ]);
326
+ if (!count )
327
+ break ;
328
+ write (1 , buffer , count );
329
+ }
330
+ close (fd );
331
+ return 0 ;
332
+ }
333
+
314
334
if (argc > 5 && !strcmp (argv [1 ], "slice-tests" )) {
315
335
int res = 0 ;
316
336
long offset , stride , i ;
Original file line number Diff line number Diff line change @@ -518,7 +518,8 @@ test_failure_ () {
518
518
junit_insert=" $junit_insert $( xml_attr_encode \
519
519
" $( if test -n " $GIT_TEST_TEE_OUTPUT_FILE "
520
520
then
521
- cut -c " $GIT_TEST_TEE_OFFSET -" < " $GIT_TEST_TEE_OUTPUT_FILE "
521
+ test-tool path-utils skip-n-bytes \
522
+ " $GIT_TEST_TEE_OUTPUT_FILE " $GIT_TEST_TEE_OFFSET
522
523
else
523
524
printf ' %s\n' " $@ " | sed 1d
524
525
fi) " ) "
@@ -823,6 +824,11 @@ test_finish_ () {
823
824
echo >&3 " "
824
825
maybe_teardown_valgrind
825
826
maybe_teardown_verbose
827
+ if test -n " $GIT_TEST_TEE_OFFSET "
828
+ then
829
+ GIT_TEST_TEE_OFFSET=$( test-tool path-utils file-size \
830
+ " $GIT_TEST_TEE_OUTPUT_FILE " )
831
+ fi
826
832
}
827
833
828
834
test_skip () {
@@ -900,11 +906,6 @@ write_junit_xml_testcase () {
900
906
write_junit_xml " $( printf ' %s\n' \
901
907
" <testcase $junit_attrs >" " $@ " " </testcase>" ) "
902
908
junit_have_testcase=t
903
- if test -n " $GIT_TEST_TEE_OUTPUT_FILE "
904
- then
905
- GIT_TEST_TEE_OFFSET=$( test-tool path-utils file-size \
906
- " $GIT_TEST_TEE_OUTPUT_FILE " )
907
- fi
908
909
}
909
910
910
911
test_done () {
@@ -1198,7 +1199,6 @@ then
1198
1199
if test -n " $GIT_TEST_TEE_OUTPUT_FILE "
1199
1200
then
1200
1201
GIT_TEST_TEE_OFFSET=0
1201
- GIT_TEST_TEE_ERR_OFFSET=0
1202
1202
fi
1203
1203
fi
1204
1204
You can’t perform that action at this time.
0 commit comments