qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 05/13] pca9552-test: do not rely on state across tests
Date: Tue, 9 Apr 2019 11:50:54 +0200	[thread overview]
Message-ID: <2a7a057a-33c1-8022-8c43-662e1ddeb3cf@redhat.com> (raw)
In-Reply-To: <20190318171521.8524-6-pbonzini@redhat.com>

On 18/03/2019 18.15, Paolo Bonzini wrote:
> receive_autoinc is relying on the LED state that is set by
> send_and_receive.  Stop doing that, because qgraph resets the
> machine between tests.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  tests/pca9552-test.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/pca9552-test.c b/tests/pca9552-test.c
> index 06359b7435..89b4445e29 100644
> --- a/tests/pca9552-test.c
> +++ b/tests/pca9552-test.c
> @@ -18,11 +18,20 @@
>  
>  static I2CAdapter *i2c;
>  
> +static void pca9552_init(I2CAdapter *i2c)
> +{
> +    /* Switch on LEDs 0 and 12 */
> +    i2c_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0, 0x54);
> +    i2c_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3, 0x54);
> +}
> +
>  static void receive_autoinc(void)
>  {
>      uint8_t resp;
>      uint8_t reg = PCA9552_LS0 | PCA9552_AUTOINC;
>  
> +    pca9552_init(i2cdev);
> +
>      i2c_send(i2c, PCA9552_TEST_ADDR, &reg, 1);
>  
>      /* PCA9552_LS0 */
> @@ -52,16 +61,14 @@ static void send_and_receive(void)
>      value = i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT0);
>      g_assert_cmphex(value, ==, 0x0);
>  
> -    /* Switch on LED 0 */
> -    i2c_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0, 0x54);
> +    pca9552_init(i2cdev);
> +
>      value = i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0);
>      g_assert_cmphex(value, ==, 0x54);
>  
>      value = i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT0);
>      g_assert_cmphex(value, ==, 0x01);
>  
> -    /* Switch on LED 12 */
> -    i2c_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3, 0x54);
>      value = i2c_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3);
>      g_assert_cmphex(value, ==, 0x54);

Reviewed-by: Thomas Huth <thuth@redhat.com>

  parent reply	other threads:[~2019-04-09  9:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190318171521.8524-1-pbonzini@redhat.com>
     [not found] ` <20190318171521.8524-3-pbonzini@redhat.com>
2019-04-09  9:27   ` [Qemu-devel] [PATCH 02/13] qgraph: fix qos_node_contains with options Thomas Huth
2019-04-09  9:27     ` Thomas Huth
     [not found] ` <20190318171521.8524-4-pbonzini@redhat.com>
2019-04-09  9:42   ` [Qemu-devel] [PATCH 03/13] libqos: move common i2c code to libqos Thomas Huth
2019-04-09  9:42     ` Thomas Huth
2019-04-10 12:19     ` Paolo Bonzini
2019-04-10 12:19       ` Paolo Bonzini
     [not found] ` <20190318171521.8524-6-pbonzini@redhat.com>
2019-04-09  9:50   ` Thomas Huth [this message]
2019-04-09  9:50     ` [Qemu-devel] [PATCH 05/13] pca9552-test: do not rely on state across tests Thomas Huth
     [not found] ` <20190318171521.8524-7-pbonzini@redhat.com>
2019-04-09  9:54   ` [Qemu-devel] [PATCH 06/13] imx25-pdk: create ds1338 for qtest inside the test Thomas Huth
2019-04-09  9:54     ` Thomas Huth

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=2a7a057a-33c1-8022-8c43-662e1ddeb3cf@redhat.com \
    --to=thuth@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).