Skip to content

gh-98894: fix CheckDtraceProbes tests on Solaris - #154803

Open
kulikjak wants to merge 1 commit into
python:mainfrom
kulikjak:dtrace-probes-fix-list
Open

gh-98894: fix CheckDtraceProbes tests on Solaris#154803
kulikjak wants to merge 1 commit into
python:mainfrom
kulikjak:dtrace-probes-fix-list

Conversation

@kulikjak

@kulikjak kulikjak commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Solaris does not use the notes section to list available probes (readelf -n <binary> returns nothing), which makes the test_check_probes fail.

This PR adds a Solaris specific path which gets all the available probes by listing those available in the running test process instead.

The output below is very different so the comparison needs to be updated a little as well.

>>> import subprocess
>>> import os
>>> res = subprocess.run(["dtrace", "-l", "-P", f"python{os.getpid()}"])
   ID   PROVIDER            MODULE                          FUNCTION NAME
   34 python1427 libpython3.16.so.1.0                         sys_audit audit
   35 python1427 libpython3.16.so.1.0           sys_audit_tstate.part.0 audit
   36 python1427 libpython3.16.so.1.0             dtrace_function_entry function-entry
   37 python1427 libpython3.16.so.1.0          _PyEval_EvalFrameDefault function-entry
   38 python1427 libpython3.16.so.1.0            dtrace_function_return function-return
   39 python1427 libpython3.16.so.1.0          _PyEval_EvalFrameDefault function-return
   40 python1427 libpython3.16.so.1.0                   gc_collect_main gc-done
   41 python1427 libpython3.16.so.1.0                   gc_collect_main gc-start
   42 python1427 libpython3.16.so.1.0 import_find_and_load_with_name.isra.0 import-find-load-done
   43 python1427 libpython3.16.so.1.0 import_find_and_load_with_name.isra.0 import-find-load-start

A little unfortunate thing is that the test now requires elevated privileges, but that is true of all other DTrace tests as well, so I don't think that's a big deal.

BTW: there is Solaris specific ELF section for DTrace metadata and at first I wanted to fix the test by reading that one (with readelf -p .SUNW_dof <binary>). Unfortunately, the section includes more metadata than just available probes, and the now removed line probe is also present in the dumped strings (so test_check_probes passes, but test_missing_probes unexpectedly passes as well).

It's possible to use elfdump and do some binary parsing to extract only the available ones, but that is a huge overkill for a test like this. For those interested, the change is here: kulikjak@564e946

@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant