xref: /aosp_15_r20/external/e2fsprogs/tests/t_quota_add/script (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard WorkerFSCK_OPT=-yf
2*6a54128fSAndroid Build Coastguard Worker
3*6a54128fSAndroid Build Coastguard Workerif [ "$QUOTA" != "y" ]; then
4*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: skipped"
5*6a54128fSAndroid Build Coastguard Worker	return 0
6*6a54128fSAndroid Build Coastguard Workerfi
7*6a54128fSAndroid Build Coastguard Worker
8*6a54128fSAndroid Build Coastguard Worker$MKE2FS -q -F -o Linux -b 4096 -O quota -E quotatype=prjquota $TMPFILE 10000 > $test_name.log 2>&1
9*6a54128fSAndroid Build Coastguard Workerstatus=$?
10*6a54128fSAndroid Build Coastguard Workerif [ "$status" != 0 ] ; then
11*6a54128fSAndroid Build Coastguard Worker	echo "mke2fs failed" > $test_name.failed
12*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: failed"
13*6a54128fSAndroid Build Coastguard Worker	return $status
14*6a54128fSAndroid Build Coastguard Workerfi
15*6a54128fSAndroid Build Coastguard Worker
16*6a54128fSAndroid Build Coastguard Workerfor type in usrquota grpquota; do
17*6a54128fSAndroid Build Coastguard Worker	$TUNE2FS -Q $type $TMPFILE >> $test_name.log 2>&1
18*6a54128fSAndroid Build Coastguard Worker	status=$?
19*6a54128fSAndroid Build Coastguard Worker	if [ "$status" != 0 ] ; then
20*6a54128fSAndroid Build Coastguard Worker		echo "tune2fs -O quota failed with $status" > $test_name.failed
21*6a54128fSAndroid Build Coastguard Worker		echo "$test_name: $test_description: failed"
22*6a54128fSAndroid Build Coastguard Worker		return $status
23*6a54128fSAndroid Build Coastguard Worker	fi
24*6a54128fSAndroid Build Coastguard Workerdone
25*6a54128fSAndroid Build Coastguard Worker
26*6a54128fSAndroid Build Coastguard WorkerUUSAGE=$($DEBUGFS 2>/dev/null -R "lq user" $TMPFILE | grep "^ *0 ")
27*6a54128fSAndroid Build Coastguard Workerfor type in group project; do
28*6a54128fSAndroid Build Coastguard Worker	TUSAGE=$($DEBUGFS 2>/dev/null -R "lq $type" $TMPFILE | grep "^ *0 ")
29*6a54128fSAndroid Build Coastguard Worker	if [ "$TUSAGE" != "$UUSAGE" ]; then
30*6a54128fSAndroid Build Coastguard Worker		echo "user and $type quota entries are different" >$test_name.failed
31*6a54128fSAndroid Build Coastguard Worker		echo "$test_name: $test_description: failed"
32*6a54128fSAndroid Build Coastguard Worker		return 1
33*6a54128fSAndroid Build Coastguard Worker	fi
34*6a54128fSAndroid Build Coastguard Workerdone
35*6a54128fSAndroid Build Coastguard Worker
36*6a54128fSAndroid Build Coastguard Worker$FSCK $FSCK_OPT $TMPFILE >> $test_name.log 2>&1
37*6a54128fSAndroid Build Coastguard Workerstatus=$?
38*6a54128fSAndroid Build Coastguard Workerif [ "$status" = 0 ] ; then
39*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: ok"
40*6a54128fSAndroid Build Coastguard Worker	touch $test_name.ok
41*6a54128fSAndroid Build Coastguard Workerelse
42*6a54128fSAndroid Build Coastguard Worker	echo "e2fsck with quota enabled failed with $status" > $test_name.failed
43*6a54128fSAndroid Build Coastguard Worker	echo "$test_name: $test_description: failed"
44*6a54128fSAndroid Build Coastguard Worker	return $status
45*6a54128fSAndroid Build Coastguard Workerfi
46*6a54128fSAndroid Build Coastguard Workerrm -f $TMPFILE
47