[Buildroot] [PATCH v2 17/18] support/testing/tests: add test for check_bin_arch
Yann E. MORIN
yann.morin.1998 at free.fr
Tue Jul 6 21:25:18 UTC 2021
Hervé, All,
On 2021-07-06 22:20 +0200, Yann E. MORIN spake thusly:
> On 2021-07-06 16:25 +0200, Herve Codina spake thusly:
> > From: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
> >
> > This tests build a bogus package that installs a binary built for the
> > host architecture into $(TARGET_DIR), which should cause a build
> > failure, at least as long as the host architecture isn't ARM.
> >
> > Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
> > Signed-off-by: Herve Codina <herve.codina at bootlin.com>
> > ---
> https://patchwork.ozlabs.org/project/buildroot/patch/20200430095249.782597-11-thomas.petazzoni@bootlin.com/
[--SNIP--]
> > + if logf_path:
> > + s = 'ERROR: architecture for "/usr/bin/foo" is'
> > + with open(logf_path, "r") as f:
> > + lines = [l for l in f.readlines() if l.startswith(s)]
> > + self.assertEqual(len(lines), 0)
>
> So, this tests explicitly installs a host executable in target/, yet the
> assert is written to ensure there is no error: it compares against zero.
> So this test-case will fail, by design.
Ah, I think I see the issue: previously, the test by Thomas was calling
'grep', and was checking against '0', which meant that grep _had found_
the string...
So yeah, we really need to check that we _did_ find the error pattern:
self.assertEqual(len(lines), 1)
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
More information about the buildroot
mailing list