Thread (35 messages) flat view 35 messages, 3 authors, 2021-07-09

[Buildroot] [PATCH v2 17/18] support/testing/tests: add test for check_bin_arch

From: Yann E. MORIN <hidden>
Date: 2021-07-06 21:25:18

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:
quoted
From: Thomas Petazzoni <thomas.petazzoni@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@bootlin.com>
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
https://patchwork.ozlabs.org/project/buildroot/patch/20200430095249.782597-11-thomas.petazzoni at bootlin.com/
[--SNIP--]
quoted
+        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.  |
'------------------------------^-------^------------------^--------------------'
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help