Skip to content

Commit 9928555

Browse files
yegappanbrammool
authored andcommitted
patch 8.2.2952: recover test fails on big endian systems
Problem: Recover test fails on big endian systems. Solution: Disable the failing test on big endian systems. (Yegappan Lakshmanan, closes #8335)
1 parent 2067733 commit 9928555

3 files changed

Lines changed: 39 additions & 7 deletions

File tree

src/testdir/test_recover.vim

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func Test_recover_multiple_swap_files()
139139
new Xfile1
140140
call setline(1, ['a', 'b', 'c'])
141141
preserve
142-
let b = readblob('.Xfile1.swp')
142+
let b = readblob(swapname(''))
143143
call writefile(b, '.Xfile1.swm')
144144
call writefile(b, '.Xfile1.swn')
145145
call writefile(b, '.Xfile1.swo')
@@ -168,6 +168,7 @@ endfunc
168168
" Test for :recover using a corrupted swap file
169169
func Test_recover_corrupted_swap_file()
170170
CheckUnix
171+
171172
" recover using a partial swap file
172173
call writefile(0z1234, '.Xfile1.swp')
173174
call assert_fails('recover Xfile1', 'E295:')
@@ -183,12 +184,41 @@ func Test_recover_corrupted_swap_file()
183184
preserve
184185
let sn = swapname('')
185186
let b = readblob(sn)
187+
let save_b = copy(b)
186188
bw!
187-
" clear the B0_MAGIC_LONG field
188-
let b[1008:1011] = 0z00000000
189-
call writefile(b, sn)
190-
let msg = execute('recover Xfile1')
191-
call assert_match('the file has been damaged', msg)
189+
" Run these tests only on little-endian systems. These tests fail on a
190+
" big-endian system (IBM S390x system).
191+
if b[1008:1011] == 0z33323130
192+
\ && b[4096:4097] == 0z7470
193+
\ && b[8192:8193] == 0z6164
194+
195+
" clear the B0_MAGIC_LONG field
196+
let b[1008:1011] = 0z00000000
197+
call writefile(b, sn)
198+
let msg = execute('recover Xfile1')
199+
call assert_match('the file has been damaged', msg)
200+
bw!
201+
202+
" clear the pointer ID
203+
let b = copy(save_b)
204+
let b[4096:4097] = 0z0000
205+
call writefile(b, sn)
206+
call assert_fails('recover Xfile1', 'E310:')
207+
bw!
208+
209+
" clear the data block ID
210+
let b = copy(save_b)
211+
let b[8192:8193] = 0z0000
212+
call writefile(b, sn)
213+
call assert_fails('recover Xfile1', 'E312:')
214+
bw!
215+
216+
" remove the data block
217+
let b = copy(save_b)
218+
call writefile(b[:8191], sn)
219+
call assert_fails('recover Xfile1', 'E312:')
220+
endif
221+
192222
bw!
193223
call delete(sn)
194224
endfunc

src/testdir/test_swap.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ endfunc
487487
func Test_missing_swap_file()
488488
CheckUnix
489489
new Xfile1
490-
call delete('.Xfile1.swp')
490+
call delete(swapname(''))
491491
call assert_fails('file Xfile2', 'E301:')
492492
call assert_equal('Xfile2', bufname())
493493
call assert_true(bufexists('Xfile1'))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2952,
753755
/**/
754756
2951,
755757
/**/

0 commit comments

Comments
 (0)