From f73c9760f43897fce0d6aa32042f751a2e7d0de0 Mon Sep 17 00:00:00 2001
From: hanzhijun <hanzhijun1@huawei.com>
Date: Sat, 18 Jul 2020 10:30:03 +0800
Subject: [PATCH 2/2] fix compat test

---
 tests/compat-test | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/tests/compat-test b/tests/compat-test
index a71b247..9e395b1 100755
--- a/tests/compat-test
+++ b/tests/compat-test
@@ -23,6 +23,7 @@ PWD0="compatkey"
 PWD1="93R4P4pIqAH8"
 PWD2="mymJeD8ivEhE"
 PWD3="ocMakf3fAcQO"
+PWD4="hkj123HJGS12"
 PWDW="rUkL4RUryBom"
 VK_FILE="compattest_vkfile"
 
@@ -239,17 +240,17 @@ echo $PWD1 | $CRYPTSETUP luksAddKey $IMG $FAST_PBKDF_OPT 2>/dev/null && fail
 echo -e "$PWD1\n$PWD2" | $CRYPTSETUP luksAddKey $IMG $FAST_PBKDF_OPT || fail
 echo -e "$PWD0\n$PWD1" | $CRYPTSETUP luksAddKey $IMG $FAST_PBKDF_OPT 2>/dev/null && fail
 echo "[4] change key"
-echo -e "$PWD1\n$PWD0\n" | $CRYPTSETUP luksChangeKey $FAST_PBKDF_OPT $IMG || fail
+echo -e "$PWD1\n$PWD4\n" | $CRYPTSETUP luksChangeKey $FAST_PBKDF_OPT $IMG || fail
 echo -e "$PWD1\n$PWD2\n" | $CRYPTSETUP luksChangeKey $FAST_PBKDF_OPT $IMG 2>/dev/null && fail
 [ $? -ne 2 ] && fail "luksChangeKey should return EPERM exit code"
 echo "[5] remove key"
-# delete active keys PWD0, PWD2
+# delete active keys PWD2, PWD4
 echo $PWD1 | $CRYPTSETUP luksRemoveKey $IMG 2>/dev/null && fail
 [ $? -ne 2 ] && fail "luksRemove should return EPERM exit code"
-echo $PWD0 | $CRYPTSETUP luksRemoveKey $IMG || fail
 echo $PWD2 | $CRYPTSETUP luksRemoveKey $IMG || fail
+echo $PWD4 | $CRYPTSETUP luksRemoveKey $IMG || fail
 # check if keys were deleted
-echo $PWD0 | $CRYPTSETUP luksOpen $IMG --test-passphrase 2>/dev/null && fail
+echo $PWD4 | $CRYPTSETUP luksOpen $IMG --test-passphrase 2>/dev/null && fail
 [ $? -ne 1 ] && fail "luksOpen should return ENOENT exit code"
 echo $PWD2 | $CRYPTSETUP luksOpen $IMG --test-passphrase 2>/dev/null && fail
 [ $? -ne 1 ] && fail "luksOpen should return ENOENT exit code"
@@ -866,11 +867,11 @@ set timeout $EXPECT_TIMEOUT
 eval spawn $CRYPTSETUP_RAW luksOpen -v -T 2 $LOOPDEV $DEV_NAME
 expect timeout abort "Enter passphrase for $EXPECT_DEV:"
 sleep 0.1
-send "$PWD0 x\n"
+send "$PWD4 x\n"
 expect timeout abort "No key available with this passphrase."
 expect timeout abort "Enter passphrase for $EXPECT_DEV:"
 sleep 0.1
-send "$PWD0 y\n"
+send "$PWD4 y\n"
 expect timeout abort "No key available with this passphrase."
 expect timeout abort eof
 exit
@@ -886,7 +887,7 @@ expect timeout abort "Are you sure? (Type 'yes' in capital letters):"
 send "YES\n"
 expect timeout abort "Enter any remaining passphrase:"
 sleep 0.1
-send "$PWD0\n"
+send "$PWD4\n"
 expect timeout abort "Command successful."
 expect timeout abort eof
 eval spawn $CRYPTSETUP_RAW luksKillSlot -v $LOOPDEV 0
-- 
2.30.0

