[2/3] oeqa/sysroot.py: Check bitbake return status

Message ID 20220703114114.2313369-2-ptsneves@gmail.com
State Accepted, archived
Commit 5fe8c14f50d414e768588cef0675d8ef296ced77
Headers show
Series [1/3] utils: create_cmdline_shebang_wrapper whitespace and sed refactor | expand

Commit Message

Paulo Neves July 3, 2022, 11:41 a.m. UTC
bitbake ran but we incorrectly did not assert the exit status needs to
be non 0. Now all sysroot tests commands expected to fail are verified
to do so.

Signed-off-by: Paulo Neves <ptsneves@gmail.com>
---
 meta/lib/oeqa/selftest/cases/sysroot.py | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Richard Purdie July 4, 2022, 2:16 p.m. UTC | #1
On Sun, 2022-07-03 at 13:41 +0200, Paulo Neves wrote:
> bitbake ran but we incorrectly did not assert the exit status needs to
> be non 0. Now all sysroot tests commands expected to fail are verified
> to do so.
> 
> Signed-off-by: Paulo Neves <ptsneves@gmail.com>
> ---
>  meta/lib/oeqa/selftest/cases/sysroot.py | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/meta/lib/oeqa/selftest/cases/sysroot.py b/meta/lib/oeqa/selftest/cases/sysroot.py
> index 588fc8c713..294ba4a4a0 100644
> --- a/meta/lib/oeqa/selftest/cases/sysroot.py
> +++ b/meta/lib/oeqa/selftest/cases/sysroot.py
> @@ -45,6 +45,7 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s"
>          expected = "maximum shebang size exceeded, the maximum size is 128. [shebang-size]"
>          res = bitbake("sysroot-shebang-test-native -c populate_sysroot", ignore_status=True)
>          self.assertTrue(expected in res.output, msg=res.output)
> +        self.assertTrue(res.status != 0)
>  
>      def test_sysroot_la(self):
>          """

I did have a question on this patch. Wouldn't it be simpler to remove
the "ignore_status=True" from the bitbake() call?

Cheers,

Richard
Paulo Neves July 4, 2022, 2:28 p.m. UTC | #2
On 7/4/22 16:16, Richard Purdie wrote:
> On Sun, 2022-07-03 at 13:41 +0200, Paulo Neves wrote:
>> bitbake ran but we incorrectly did not assert the exit status needs to
>> be non 0. Now all sysroot tests commands expected to fail are verified
>> to do so.
>>
>> Signed-off-by: Paulo Neves <ptsneves@gmail.com>
>> ---
>>   meta/lib/oeqa/selftest/cases/sysroot.py | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/meta/lib/oeqa/selftest/cases/sysroot.py b/meta/lib/oeqa/selftest/cases/sysroot.py
>> index 588fc8c713..294ba4a4a0 100644
>> --- a/meta/lib/oeqa/selftest/cases/sysroot.py
>> +++ b/meta/lib/oeqa/selftest/cases/sysroot.py
>> @@ -45,6 +45,7 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s"
>>           expected = "maximum shebang size exceeded, the maximum size is 128. [shebang-size]"
>>           res = bitbake("sysroot-shebang-test-native -c populate_sysroot", ignore_status=True)
>>           self.assertTrue(expected in res.output, msg=res.output)
>> +        self.assertTrue(res.status != 0)
>>   
>>       def test_sysroot_la(self):
>>           """
> I did have a question on this patch. Wouldn't it be simpler to remove
> the "ignore_status=True" from the bitbake() call?
>
> Cheers,
>
> Richard
You are right. I guess the assert is more explicit and with the removal 
of the ignore_status it becomes implicit. Let me know if you want me to 
remove the assert and the ignore status and will submit a v2.

