[Buildroot] [PATCH] support/testing: use .assertRunOk() when possible

Thomas Petazzoni thomas.petazzoni at bootlin.com
Mon Aug 23 20:10:38 UTC 2021


On Sun, 22 Aug 2021 17:00:17 +0200
Romain Naour <romain.naour at gmail.com> wrote:

> >>      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?

Indeed, this change is wrong, we should revert it.

> 
> Theses two tests are expecting check_network() failing (exitCode = 1)
> tests.init.test_busybox.TestInitSystemBusyboxRw
> tests.init.test_busybox.TestInitSystemBusyboxRo
> 
> Maybe define assertRunNok?

In this specific case, an assertRunNok would not help: the
check_network() function receives an argument that says which exit code
we expect.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


More information about the buildroot mailing list