<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>16189</bug_id>
          
          <creation_ts>2026-03-04 13:25:09 +0000</creation_ts>
          <short_desc>qemurunner.run_serial() might report a false failure when command generate kernel log</short_desc>
          <delta_ts>2026-03-16 22:44:48 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>QA/Testing</classification>
          <product>Functional (self) Testing</product>
          <component>oe-selftest</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.1 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yoann Congal">yoann.congal</reporter>
          <assigned_to name="Yoann Congal">yoann.congal</assigned_to>
          <cc>Harish.Sadineni</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>104491</commentid>
    <comment_count>0</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2026-03-04 13:25:09 +0000</bug_when>
    <thetext>While developing rust support for linux, I wrote a test containing
  status, _ = qemu.run_serial(&quot;modprobe rust_out_of_tree&quot;)
  self.assertEqual(status, 1, &quot;Loading rust_out_of_tree module failed!&quot;)
these lines did fail intermittently.

With Harish Sadineni added logs[0]:
https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3432/steps/15/logs/stdio
  (qemu) 
  Waiting at most 1000 seconds for login banner (03/02/26 10:29:57)
  Connection from 127.0.0.1:35160
  Reached login banner in 2.84 seconds (03/02/26 10:30:00)
  Logged in as root in serial console
  2026-03-02 10:30:03,561 - oe-selftest - INFO - modprobe rust_minimal -&gt; status=0, output=
  [    5.910903] rust_minimal: Rust minimal sample (init)
  0[    5.911126] rust_minimal: Am I built-in? false
  2026-03-02 10:30:09,346 - oe-selftest - INFO - 11: 13/57 301/670 (521.04s) (0 failed) (runtime_test.RustKernel.test_kernel_rust_sample)
  2026-03-02 10:30:09,346 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
    File &quot;/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/runtime_test.py&quot;, line 528, in test_kernel_rust_sample
      self.assertEqual(status, 1, &quot;Loading rust_minimal module failed!&quot;)
      ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File &quot;/usr/lib/python3.13/unittest/case.py&quot;, line 907, in assertEqual
      assertion_func(first, second, msg=msg)
      ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
    File &quot;/usr/lib/python3.13/unittest/case.py&quot;, line 900, in _baseAssertEqual
      raise self.failureException(msg)
  AssertionError: 0 != 1 : Loading rust_minimal module failed!

run_serial code is here: https://git.openembedded.org/openembedded-core/tree/meta/lib/oeqa/utils/qemurunner.py#n661:
It runs &quot;$command; echo $?&quot; and read the last line to get the command exit code. 

I wonder if the kernel printing on the console prevents run_serial to correctly read the command exit code...
Maybe removing all console printing after banner (with the kernel.printk sysctl maybe) is a good idea?

Also, this intermittent error only happened on arm host and qemuarm64 machine, so maybe it&apos;s KVM timing related or/and qemuarm64 serial console configuration related...

[0]: https://lore.kernel.org/openembedded-core/56f69f79-77b8-4bdc-8401-f51d3e7d3bed@windriver.com/T/#u</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104524</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-03-05 15:46:46 +0000</bug_when>
    <thetext>Only seen on arm host and qemuarm64 emulator.

Ross mentioned that LabGrid had the same problem and 
they have a fix/work-around.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104526</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2026-03-05 15:50:54 +0000</bug_when>
    <thetext>https://github.com/labgrid-project/labgrid/blob/master/labgrid/driver/shelldriver.py has the labgrid code where they generate a marker (taking care not to accidentally generate something like &quot;ERROR&quot;) and use that to mark up where the exit code is.

Josh mentioned that labgrid also turns off kernel console messages when it connects, so we should likely do both.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104642</commentid>
    <comment_count>3</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2026-03-14 16:58:52 +0000</bug_when>
    <thetext>Patch sent: [PATCH] qemurunner: Hide kernel messages on first non-raw run_serial() call
https://lists.openembedded.org/g/openembedded-core/message/233091</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104673</commentid>
    <comment_count>4</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2026-03-16 22:44:48 +0000</bug_when>
    <thetext>Merged: qemurunner: Hide kernel messages on first non-raw run_serial() call - openembedded-core - OpenEmbedded Core layer
https://git.openembedded.org/openembedded-core/commit/?id=2dc4d2f8b5c7a6e87291385fb860436593767199&amp;h=master</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>