Paulo Neves
Richard Purdie July 4, 2022, 2:30 p.m. UTC | #3
On Mon, 2022-07-04 at 16:28 +0200, Paulo Neves wrote:
> On 7/4/22 16:16, Richard Purdie wrote:
> > On Sun, 2022-07-03 at 13:41 +0200, Paulo Neves wrote:
> > > bitbake ran but we incorrectly did not assert the exit status needs to
> > > be non 0. Now all sysroot tests commands expected to fail are verified
> > > to do so.
> > > 
> > > Signed-off-by: Paulo Neves <ptsneves@gmail.com>
> > > ---
> > >   meta/lib/oeqa/selftest/cases/sysroot.py | 5 +++++
> > >   1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/meta/lib/oeqa/selftest/cases/sysroot.py b/meta/lib/oeqa/selftest/cases/sysroot.py
> > > index 588fc8c713..294ba4a4a0 100644
> > > --- a/meta/lib/oeqa/selftest/cases/sysroot.py
> > > +++ b/meta/lib/oeqa/selftest/cases/sysroot.py
> > > @@ -45,6 +45,7 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s"
> > >           expected = "maximum shebang size exceeded, the maximum size is 128. [shebang-size]"
> > >           res = bitbake("sysroot-shebang-test-native -c populate_sysroot", ignore_status=True)
> > >           self.assertTrue(expected in res.output, msg=res.output)
> > > +        self.assertTrue(res.status != 0)
> > >   
> > >       def test_sysroot_la(self):
> > >           """
> > I did have a question on this patch. Wouldn't it be simpler to remove
> > the "ignore_status=True" from the bitbake() call?
> > 
> > Cheers,
> > 
> > Richard
> You are right. I guess the assert is more explicit and with the removal 
> of the ignore_status it becomes implicit. Let me know if you want me to 
> remove the assert and the ignore status and will submit a v2.

Please, I think that would be cleaner.

Cheers,

Richard
Paulo Neves July 7, 2022, 2:50 p.m. UTC | #4
After re-thinking this is the correct version of the patch. We need to 
ignore_status because we are asserting that it actually fails. Otherwise 
the bitbake() will fail the test on the desired failure.

Paulo Neves

On 7/4/22 16:30, Richard Purdie wrote:
> On Mon, 2022-07-04 at 16:28 +0200, Paulo Neves wrote:
>> On 7/4/22 16:16, Richard Purdie wrote:
>>> On Sun, 2022-07-03 at 13:41 +0200, Paulo Neves wrote:
>>>> bitbake ran but we incorrectly did not assert the exit status needs to
>>>> be non 0. Now all sysroot tests commands expected to fail are verified
>>>> to do so.
>>>>
>>>> Signed-off-by: Paulo Neves <ptsneves@gmail.com>
>>>> ---
>>>>    meta/lib/oeqa/selftest/cases/sysroot.py | 5 +++++
>>>>    1 file changed, 5 insertions(+)
>>>>
>>>> diff --git a/meta/lib/oeqa/selftest/cases/sysroot.py b/meta/lib/oeqa/selftest/cases/sysroot.py
>>>> index 588fc8c713..294ba4a4a0 100644
>>>> --- a/meta/lib/oeqa/selftest/cases/sysroot.py
>>>> +++ b/meta/lib/oeqa/selftest/cases/sysroot.py
>>>> @@ -45,6 +45,7 @@ TESTSTRING:pn-sysroot-test-arch2 = "%s"
>>>>            expected = "maximum shebang size exceeded, the maximum size is 128. [shebang-size]"
>>>>            res = bitbake("sysroot-shebang-test-native -c populate_sysroot", ignore_status=True)
>>>>            self.assertTrue(expected in res.output, msg=res.output)
>>>> +        self.assertTrue(res.status != 0)
>>>>    
>>>>        def test_sysroot_la(self):
>>>>            """
>>> I did have a question on this patch. Wouldn't it be simpler to remove
>>> the "ignore_status=True" from the bitbake() call?
>>>
>>> Cheers,
>>>
>>> Richard
>> You are right. I guess the assert is more explicit and with the removal
>> of the ignore_status it becomes implicit. Let me know if you want me to
>> remove the assert and the ignore status and will submit a v2.
> Please, I think that would be cleaner.
>
> Cheers,
>
> Richard

Patch

diff --git a/meta/lib/oeqa/selftest/cases/sysroot.py b/meta/lib/oeqa/selftest/cases/sysroot.py
index 588fc8c713..294ba4a4a0 100644
--- a/meta/lib/oeqa/selftest/cases/sysroot.py
+++ b/meta/lib/oeqa/selftest/cases/sysroot.py
@@ -45,6 +45,7 @@  TESTSTRING:pn-sysroot-test-arch2 = "%s"
         expected = "maximum shebang size exceeded, the maximum size is 128. [shebang-size]"
         res = bitbake("sysroot-shebang-test-native -c populate_sysroot", ignore_status=True)
         self.assertTrue(expected in res.output, msg=res.output)
+        self.assertTrue(res.status != 0)
 
     def test_sysroot_la(self):
         """
@@ -57,10 +58,12 @@  TESTSTRING:pn-sysroot-test-arch2 = "%s"
         res = bitbake("sysroot-la-test -c populate_sysroot", ignore_status=True)
         self.assertTrue(expected in res.output, msg=res.output)
         self.assertTrue('[la]' in res.output, msg=res.output)
+        self.assertTrue(res.status != 0)
 
         res = bitbake("sysroot-la-test-native -c populate_sysroot", ignore_status=True)
         self.assertTrue(expected in res.output, msg=res.output)
         self.assertTrue('[la]' in res.output, msg=res.output)
+        self.assertTrue(res.status != 0)
 
     def test_sysroot_pkgconfig(self):
         """
@@ -73,7 +76,9 @@  TESTSTRING:pn-sysroot-test-arch2 = "%s"
         res = bitbake("sysroot-pc-test -c populate_sysroot", ignore_status=True)
         self.assertTrue('[pkgconfig]' in res.output, msg=res.output)
         self.assertTrue(expected in res.output, msg=res.output)
+        self.assertTrue(res.status != 0)
 
         res = bitbake("sysroot-pc-test-native -c populate_sysroot", ignore_status=True)
         self.assertTrue(expected in res.output, msg=res.output)
         self.assertTrue('[pkgconfig]' in res.output, msg=res.output)
+        self.assertTrue(res.status != 0)