[Bug 2149909] [NEW] test_run_report_bug_kernel_thread might fail in a VM

Benjamin Drung 2149909 at bugs.launchpad.net
Wed Apr 22 11:59:34 UTC 2026


Public bug reported:

test_run_report_bug_kernel_thread might failed in a autopkgtest VM:

```
=================================== FAILURES ===================================
_____________________ T.test_run_report_bug_kernel_thread ______________________

self = <tests.integration.test_ui.T testMethod=test_run_report_bug_kernel_thread>
get_version_mock = <MagicMock name='get_version' id='130971739753504'>

    @unittest.mock.patch("apport.packaging_impl.impl.get_version")
    def test_run_report_bug_kernel_thread(self, get_version_mock: MagicMock) -> None:
        """run_report_bug() for a pid of a kernel thread"""
        # The kernel package might not be installed in chroot environments.
        # Therefore mock get_version for the kernel package.
        get_version_mock.return_value = "5.15.0-33.34"
    
        for path in glob.glob("/proc/[0-9]*/stat"):
            with open(path, encoding="utf-8") as f:
                proc_stat = f.read().split()
            flags = int(proc_stat[8])
            if flags & apport.ui.PF_KTHREAD:
                pid = int(proc_stat[0])
                break
        else:
            self.skipTest("no kernel thread found")
    
        ui = UserInterfaceMock(["ui-test", "-f", "-P", str(pid)])
        ui.present_details_response = apport.ui.Action(report=True)
        ui.run_argv()
        assert ui.report
    
        kernel_package = packaging.get_kernel_package()
>       self.assertEqual(
            ui.report["Package"], f"{kernel_package} {get_version_mock.return_value}"
        )
E       AssertionError: 'linux-image-7.0.0-12-generic 5.15.0-33.34 [origin: unknown]' != 'linux-image-7.0.0-12-generic 5.15.0-33.34'
E       - linux-image-7.0.0-12-generic 5.15.0-33.34 [origin: unknown]
E       ?                                          ------------------
E       + linux-image-7.0.0-12-generic 5.15.0-33.34

tests/integration/test_ui.py:911: AssertionError
=============================== warnings summary ===============================
```

** Affects: apport (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to apport in Ubuntu.
https://bugs.launchpad.net/bugs/2149909

Title:
  test_run_report_bug_kernel_thread might fail in a VM

Status in apport package in Ubuntu:
  New

Bug description:
  test_run_report_bug_kernel_thread might failed in a autopkgtest VM:

  ```
  =================================== FAILURES ===================================
  _____________________ T.test_run_report_bug_kernel_thread ______________________

  self = <tests.integration.test_ui.T testMethod=test_run_report_bug_kernel_thread>
  get_version_mock = <MagicMock name='get_version' id='130971739753504'>

      @unittest.mock.patch("apport.packaging_impl.impl.get_version")
      def test_run_report_bug_kernel_thread(self, get_version_mock: MagicMock) -> None:
          """run_report_bug() for a pid of a kernel thread"""
          # The kernel package might not be installed in chroot environments.
          # Therefore mock get_version for the kernel package.
          get_version_mock.return_value = "5.15.0-33.34"
      
          for path in glob.glob("/proc/[0-9]*/stat"):
              with open(path, encoding="utf-8") as f:
                  proc_stat = f.read().split()
              flags = int(proc_stat[8])
              if flags & apport.ui.PF_KTHREAD:
                  pid = int(proc_stat[0])
                  break
          else:
              self.skipTest("no kernel thread found")
      
          ui = UserInterfaceMock(["ui-test", "-f", "-P", str(pid)])
          ui.present_details_response = apport.ui.Action(report=True)
          ui.run_argv()
          assert ui.report
      
          kernel_package = packaging.get_kernel_package()
  >       self.assertEqual(
              ui.report["Package"], f"{kernel_package} {get_version_mock.return_value}"
          )
  E       AssertionError: 'linux-image-7.0.0-12-generic 5.15.0-33.34 [origin: unknown]' != 'linux-image-7.0.0-12-generic 5.15.0-33.34'
  E       - linux-image-7.0.0-12-generic 5.15.0-33.34 [origin: unknown]
  E       ?                                          ------------------
  E       + linux-image-7.0.0-12-generic 5.15.0-33.34

  tests/integration/test_ui.py:911: AssertionError
  =============================== warnings summary ===============================
  ```

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/2149909/+subscriptions





More information about the foundations-bugs mailing list