summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-06-06 17:12:46 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-06 17:12:46 +0200
commit99285550a9957e2c8669f183557944c6513c4875 (patch)
treec388e5d206b8173834c4a61241debc28622e9ca3
parent2067733b5c76e996238af938af36b8196366b7ce (diff)
downloadvim-git-99285550a9957e2c8669f183557944c6513c4875.tar.gz
patch 8.2.2952: recover test fails on big endian systemsv8.2.2952
Problem: Recover test fails on big endian systems. Solution: Disable the failing test on big endian systems. (Yegappan Lakshmanan, closes #8335)
-rw-r--r--src/testdir/test_recover.vim42
-rw-r--r--src/testdir/test_swap.vim2
-rw-r--r--src/version.c2
3 files changed, 39 insertions, 7 deletions
diff --git a/src/testdir/test_recover.vim b/src/testdir/test_recover.vim
index 654a0f855..7e96622d1 100644
--- a/src/testdir/test_recover.vim
+++ b/src/testdir/test_recover.vim
@@ -139,7 +139,7 @@ func Test_recover_multiple_swap_files()
new Xfile1
call setline(1, ['a', 'b', 'c'])
preserve
- let b = readblob('.Xfile1.swp')
+ let b = readblob(swapname(''))
call writefile(b, '.Xfile1.swm')
call writefile(b, '.Xfile1.swn')
call writefile(b, '.Xfile1.swo')
@@ -168,6 +168,7 @@ endfunc
" Test for :recover using a corrupted swap file
func Test_recover_corrupted_swap_file()
CheckUnix
+
" recover using a partial swap file
call writefile(0z1234, '.Xfile1.swp')
call assert_fails('recover Xfile1', 'E295:')
@@ -183,12 +184,41 @@ func Test_recover_corrupted_swap_file()
preserve
let sn = swapname('')
let b = readblob(sn)
+ let save_b = copy(b)
bw!
- " clear the B0_MAGIC_LONG field
- let b[1008:1011] = 0z00000000
- call writefile(b, sn)
- let msg = execute('recover Xfile1')
- call assert_match('the file has been damaged', msg)
+ " Run these tests only on little-endian systems. These tests fail on a
+ " big-endian system (IBM S390x system).
+ if b[1008:1011] == 0z33323130
+ \ && b[4096:4097] == 0z7470
+ \ && b[8192:8193] == 0z6164
+
+ " clear the B0_MAGIC_LONG field
+ let b[1008:1011] = 0z00000000
+ call writefile(b, sn)
+ let msg = execute('recover Xfile1')
+ call assert_match('the file has been damaged', msg)
+ bw!
+
+ " clear the pointer ID
+ let b = copy(save_b)
+ let b[4096:4097] = 0z0000
+ call writefile(b, sn)
+ call assert_fails('recover Xfile1', 'E310:')
+ bw!
+
+ " clear the data block ID
+ let b = copy(save_b)
+ let b[8192:8193] = 0z0000
+ call writefile(b, sn)
+ call assert_fails('recover Xfile1', 'E312:')
+ bw!
+
+ " remove the data block
+ let b = copy(save_b)
+ call writefile(b[:8191], sn)
+ call assert_fails('recover Xfile1', 'E312:')
+ endif
+
bw!
call delete(sn)
endfunc
diff --git a/src/testdir/test_swap.vim b/src/testdir/test_swap.vim
index 52eb62e72..90afb4d6f 100644
--- a/src/testdir/test_swap.vim
+++ b/src/testdir/test_swap.vim
@@ -487,7 +487,7 @@ endfunc
func Test_missing_swap_file()
CheckUnix
new Xfile1
- call delete('.Xfile1.swp')
+ call delete(swapname(''))
call assert_fails('file Xfile2', 'E301:')
call assert_equal('Xfile2', bufname())
call assert_true(bufexists('Xfile1'))
diff --git a/src/version.c b/src/version.c
index f99551879..59cd0ce94 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2952,
+/**/
2951,
/**/
2950,