qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Andrew Jones <drjones@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org,
	"Radim Krčmář" <rkrcmar@redhat.com>
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	[thread overview]
Message-ID: <20170112031621.GH4450@pxdev.xzpeter.org> (raw)
In-Reply-To: <20170111104638.die63k7v72uhgufx@kamzik.brq.redhat.com>

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	other threads:[~2017-01-12  3:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11  5:29 [Qemu-devel] [kvm-unit-tests PATCH v5 0/2] run_tests: support concurrent test execution Peter Xu
2017-01-11  5:29 ` [Qemu-devel] [kvm-unit-tests PATCH v5 1/2] run_tests: put logs into per-test file Peter Xu
2017-01-11  9:06   ` Andrew Jones
2017-01-11  9:51     ` Andrew Jones
2017-01-11 10:12       ` Peter Xu
2017-01-11 10:46         ` Andrew Jones
2017-01-12  3:16           ` Peter Xu [this message]
2017-01-11  5:29 ` [Qemu-devel] [kvm-unit-tests PATCH v5 2/2] run_tests: allow run tests in parallel Peter Xu
2017-01-11 11:00   ` Andrew Jones
2017-01-11 13:09     ` Andrew Jones
2017-01-12  3:26       ` Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170112031621.GH4450@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).