xref: /aosp_15_r20/external/e2fsprogs/tests/m_devdir/script (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Workertest_description="create fs image from /dev"
2*6a54128fSAndroid Build Coastguard Workerif ! test -x $DEBUGFS_EXE; then
3*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: skipped (no debugfs)"
4*6a54128fSAndroid Build Coastguard Worker	return 0
5*6a54128fSAndroid Build Coastguard Workerfi
6*6a54128fSAndroid Build Coastguard Worker
7*6a54128fSAndroid Build Coastguard WorkerMKFS_DIR=/dev
8*6a54128fSAndroid Build Coastguard WorkerOUT=$test_name.log
9*6a54128fSAndroid Build Coastguard Worker
10*6a54128fSAndroid Build Coastguard Worker$MKE2FS -q -F -o Linux -T ext4 -O metadata_csum,64bit -E lazy_itable_init=1 -b 1024 -d $MKFS_DIR $TMPFILE 16384 > $OUT 2>&1
11*6a54128fSAndroid Build Coastguard Workermkfs_status=$?
12*6a54128fSAndroid Build Coastguard Worker
13*6a54128fSAndroid Build Coastguard Worker$DUMPE2FS $TMPFILE >> $OUT 2>&1
14*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -R 'ls /' $TMPFILE >> $OUT 2>&1
15*6a54128fSAndroid Build Coastguard Worker
16*6a54128fSAndroid Build Coastguard Worker$FSCK -f -n $TMPFILE >> $OUT 2>&1
17*6a54128fSAndroid Build Coastguard Workerfsck_status=$?
18*6a54128fSAndroid Build Coastguard Worker
19*6a54128fSAndroid Build Coastguard Workersed -f $cmd_dir/filter.sed $OUT > $OUT.tmp
20*6a54128fSAndroid Build Coastguard Workermv $OUT.tmp $OUT
21*6a54128fSAndroid Build Coastguard Worker
22*6a54128fSAndroid Build Coastguard Workerif [ $mkfs_status -ne 0 ]; then
23*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: skipped"
24*6a54128fSAndroid Build Coastguard Workerelif [ $mkfs_status -eq 0 ] && [ $fsck_status -eq 0 ]; then
25*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: ok"
26*6a54128fSAndroid Build Coastguard Worker	touch $test_name.ok
27*6a54128fSAndroid Build Coastguard Workerelse
28*6a54128fSAndroid Build Coastguard Worker        echo "$test_name: $test_description: failed"
29*6a54128fSAndroid Build Coastguard Workerfi
30*6a54128fSAndroid Build Coastguard Worker
31*6a54128fSAndroid Build Coastguard Workerrm -f $TMPFILE.cmd
32*6a54128fSAndroid Build Coastguard Workerunset MKFS_DIR OUT EXP
33