All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mariano Lopez <mariano.lopez@linux.intel.com>
To: Paul Eggleton <paul.eggleton@linux.intel.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] testimage: Run commands in target and host when test fails
Date: Tue, 18 Aug 2015 10:18:11 -0500	[thread overview]
Message-ID: <55D34CB3.8060505@linux.intel.com> (raw)
In-Reply-To: <3297628.6dWWSbZelC@peggleto-mobl.ger.corp.intel.com>

Hi Paul,

On 08/18/2015 03:33 AM, Paul Eggleton wrote:
> Hi Mariano,
>
> On Monday 17 August 2015 12:41:42 mariano.lopez@linux.intel.com wrote:
>> From: Mariano Lopez <mariano.lopez@linux.intel.com>
>>
>> This patch modify three files altought two of them
>> are minimal modifications:
>>
>> testimage.bbclass:
>>      Create new vars for easy modification of the dump
>> directory and commands to be run on host and target
>> when a test fails
>>      TESTIMAGE_DUMP_DIR: Directory to save the dumps
>>      TESTIMAGE_DUMP_TRG: Commands to run on target
>>      TESTIMAGE_DUMP_HST: Commands to run on host
> Can we please use full names (i.e. "...HOST" and "...TARGET")? We're not short
> of space here ;)

Sure, no problem

>   
>> targetcontrol.py:
>>      Extract vars from the datastore for later use
>>
>> oetest.py:
>>      - Allow to use the vars defined in testimage class
>>      - Now able to run commands in the host and dump the
>>        results
>>      - Fix an issue with the condition where to run the
>>        dump commands (Before it run the commands every
>>        test after a failure, now it runs the commands only
>>        in tests that failed)
>>      - Fix the output to stdout
>>
>> [YOCTO #8118]
>>
>> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
>> ---
>>   meta/classes/testimage.bbclass |  9 +++++++++
>>   meta/lib/oeqa/oetest.py        | 42
>> +++++++++++++++++++++++++++--------------- meta/lib/oeqa/targetcontrol.py |
>>   3 +++
>>   3 files changed, 39 insertions(+), 15 deletions(-)
>>
>> diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
>> index 140babe..1580a4e 100644
>> --- a/meta/classes/testimage.bbclass
>> +++ b/meta/classes/testimage.bbclass
>> @@ -56,6 +56,15 @@ TESTIMAGEDEPENDS_qemuall =
>> "qemu-native:do_populate_sysroot qemu-helper-native:d TESTIMAGELOCK =
>> "${TMPDIR}/testimage.lock"
>>   TESTIMAGELOCK_qemuall = ""
>>
>> +TESTIMAGE_DUMP_DIR ?= "/tmp/oe-saved-tests/"
>> +
>> +python () {
>> +    target_cmds = ["top -bn1", "ps", "free", "df", "_ping", "dmesg",
>> "netstat -an", "ip address", "_logs"] +    host_cmds = ["top -bn1", "ps",
>> "free", "df", "memstat", "dmesg", "netstat -an"] +
>> d.setVar("TESTIMAGE_DUMP_TRG", target_cmds)
>> +    d.setVar("TESTIMAGE_DUMP_HST", host_cmds)
>> +}
> This is isn't how I would recommend doing this. What I suggested earlier when
> we talked about this was:
>
> testimage_dump_target() {
> 	top -bn1
> 	ps
> 	free
> 	df
> 	...
> }
>
> Then you'd just d.getVar('testimage_dump_target', True), and treat the
> contents as a complete shell script to be run - i.e. write it to a file with
> #!/bin/sh as a prefix and run it. As a bonus, the value can be overridden or
> appended to from elsewhere. (This is similar to how we deal with
> pkg_postinst_<packagename> for postinstall scripts.)

Implement this for the host wouldn't be a problem, it gets
interesting for the target.These commands would be run from
  the serial console, when the network fails, so it would be
difficult to run as a shell script. And also would be difficult
to install the scripts on the image because testimage would
run after do_rootfs takes place.

What would be the best approach for the target case?

>> +        self.dump_trg = d.getVar("TESTIMAGE_DUMP_TRG", False)
>> +        self.dump_hst = d.getVar("TESTIMAGE_DUMP_HST", False)
>> +        self.dump_dir = d.getVar("TESTIMAGE_DUMP_DIR", False)
> As a general note - for this kind of thing, you need to be specifying True not
> False for the expansion parameter - the value may well contain references or
> other expressions (such as ${TMPDIR}) that need expanding. In fact, it's
> relatively uncommon for False to be what you want - most of the time the value
> should be expanded if you're about to use it for something.

You are right, I will change that.

>
> Cheers,
> Paul
>

-- 
Mariano Lopez


  reply	other threads:[~2015-08-18 15:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 12:41 [PATCH] testimage: Run commands in target and host when test fails mariano.lopez
2015-08-18  8:33 ` Paul Eggleton
2015-08-18 15:18   ` Mariano Lopez [this message]
2015-08-18 15:23     ` Paul Eggleton

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=55D34CB3.8060505@linux.intel.com \
    --to=mariano.lopez@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=paul.eggleton@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.