xref: /aosp_15_r20/external/e2fsprogs/tests/f_create_symlinks/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=-yf
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 Workerdd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
16*6a54128fSAndroid Build Coastguard Worker
17*6a54128fSAndroid Build Coastguard Workerecho mke2fs -q -F -o Linux -b 1024 -g 256 -O inline_data,extents -I 256 test.img 1024 > $OUT.new
18*6a54128fSAndroid Build Coastguard Worker$MKE2FS -q -F -o Linux -b 1024 -g 256 -O inline_data,extents -I 256 $TMPFILE 1024 >> $OUT 2>&1
19*6a54128fSAndroid Build Coastguard Worker
20*6a54128fSAndroid Build Coastguard Worker$FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT.new 2>&1
21*6a54128fSAndroid Build Coastguard Workerstatus=$?
22*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new
23*6a54128fSAndroid Build Coastguard Worker
24*6a54128fSAndroid Build Coastguard Workerfor i in 30 60 70 500 1023 1024 1500; do
25*6a54128fSAndroid Build Coastguard Worker	echo "debugfs -R \"symlink /l_$i $(perl -e "print 'x' x $i;")\" test.img" >> $OUT.new
26*6a54128fSAndroid Build Coastguard Worker	$DEBUGFS -w -R "symlink /l_$i $(perl -e "print 'x' x $i;")" $TMPFILE \
27*6a54128fSAndroid Build Coastguard Worker		 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT.new
28*6a54128fSAndroid Build Coastguard Workerdone
29*6a54128fSAndroid Build Coastguard Worker
30*6a54128fSAndroid Build Coastguard Workerfor i in 30 60 70 500 1023 1024 1500; do
31*6a54128fSAndroid Build Coastguard Worker	echo "debugfs -R \"stat /l_$i\" test.img" >> $OUT.new
32*6a54128fSAndroid Build Coastguard Worker	$DEBUGFS -R "stat /l_$i" $TMPFILE 2>&1 | \
33*6a54128fSAndroid Build Coastguard Worker		 grep -v "time: " >> $OUT.new
34*6a54128fSAndroid Build Coastguard Workerdone
35*6a54128fSAndroid Build Coastguard Worker
36*6a54128fSAndroid Build Coastguard Worker$FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT.new 2>&1
37*6a54128fSAndroid Build Coastguard Workerstatus=$?
38*6a54128fSAndroid Build Coastguard Workerecho Exit status is $status >> $OUT.new
39*6a54128fSAndroid Build Coastguard Workersed -f $cmd_dir/filter.sed $OUT.new >> $OUT
40*6a54128fSAndroid Build Coastguard Workerrm -f $OUT.new $TMPFILE
41*6a54128fSAndroid Build Coastguard Worker
42*6a54128fSAndroid Build Coastguard Workercmp -s $OUT $EXP
43*6a54128fSAndroid Build Coastguard Workerstatus=$?
44*6a54128fSAndroid Build Coastguard Worker
45*6a54128fSAndroid Build Coastguard Workerif [ "$status" = 0 ] ; then
46*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: ok"
47*6a54128fSAndroid Build Coastguard Worker	touch $test_name.ok
48*6a54128fSAndroid Build Coastguard Workerelse
49*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: failed"
50*6a54128fSAndroid Build Coastguard Worker	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
51*6a54128fSAndroid Build Coastguard Worker	rm -f $test_name.tmp
52*6a54128fSAndroid Build Coastguard Workerfi
53*6a54128fSAndroid Build Coastguard Worker
54*6a54128fSAndroid Build Coastguard Workerunset IMAGE FSCK_OPT OUT EXP
55