qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [kvm-unit-tests PATCH v5 1/2] run_tests: put logs into


From: Peter Xu
Subject: Re: [Qemu-devel] [kvm-unit-tests PATCH v5 1/2] run_tests: put logs into per-test file
Date: Thu, 12 Jan 2017 11:16:21 +0800
User-agent: Mutt/1.5.24 (2015-08-30)

On Wed, Jan 11, 2017 at 11:46:38AM +0100, Andrew Jones wrote:

[...]

> > So, how about this:
> > 
> >     rm -rf $unittest_log_dir.old || err "Failed remove old logs"
> >     if [[ -d $unittest_log_dir ]]; then
> 
> Only [ ... ] for tests like these

I thought [[ ... ]] would be superior to [ ... ] if we are not
considering the POSIX compatibility issue?

Hmm, after a quick grep, I see that kvm-unit-tests repo is using [[
... ]] only if doing any kind of pattern/regex matching, right? If so,
I'll just follow. ;-)

> 
> >         mv $unittest_log_dir $unittest_log_dir.old ||
> >             err "Failed backup logs"
> >     fi
> >     mkdir $unittest_log_dir || err "Failed to create log dir"
> > 
> > And define err() in common.bash:
> > 
> >     function err()
> >     {
> >         echo "$@"
> >         exit 1
> >     }
> 
> The above is mostly just translating rm/mv/mkdir stderr messages to
> new messages. We can do it much more simply like
> 
>  rm -rf logs.old
>  [ -d logs ] && mv logs logs.old
>  mkdir logs || exit 2

Okay I'll use this. Thanks!

-- peterx



reply via email to

[Prev in Thread] Current Thread [Next in Thread]