xref: /aosp_15_r20/external/e2fsprogs/tests/j_long_trans/script (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Workerif ! test -x $DEBUGFS_EXE; then
2*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: skipped (no debugfs)"
3*6a54128fSAndroid Build Coastguard Worker	return 0
4*6a54128fSAndroid Build Coastguard Workerfi
5*6a54128fSAndroid Build Coastguard Worker
6*6a54128fSAndroid Build Coastguard WorkerFSCK_OPT=-fy
7*6a54128fSAndroid Build Coastguard WorkerOUT=$test_name.log
8*6a54128fSAndroid Build Coastguard Workerif [ -f $test_dir/expect.gz ]; then
9*6a54128fSAndroid Build Coastguard Worker	EXP=$test_name.tmp
10*6a54128fSAndroid Build Coastguard Worker	gunzip < $test_dir/expect.gz > $EXP1
11*6a54128fSAndroid Build Coastguard Workerelse
12*6a54128fSAndroid Build Coastguard Worker	EXP=$test_dir/expect
13*6a54128fSAndroid Build Coastguard Workerfi
14*6a54128fSAndroid Build Coastguard Worker
15*6a54128fSAndroid Build Coastguard Worker$MKE2FS -F -o Linux -b 1024 -O has_journal -T ext4 $TMPFILE 262144 > $OUT.new 2>&1
16*6a54128fSAndroid Build Coastguard Worker
17*6a54128fSAndroid Build Coastguard Worker$FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1
18*6a54128fSAndroid Build Coastguard Workerstatus=$?
19*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new
20*6a54128fSAndroid Build Coastguard Worker
21*6a54128fSAndroid Build Coastguard Workerecho "debugfs write journal" >> $OUT.new
22*6a54128fSAndroid Build Coastguard Workerecho "jo" > $TMPFILE.cmd
23*6a54128fSAndroid Build Coastguard Workerecho "jw -b 259-4356 /dev/zero" >> $TMPFILE.cmd
24*6a54128fSAndroid Build Coastguard Workerecho "jc" >> $TMPFILE.cmd
25*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null
26*6a54128fSAndroid Build Coastguard Worker
27*6a54128fSAndroid Build Coastguard Workertest -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
28*6a54128fSAndroid Build Coastguard Workerecho "logdump -c" > $TMPFILE.cmd
29*6a54128fSAndroid Build Coastguard Worker$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1
30*6a54128fSAndroid Build Coastguard Worker
31*6a54128fSAndroid Build Coastguard Worker$FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1
32*6a54128fSAndroid Build Coastguard Workerstatus=$?
33*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new
34*6a54128fSAndroid Build Coastguard Workersed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT
35*6a54128fSAndroid Build Coastguard Workerrm -f $TMPFILE $TMPFILE.cmd $OUT.new
36*6a54128fSAndroid Build Coastguard Worker
37*6a54128fSAndroid Build Coastguard Workercmp -s $OUT $EXP
38*6a54128fSAndroid Build Coastguard Workerstatus=$?
39*6a54128fSAndroid Build Coastguard Worker
40*6a54128fSAndroid Build Coastguard Workerif [ "$status" = 0 ] ; then
41*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: ok"
42*6a54128fSAndroid Build Coastguard Worker	touch $test_name.ok
43*6a54128fSAndroid Build Coastguard Workerelse
44*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: failed"
45*6a54128fSAndroid Build Coastguard Worker	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
46*6a54128fSAndroid Build Coastguard Worker	rm -f $test_name.tmp
47*6a54128fSAndroid Build Coastguard Workerfi
48*6a54128fSAndroid Build Coastguard Worker
49*6a54128fSAndroid Build Coastguard Workerunset IMAGE FSCK_OPT OUT EXP
50