Skip to content

test_fileio fails if strace version is too old #133741

Closed

Description

@pablogsal

Bug report

Bug description:

Many failures in the test if the strace version doesn't support some of the options:

25-05-08T15:38:14.817Z] ======================================================================
[2025-05-08T15:38:14.817Z] FAIL: test_syscalls_read (test.test_fileio.CAutoFileTests.test_syscalls_read) (name='open builtin with default options')
[2025-05-08T15:38:14.817Z] Check set of system calls during common I/O patterns
[2025-05-08T15:38:14.817Z] ----------------------------------------------------------------------
[2025-05-08T15:38:14.817Z] Traceback (most recent call last):
[2025-05-08T15:38:14.817Z]   File "/bb/jenkins_work/python/workspace/python_python3.14-debian_PR-1/distro/refroot/amd64/opt/bb/lib64/python3.14/test/test_fileio.py", line 381, in check_readall
[2025-05-08T15:38:14.817Z]     syscalls = strace_helper.get_events(code, _strace_flags,
[2025-05-08T15:38:14.817Z]                                           prelude=prelude,
[2025-05-08T15:38:14.817Z]                                           cleanup=cleanup)
[2025-05-08T15:38:14.817Z]   File "/bb/jenkins_work/python/workspace/python_python3.14-debian_PR-1/distro/refroot/amd64/opt/bb/lib64/python3.14/test/support/strace_helper.py", line 162, in get_events
[2025-05-08T15:38:14.817Z]     trace = strace_python(to_run, strace_flags)
[2025-05-08T15:38:14.817Z]   File "/bb/jenkins_work/python/workspace/python_python3.14-debian_PR-1/distro/refroot/amd64/opt/bb/lib64/python3.14/test/support/strace_helper.py", line 122, in strace_python
[2025-05-08T15:38:14.817Z]     res.fail(cmd_line)
[2025-05-08T15:38:14.817Z]     ~~~~~~~~^^^^^^^^^^
[2025-05-08T15:38:14.817Z]   File "/bb/jenkins_work/python/workspace/python_python3.14-debian_PR-1/distro/refroot/amd64/opt/bb/lib64/python3.14/test/support/script_helper.py", line 80, in fail
[2025-05-08T15:38:14.817Z]     raise AssertionError(f"Process return code is {exitcode}\n"
[2025-05-08T15:38:14.817Z]     ...<10 lines>...
[2025-05-08T15:38:14.817Z]                          f"---")
[2025-05-08T15:38:14.817Z] AssertionError: Process return code is 1
[2025-05-08T15:38:14.817Z] command line: ['/usr/bin/strace', '--trace=%file,%desc', '/bb/jenkins_work/python/workspace/python_python3.14-debian_PR-1/distro/refroot/amd64/opt/bb/bin/python3.14', '-X', 'faulthandler', '-I', '-c', '\nprint("MARK prelude", flush=True)\n\nprint("MARK code", flush=True)\n\nf = open(\'@test_123835_tmpæ\')\nf.read()\nf.close()\n\nprint("MARK cleanup", flush=True)\n\nprint("MARK __shutdown", flush=True)\n']
[2025-05-08T15:38:14.817Z] 
[2025-05-08T15:38:14.817Z] stdout:
[2025-05-08T15:38:14.817Z] ---
[2025-05-08T15:38:14.817Z] 
[2025-05-08T15:38:14.817Z] ---
[2025-05-08T15:38:14.817Z] 
[2025-05-08T15:38:14.817Z] stderr:
[2025-05-08T15:38:14.817Z] ---
[2025-05-08T15:38:14.817Z] /usr/bin/strace: invalid option -- '-'
[2025-05-08T15:38:14.817Z] Try '/usr/bin/strace -h' for more information.
[2025-05-08T15:38:14.817Z] ---

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

