[LTP] [PATCH] controllers/cpuacct: rewrote testcases

Cyril Hrubis chrubis@suse.cz
Mon Nov 9 20:05:04 CET 2015


Hi!
> > +	fi
> > +}
> > +
> > +mount_cpuacct()
> > +{
> > +	mount -t cgroup -o cpuacct none $mount_point
> > +	verify_result $? 0 "Error occured while mounting cgroup"
> 
> Interesting idea. Maybe we should add such function to the test.sh
> library. Something that would call tst_brkm on non zero $?. Something
> as:
> 
> mount -t cgroup -o cpuacct none $mount_point
> tst_brkm_err TCONF "Failed to mount cgroup $mount_point"
> 
> and the test.sh would have:
> 
> tst_brkm_err()
> {
> 	if [ $? -ne 0 ]; then
> 		tst_brkm $@
> 	fi
> }

And I nearly forgotten that we added even something better. We have ROD
function that works as:

ROD mount -t cgroup -o cpuacct none $mount_point

(ROD is acronym for run or die and it does exactly the thing you need)

FYI: Have a look at:

https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#23-writing-a-testcase-in-shell

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the Ltp mailing list