xref: /aosp_15_r20/external/e2fsprogs/tests/f_mke2fs_baddisk/script (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Workertest_description="mke2fs /dev/mapper/bad_disk should fail"
2*6a54128fSAndroid Build Coastguard Worker
3*6a54128fSAndroid Build Coastguard WorkerOUT=$test_name.log
4*6a54128fSAndroid Build Coastguard Worker
5*6a54128fSAndroid Build Coastguard Workerdmsetup create -v bad_disk --table '0 1148681097 error' > $OUT 2>&1
6*6a54128fSAndroid Build Coastguard Workerstatus=$?
7*6a54128fSAndroid Build Coastguard Workerif [ "$status" != 0 ]; then
8*6a54128fSAndroid Build Coastguard Worker    echo "$test_name: $test_description: skip"
9*6a54128fSAndroid Build Coastguard Worker    touch $test_name.ok
10*6a54128fSAndroid Build Coastguard Workerelse
11*6a54128fSAndroid Build Coastguard Worker    echo mke2fs /dev/mapper/bad_disk  >> $OUT
12*6a54128fSAndroid Build Coastguard Worker    $MKE2FS  /dev/mapper/bad_disk  >> $OUT 2>&1
13*6a54128fSAndroid Build Coastguard Worker    status=$?
14*6a54128fSAndroid Build Coastguard Worker    sleep 1
15*6a54128fSAndroid Build Coastguard Worker    dmsetup remove --retry bad_disk >> $OUT 2>&1
16*6a54128fSAndroid Build Coastguard Worker
17*6a54128fSAndroid Build Coastguard Worker    if [ "$status" = 0 ] ; then
18*6a54128fSAndroid Build Coastguard Worker	ln -f $test_name.log $test_name.failed
19*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: failed"
20*6a54128fSAndroid Build Coastguard Worker    else
21*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: ok"
22*6a54128fSAndroid Build Coastguard Worker	touch $test_name.ok
23*6a54128fSAndroid Build Coastguard Worker    fi
24*6a54128fSAndroid Build Coastguard Workerfi
25