[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [OSSTEST PATCH 07/11] cri-getconfig: Provide debugging for get_psql_cmd
On Fri, 2015-12-04 at 19:35 +0000, Ian Jackson wrote: > This allows us to execute only the first <some number> SQL > invocations.ÂÂThe first non-executed one is dumped, instead, by having > get_psql_command print a rune involving ./mg-debug-fail (which the > caller will then execute). > > The locking makes things work roughly-correctly if get_psql_cmd is run > in multiple processes at once: it is not defined exactly which > invocations get which counter values, but they will all work properly > and get exactly one counter value each. > > If set -x is in force, turn it off for get_psql_cmd: our perl rune is > uninteresting to see repeated ad infinitum in debugging output. I should probably know this, but what is the scope of the set +x here? Is it confined to get_psql_cmd or will callers find things going surprisingly quiet? Experimentally I think it is the latter, which is a shame. Maybe just wrap the set+perl in ()s ? > > Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> > --- > Âcri-getconfig |ÂÂÂ16 ++++++++++++++++ > Â1 file changed, 16 insertions(+) > > diff --git a/cri-getconfig b/cri-getconfig > index 48528b5..a357d86 100644 > --- a/cri-getconfig > +++ b/cri-getconfig > @@ -41,6 +41,22 @@ getrepos() { > Â} > Â > Âget_psql_cmd () { > + # To use this: > + #ÂÂon each test run, rm -f t.psql-counter > + #ÂÂand set OSSTEST_PSQL_ONLY_DO to an integer > + if [ "x$OSSTEST_PSQL_ONLY_DO" != x ]; then > + local f=t.psql-counter > + psql_counter=$( with-lock-ex -w $f.lock bash -ec ' > + psql_counter=$(cat '$f' || echo 0) > + echo $(( $psql_counter + 1 )) >'$f'.tmp > + mv -f '$f'.tmp '$f' > + echo $psql_counter' ) > + if ! [ $psql_counter -lt $OSSTEST_PSQL_ONLY_DO ]; then > + printf './mg-debug-fail ' > + fi > + fi > + > + set +x > Â perl -we ' > Â use Osstest; > Â use Osstest::Executive; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |