<?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>16386</bug_id>
          
          <creation_ts>2026-08-06 05:56:19 +0000</creation_ts>
          <short_desc>Investigate reviving ptest coverage for systemd</short_desc>
          <delta_ts>2026-09-04 08:09:30 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>6.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>IN PROGRESS REVIEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>6.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Himani Barde">HimaniRamesh.Barde</reporter>
          <assigned_to name="Himani Barde">HimaniRamesh.Barde</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</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>106436</commentid>
    <comment_count>0</comment_count>
    <who name="Himani Barde">HimaniRamesh.Barde</who>
    <bug_when>2026-08-06 05:56:19 +0000</bug_when>
    <thetext>systemd ptest support was dropped in 2018 when the recipe switched to meson:
https://git.openembedded.org/openembedded-core/commit/?id=906230a73b3ccfa4afd2a19a6b0aa18cd1d5fa08

The commit message noted: &quot;This new version has dropped ptest support, as
there&apos;s no easy way to do this in the framework of meson.&quot;

Since then, meson has matured significantly. Additionally, upstream systemd
now includes tests relevant to user unit handling:

  systemd.git test/ directory:
  - test/units/TEST-26-SYSTEMCTL.sh (user unit tests with --global)
  - test/units/TEST-55-OOMD.sh (user unit coverage)
  - test/units/TEST-91-LIVEUPDATE.sh (user unit session management)

This enhancement is to investigate:
1. Whether meson now supports running systemd tests in a ptest-compatible way
2. Feasibility of re-enabling ptest for the systemd recipe
3. Including user unit test coverage

Related: Bug 7800 (systemd.bbclass user unit support - now fixed on master)
https://bugzilla.yoctoproject.org/show_bug.cgi?id=7800</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106454</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2026-08-06 14:48:35 +0000</bug_when>
    <thetext>Definitely several parts to this:

1) can we get meson to build but not run the test suites
2) how can we copy the test suite into the packages
3) how to run a meson test suite

It would be good to discuss this with the upstream meson maintainers. Last time I tried they were not interested in installable test suites.

Something that might be useful: meson has an &apos;introspect&apos; command that can dump machine-readable JSON for various bits of the build setup. If that can tell you what the tests are called then it might be possible to automate some of the building/installation/running.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106725</commentid>
    <comment_count>2</comment_count>
    <who name="Himani Barde">HimaniRamesh.Barde</who>
    <bug_when>2026-09-04 08:07:51 +0000</bug_when>
    <thetext>Investigation results: ptest revival is feasible (PoC working)

Tested against systemd 257.6 (meson). Answering the three points from comment 1:

1. Can meson build tests without running them? 
Yes. ninja builds the test binaries at compile time; meson test runs them separately. Meson also writes machine-readable test metadata to &lt;builddir&gt;/meson-info/intro-tests.json (the meson introspect --tests data you suggested) — it enumerates all 1651 tests with name/suite/cmd. So the build-vs-run split that was hard in 2018 is now clean.

2. How to copy the test suite into packages? 
This is now solved upstream. systemd&apos;s meson has an install-tests option (meson_options.txt, default false). Enabling it installs the unit-test binaries into ${prefix}/lib/systemd/tests/unit-tests/ plus a run-unit-tests.py runner into ${prefix}/lib/systemd/tests/. 
No manual copying of binaries needed — this is the key thing that changed since the 2018 removal. (So the &quot;installable test suites&quot; concern with upstream meson is moot for systemd specifically; it already ships install_data(...) behind if install_tests.)

3. How to run the suite? 
systemd&apos;s installed run-unit-tests.py already globs and runs unit-tests/test-*, printing PASS:/SKIP: per test (rc 77 = skip). That maps almost directly to ptest&apos;s expected PASS:/FAIL:/SKIP: output, so a thin run-ptest wrapper is enough.

PoC: a small systemd_%.bbappend — inherit ptest, EXTRA_OEMESON:append = &quot; -Dinstall-tests=true&quot;, a do_install_ptest that copies ${prefix}/lib/systemd/tests/* into ${PTEST_PATH}, and a run-ptest wrapping run-unit-tests.py. 
Building systemd -c install produced 313 installed test-* unit-test binaries plus the runner. This covers the systemd:test/libsystemd C unit suites (~230 tests) and the systemd:dist help/version checks (111).

On the user-unit tests (TEST-26-SYSTEMCTL, TEST-55-OOMD, TEST-91-LIVEUPDATE): these are integration tests under test/units/ that expect a booted system via systemd&apos;s integration/mkosi harness, not standalone unit-test binaries. They&apos;re a separate, harder effort from the meson unit-test suite and probably shouldn&apos;t block a first ptest landing. Suggest tracking integration-test-in-ptest separately. (Note: TEST-91-LIVEUPDATE isn&apos;t present in 257.6; it&apos;s newer.)

Recommendation: re-enable ptest for systemd targeting the meson unit-test suites via install-tests. 
Happy to send a patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106726</commentid>
    <comment_count>3</comment_count>
    <who name="Himani Barde">HimaniRamesh.Barde</who>
    <bug_when>2026-09-04 08:09:30 +0000</bug_when>
    <thetext>Patch submitted to openembedded-core: &quot;systemd: re-enable ptest support&quot; (2026-09-04).

It implements the approach described above — enables the meson install-tests option, packages the installed unit-test tree into systemd-ptest, and adds a run-ptest wrapper driving run-unit-tests.py. Verified to parse against oe-core master (systemd 261.2); PoC build done on 257.6 (313 test binaries + runner install cleanly).

As noted, the test/units/*.sh integration tests (TEST-26/55/91) are out of scope for this change and would be a separate integration-test-in-ptest effort.

Message-ID: 20260904080215.2501426-1-HimaniRamesh.Barde@windriver.com</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>