Activity

  1. pablogsal commented on May 9, 2025

    @pablogsal
    MemberAuthor
  2. pablogsal commented on May 9, 2025

    @pablogsal
    MemberAuthor
  3. vstinner commented on May 9, 2025

    @vstinner
    Member

    What is your strace version?

    Which option is rejected? Is it the --trace=%file,%desc option?

  4. pablogsal commented on May 9, 2025

    @pablogsal
    MemberAuthor
    (refroot)$ strace -V
    strace -- version 4.12
    (refroot)$ strace --trace=%file,%desc
    strace: invalid option -- '-'
    Try 'strace -h' for more information.
    (refroot)$ strace -h
    usage: strace [-CdffhiqrtttTvVwxxy] [-I n] [-e expr]...
                  [-a column] [-o file] [-s strsize] [-P path]...
                  -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]
       or: strace -c[dfw] [-I n] [-e expr]... [-O overhead] [-S sortby]
                  -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]
    
    Output format:
      -a column      alignment COLUMN for printing syscall results (default 40)
      -i             print instruction pointer at time of syscall
      -o file        send trace output to FILE instead of stderr
      -q             suppress messages about attaching, detaching, etc.
      -r             print relative timestamp
      -s strsize     limit length of print strings to STRSIZE chars (default 32)
      -t             print absolute timestamp
      -tt            print absolute timestamp with usecs
      -T             print time spent in each syscall
      -x             print non-ascii strings in hex
      -xx            print all strings in hex
      -y             print paths associated with file descriptor arguments
      -yy            print protocol specific information associated with socket file descriptors
    
    Statistics:
      -c             count time, calls, and errors for each syscall and report summary
      -C             like -c but also print regular output
      -O overhead    set overhead for tracing syscalls to OVERHEAD usecs
      -S sortby      sort syscall counts by: time, calls, name, nothing (default time)
      -w             summarise syscall latency (default is system time)
    
    Filtering:
      -e expr        a qualifying expression: option=[!]all or option=[!]val1[,val2]...
         options:    trace, abbrev, verbose, raw, signal, read, write
      -P path        trace accesses to path
    
    Tracing:
      -b execve      detach on execve syscall
      -D             run tracer process as a detached grandchild, not as parent
      -f             follow forks
      -ff            follow forks with output into separate files
      -I interruptible
         1:          no signals are blocked
         2:          fatal signals are blocked while decoding syscall (default)
         3:          fatal signals are always blocked (default if '-o FILE PROG')
         4:          fatal signals and SIGTSTP (^Z) are always blocked
                     (useful to make 'strace -o FILE PROG' not stop on ^Z)
    
    Startup:
      -E var         remove var from the environment for command
      -E var=val     put var=val in the environment for command
      -p pid         trace process with process id PID, may be repeated
      -u username    run command as username handling setuid and/or setgid
    
    Miscellaneous:
      -d             enable debug output to stderr
      -v             verbose mode: print unabbreviated argv, stat, termios, etc. args
      -h             print help message
      -V             print version
    
  5. added a commit that references this issue on May 9, 2025
  6. vstinner commented on May 9, 2025

    @vstinner
    Member

    (refroot)$ strace -V
    strace -- version 4.12

    The --trace option was added to strace 5.5.

    Can you try my fix #133763 ?

  7. pablogsal commented on May 9, 2025

    @pablogsal
    MemberAuthor

    (refroot)$ strace -V
    strace -- version 4.12

    The --trace option was added to strace 5.5.

    Can you try my fix #133763 ?

    (refroot)$ python3.14 -m test test_fileio -v
    == CPython 3.14.0b1 (main, May 8 2025, 10:45:27) [Clang 20.1.0 ]
    == Linux-3.10.0-957.35.2.el7.x86_64-x86_64-with-glibc2.17 little-endian
    == Python build: release shared
    == cwd: /bb/data/tmp/test_python_worker_50669æ
    == CPU count: 15 (process) / 16 (system)
    == encodings: locale=UTF-8 FS=utf-8
    == resources: all test resources are disabled, use -u option to unskip tests
    
    Using random seed: 4196976212
    0:00:00 load avg: 4.96 Run 1 test sequentially in a single process
    0:00:00 load avg: 4.96 [1/1] test_fileio
    test_fileio skipped -- need strace 5.5 or newer, found strace 4.12
    0:00:00 load avg: 4.96 [1/1] test_fileio skipped
    
    == Tests result: SUCCESS ==
    
    1 test skipped:
        test_fileio
    
    Total duration: 66 ms
    Total tests: run=0
    Total test files: run=1/1 skipped=1
    Result: SUCCESS
    

    This skips the entre test, is that expected?

  8. added a commit that references this issue on May 9, 2025
  9. vstinner commented on May 9, 2025

    @vstinner
    Member

    This skips the entre test, is that expected?

    Hum, no, my change doesn't work as expected.

    Can you please try the simpler fix: #133766 ?

  10. added a commit that references this issue on May 9, 2025
  11. added a commit that references this issue on May 9, 2025
  12. vstinner commented on May 9, 2025

    @vstinner
    Member

    Thanks for the report. A fix was merged into the main branch, the backport to 3.14 will follow.

  13. added a commit that references this issue on May 9, 2025
  14. hauntsaninja commented on May 9, 2025

    @hauntsaninja
    Contributor

    Thanks for fixing!

  15. added a commit that references this issue on Jul 12, 2025
  16. added a commit that references this issue on Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtopic-IOtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions