From c006602b313e2f6062b51aad37d93dccd29649de Mon Sep 17 00:00:00 2001 From: Xiao Ni Date: Tue, 28 May 2024 21:51:47 +0800 Subject: [PATCH 095/157] mdadm/tests: bitmap cases enhance It fails because bitmap dirty number is smaller than 400 sometimes. It's not good to compare bitmap dirty bits with a number. It depends on the test machine, it can flush soon before checking the number. So remove related codes. Signed-off-by: Xiao Ni Signed-off-by: Mariusz Tkaczyk --- tests/05r1-grow-internal | 11 ++++------- tests/05r1-grow-internal-1 | 12 ++++-------- tests/05r1-internalbitmap | 22 ++++++++++------------ tests/05r1-internalbitmap-v1a | 22 ++++++++++------------ tests/05r1-internalbitmap-v1b | 23 ++++++++++------------- tests/05r1-internalbitmap-v1c | 22 ++++++++++------------ 6 files changed, 48 insertions(+), 64 deletions(-) diff --git a/tests/05r1-grow-internal b/tests/05r1-grow-internal index 24b3aece..f7fff989 100644 --- a/tests/05r1-grow-internal +++ b/tests/05r1-grow-internal @@ -8,18 +8,15 @@ testdev $md0 1 $mdsize1a 64 #mdadm -E $dev1 mdadm --grow $md0 --bitmap=internal --bitmap-chunk=4 --delay=1 || { mdadm -X $dev2 ; exit 1; } -dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` sleep 4 -dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` testdev $md0 1 $mdsize1a 64 -dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` sleep 4 -dirty4=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -#echo $dirty1 $dirty2 $dirty3 $dirty4 -if [ $dirty2 -ne 0 -o $dirty4 -ne 0 -o $dirty3 -lt 400 ] -then +if [ $dirty1 -ne 0 -o $dirty2 -ne 0 ] +then echo >&2 "ERROR bad 'dirty' counts: dirty1 $dirty1, dirty2 $dirty2" echo bad dirty counts exit 1 fi diff --git a/tests/05r1-grow-internal-1 b/tests/05r1-grow-internal-1 index 2f0d8237..f0f8349f 100644 --- a/tests/05r1-grow-internal-1 +++ b/tests/05r1-grow-internal-1 @@ -8,19 +8,15 @@ testdev $md0 1 $mdsize1b 64 #mdadm -E $dev1 mdadm --grow $md0 --bitmap=internal --bitmap-chunk=4 --delay=1 -dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` sleep 4 -dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` testdev $md0 1 $mdsize1b 64 -dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` sleep 4 -dirty4=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -#echo $dirty1 $dirty2 $dirty3 $dirty4 -if [ $dirty2 -ne 0 -o $dirty4 -ne 0 -o $dirty3 -lt 400 ] -then - echo bad dirty counts +if [ $dirty1 -ne 0 -o $dirty2 -ne 0 ] +then echo >&2 "ERROR bad 'dirty' counts: dirty1 $dirty1, dirty2 $dirty2" exit 1 fi diff --git a/tests/05r1-internalbitmap b/tests/05r1-internalbitmap index dd7232a7..f1a2843e 100644 --- a/tests/05r1-internalbitmap +++ b/tests/05r1-internalbitmap @@ -9,21 +9,20 @@ mdadm -S $md0 mdadm --assemble $md0 $dev1 $dev2 testdev $md0 1 $mdsize0 64 -dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` sleep 4 -dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty1 -lt 400 -o $dirty2 -ne 0 ] -then echo >&2 "ERROR bad 'dirty' counts: $dirty1 and $dirty2" +if [ $dirty1 -ne 0 ] +then echo >&2 "ERROR bad 'dirty' counts: $dirty1" exit 1 fi mdadm $md0 -f $dev1 testdev $md0 1 $mdsize0 64 sleep 4 -dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty3 -lt 400 ] -then - echo >&2 "ERROR dirty count $dirty3 is too small" +total=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) bits.*/\1/p'` +dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +if [ $dirty2 -ne $total ] +then echo >&2 "ERROR bad 'dirty' counts: total $total, dirty2 $dirty2" exit 2 fi @@ -34,13 +33,12 @@ mdadm --zero-superblock $dev1 mdadm $md0 --add $dev1 check recovery -dirty4=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` check wait sleep 4 -dirty5=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty4 -lt 400 -o $dirty5 -ne 0 ] -then echo echo >&2 "ERROR bad 'dirty' counts at end: $dirty4 $dirty5" +if [ $dirty3 -ne 0 ] +then echo >&2 "ERROR bad 'dirty' counts: $dirty3" exit 1 fi diff --git a/tests/05r1-internalbitmap-v1a b/tests/05r1-internalbitmap-v1a index 3ddc082f..cf3f3972 100644 --- a/tests/05r1-internalbitmap-v1a +++ b/tests/05r1-internalbitmap-v1a @@ -10,21 +10,20 @@ mdadm -S $md0 mdadm --assemble $md0 $dev1 $dev2 testdev $md0 1 $mdsize1b 64 -dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` sleep 4 -dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty1 -lt 400 -o $dirty2 -ne 0 ] -then echo >&2 "ERROR bad 'dirty' counts: $dirty1 and $dirty2" +if [ $dirty1 -ne 0 ] +then echo >&2 "ERROR bad 'dirty' counts: $dirty1" exit 1 fi mdadm $md0 -f $dev1 testdev $md0 1 $mdsize1b 64 sleep 4 -dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty3 -lt 400 ] -then - echo >&2 "ERROR dirty count $dirty3 is too small" +total=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) bits.*/\1/p'` +dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +if [ $dirty2 -ne $total ] +then echo >&2 "ERROR bad 'dirty' counts: total $total, dirty2 $dirty2" exit 2 fi @@ -35,13 +34,12 @@ mdadm --assemble -R $md0 $dev2 mdadm $md0 --add $dev1 check recovery -dirty4=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` check wait sleep 4 -dirty5=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty4 -lt 400 -o $dirty5 -ne 0 ] -then echo echo >&2 "ERROR bad 'dirty' counts at end: $dirty4 $dirty5" +if [ $dirty3 -ne 0 ] +then echo >&2 "ERROR bad 'dirty' counts: $dirty3" exit 1 fi diff --git a/tests/05r1-internalbitmap-v1b b/tests/05r1-internalbitmap-v1b index 40f7abea..4952887e 100644 --- a/tests/05r1-internalbitmap-v1b +++ b/tests/05r1-internalbitmap-v1b @@ -11,21 +11,20 @@ mdadm -S $md0 mdadm --assemble $md0 $dev1 $dev2 check bitmap testdev $md0 1 $mdsize11 64 -dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` sleep 4 -dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty1 -lt 400 -o $dirty2 -ne 0 ] -then echo >&2 "ERROR bad 'dirty' counts: $dirty1 and $dirty2" +if [ $dirty1 -ne 0 ] +then echo >&2 "ERROR bad 'dirty' counts: $dirty1" exit 1 fi mdadm $md0 -f $dev1 testdev $md0 1 $mdsize11 64 sleep 4 -dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty3 -lt 400 ] -then - echo >&2 "ERROR dirty count $dirty3 is too small" +total=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) bits.*/\1/p'` +dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +if [ $dirty2 -ne $total ] +then echo >&2 "ERROR bad 'dirty' counts: total $total, dirty2 $dirty2" exit 2 fi @@ -35,14 +34,12 @@ mdadm --zero-superblock $dev1 mdadm --assemble -R $md0 $dev2 mdadm $md0 --add $dev1 check recovery - -dirty4=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` check wait sleep 4 -dirty5=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty4 -lt 400 -o $dirty5 -ne 0 ] -then echo echo >&2 "ERROR bad 'dirty' counts at end: $dirty4 $dirty5" +if [ $dirty3 -ne 0 ] +then echo >&2 "ERROR bad 'dirty' counts: $dirty3" exit 1 fi diff --git a/tests/05r1-internalbitmap-v1c b/tests/05r1-internalbitmap-v1c index 2eaea59b..e1e4472f 100644 --- a/tests/05r1-internalbitmap-v1c +++ b/tests/05r1-internalbitmap-v1c @@ -10,21 +10,20 @@ mdadm -S $md0 mdadm --assemble $md0 $dev1 $dev2 testdev $md0 1 $mdsize12 64 -dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` sleep 4 -dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty1 -lt 400 -o $dirty2 -ne 0 ] -then echo >&2 "ERROR bad 'dirty' counts: $dirty1 and $dirty2" +if [ $dirty1 -ne 0 ] +then echo >&2 "ERROR bad 'dirty' counts: $dirty1" exit 1 fi mdadm $md0 -f $dev1 testdev $md0 1 $mdsize12 64 sleep 4 -dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty3 -lt 400 ] -then - echo >&2 "ERROR dirty count $dirty3 is too small" +total=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) bits.*/\1/p'` +dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +if [ $dirty2 -ne $total ] +then echo >&2 "ERROR bad 'dirty' counts: total $total, dirty2 $dirty2" exit 2 fi @@ -35,13 +34,12 @@ mdadm --assemble -R $md0 $dev2 mdadm $md0 --add $dev1 check recovery -dirty4=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` check wait sleep 4 -dirty5=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` +dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` -if [ $dirty4 -lt 400 -o $dirty5 -ne 0 ] -then echo echo >&2 "ERROR bad 'dirty' counts at end: $dirty4 $dirty5" +if [ $dirty3 -ne 0 ] +then echo >&2 "ERROR bad 'dirty' counts: $dirty3" exit 1 fi -- 2.41.0