All of lore.kernel.org
 help / color / mirror / Atom feed
From: Romain Naour <romain.naour@gmail.com>
To: "Yann E. MORIN" <yann.morin.1998@free.fr>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Titouan Christophe <titouanchristophe@gmail.com>,
	Marcin Niestroj <m.niestroj@grinn-global.com>,
	Matt Weber <matthew.weber@collins.com>,
	Ricardo Martincoski <ricardo.martincoski@gmail.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] support/testing: use .assertRunOk() when possible
Date: Sun, 22 Aug 2021 17:00:17 +0200	[thread overview]
Message-ID: <2bc67042-6651-caab-c88e-75c40afb1c73@gmail.com> (raw)
In-Reply-To: <20210626154257.GN104638@scaer>

Thomas, Yann, All,

Le 26/06/2021 à 17:42, Yann E. MORIN a écrit :
> Thomas, All,
> 
> On 2021-06-26 15:32 +0200, Thomas Petazzoni spake thusly:
>> The BRTest() class implements an assertRunOk() method that does the
>> very common work of running a command inside the emulator, and
>> checking that it is successful.
>>
>> This commit changes all locations where this .assertRunOk() method can
>> be used, instead of open-coding the same logic.
>>
>> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> 
> Applied to master, thanks.
> 
> Regards,
> Yann E. MORIN.
> 
>> ---
>>  support/testing/tests/fs/test_f2fs.py         |  3 +--
>>  support/testing/tests/fs/test_jffs2.py        |  3 +--
>>  support/testing/tests/fs/test_squashfs.py     |  3 +--
>>  support/testing/tests/init/base.py            |  6 ++----
>>  support/testing/tests/init/test_none.py       |  3 +--
>>  support/testing/tests/init/test_systemd.py    |  3 +--
>>  support/testing/tests/package/test_atop.py    |  6 ++----
>>  .../testing/tests/package/test_bmap_tools.py  |  3 +--
>>  .../tests/package/test_docker_compose.py      |  3 +--
>>  .../testing/tests/package/test_dropbear.py    |  6 ++----
>>  support/testing/tests/package/test_lua.py     |  3 +--
>>  support/testing/tests/package/test_netdata.py |  3 +--
>>  support/testing/tests/package/test_openssh.py |  6 ++----
>>  support/testing/tests/package/test_opkg.py    | 12 ++++-------
>>  support/testing/tests/package/test_perl.py    |  3 +--
>>  support/testing/tests/package/test_python.py  | 12 ++++-------
>>  .../tests/package/test_python_pytest.py       |  3 +--
>>  .../package/test_python_pytest_asyncio.py     |  3 +--
>>  support/testing/tests/package/test_redis.py   |  3 +--
>>  support/testing/tests/package/test_rust.py    |  6 ++----
>>  support/testing/tests/package/test_s6_rc.py   | 21 +++++++++----------
>>  support/testing/tests/package/test_sudo.py    |  6 ++----
>>  .../testing/tests/package/test_syslog_ng.py   | 10 ++++-----
>>  support/testing/tests/package/test_tmux.py    | 12 ++++-------
>>  24 files changed, 51 insertions(+), 91 deletions(-)
>>

[...]

>> diff --git a/support/testing/tests/init/base.py b/support/testing/tests/init/base.py
>> index 75cfbe9c59..80f7731ba3 100644
>> --- a/support/testing/tests/init/base.py
>> +++ b/support/testing/tests/init/base.py
>> @@ -39,10 +39,8 @@ class InitSystemBase(infra.basetest.BRTest):
>>  
>>      def check_init(self, path):
>>          cmd = "cmp /proc/1/exe {}".format(path)
>> -        _, exit_code = self.emulator.run(cmd)
>> -        self.assertEqual(exit_code, 0)
>> +        self.assertRunOk(cmd)
>>  
>>      def check_network(self, interface, exitCode=0):
>>          cmd = "ip addr show {} |grep inet".format(interface)
>> -        _, exit_code = self.emulator.run(cmd)
>> -        self.assertEqual(exit_code, exitCode)
>> +        self.assertRunOk(cmd)

What about exitCode argument?

Theses two tests are expecting check_network() failing (exitCode = 1)
tests.init.test_busybox.TestInitSystemBusyboxRw
tests.init.test_busybox.TestInitSystemBusyboxRo

Maybe define assertRunNok?

Best regards,
Romain
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

  reply	other threads:[~2021-08-22 15:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-26 13:32 [Buildroot] [PATCH] support/testing: use .assertRunOk() when possible Thomas Petazzoni
2021-06-26 15:42 ` Yann E. MORIN
2021-08-22 15:00   ` Romain Naour [this message]
2021-08-23 20:10     ` Thomas Petazzoni

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=2bc67042-6651-caab-c88e-75c40afb1c73@gmail.com \
    --to=romain.naour@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=m.niestroj@grinn-global.com \
    --cc=matthew.weber@collins.com \
    --cc=ricardo.martincoski@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=titouanchristophe@gmail.com \
    --cc=yann.morin.1998@free.fr \
    /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.