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

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

 



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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux