[LTP] [PATCH 3/4] kernel: Fix tst_brk TFAIL

Petr Vorel pvorel@suse.cz
Wed Jan 24 13:02:12 CET 2024


> Hi!
> > diff --git a/testcases/kernel/device-drivers/zram/zram01.sh b/testcases/kernel/device-drivers/zram/zram01.sh
> > index 6bc305f2c..234bf06dd 100755
> > --- a/testcases/kernel/device-drivers/zram/zram01.sh
> > +++ b/testcases/kernel/device-drivers/zram/zram01.sh
> > @@ -82,7 +82,8 @@ zram_makefs()
> >  		mkfs.$fs /dev/zram$i > err.log 2>&1
> >  		if [ $? -ne 0 ]; then
> >  			cat err.log
> > -			tst_brk TFAIL "failed to make $fs on /dev/zram$i"
> > +			tst_res TFAIL "failed to make $fs on /dev/zram$i"
> > +			return

> I do not think that this one is correct, unlike other tests the steps in
> zram depends on each other if this fails and we attempt to continue we
> will get failues from zram_mount and zram_fill_fs as well.

> The zram tests are unfortunatelly messy in a sense that a testcase is
> a setup for the next one so we really need to exit the whole test if one
> of the testcases fails. I guess the clearest solution would be TFAIL
> followed by a TBROK in this case. Something as:

> 	tst_res TFAIL "Failed to make $fs on /dev/zram$i"
> 	tst_brk TBROK "Can't continue with mounting the FS"

You're right! I'll just slightly modify
	tst_brk TBROK "Can't continue with mounting $fs"


> > diff --git a/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh b/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
> > index b675a20a1..2a28562e6 100755
> > --- a/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
> > +++ b/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
> > @@ -159,7 +159,8 @@ get_pcr10_aggregate()
> >  		$cmd > hash.txt 2>&1
> >  		ret=$?
> >  	elif [ $ret -ne 0 -a "$MISSING_EVMCTL" = 1 ]; then
> > -		tst_brk TFAIL "evmctl failed $msg"
> > +		tst_res TFAIL "evmctl failed $msg"
> > +		return
> >  	fi

> Again here, I'm not sure if it's safe to continue with the rest of the
> test.

Yes, this is safe, because the output of get_pcr10_aggregate() is later checked:

	get_pcr10_aggregate > tmp.txt
	pcr_aggregate="$(cat tmp.txt)"
	if [ -z "$pcr_aggregate" ]; then
		return
	fi

I made ima_tpm.sh quite hard to understand. I guess soon I should drop support
for older evmctl to make test easier to understand.

Kind regards,
Petr


More information about the ltp mailing list