|
Server : LiteSpeed System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64 User : nandedex ( 1060) PHP Version : 8.1.33 Disable Function : NONE Directory : /opt/cppython/lib/python3.8/test/__pycache__/ |
U
>��g� � @ s� d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlm Z m
Z
dd� Zdd� ZG dd� d�Z
G d d
� d
e
�ZG dd� de
�ZG d
d� dej�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�Zdd� Zedkr�e� dS )� N)�findfile�run_unittestc C s t j�t| dd��S )NZ
dtracedata)Zsubdir)�os�path�abspathr )�filename� r �//opt/cppython/lib/python3.8/test/test_dtrace.pyr s r c C sv t �dd| �} z<dd� | �� D �}|jdd� d� dd� |D �}d �|�W S ttfk
rp td
�| ���Y nX dS )aM Normalize DTrace output for comparison.
DTrace keeps a per-CPU buffer, and when showing the fired probes, buffers
are concatenated. So if the operating system moves our thread around, the
straight result can be "non-causal". So we add timestamps to the probe
firing, sort by that field, then strip it from the outputz\[[0-9]+ refs\]� c S s$ g | ]}|r|� d �s|�d��qS )�#� )�
startswith�split��.0�rowr r r �
<listcomp> s
�z*normalize_trace_output.<locals>.<listcomp>c S s t | d �S )Nr )�int)r r r r �<lambda> � z(normalize_trace_output.<locals>.<lambda>)�keyc S s g | ]}|d �qS )� r r r r r r ! s �
z&tracer produced unparseable output:
{}N) �re�sub�
splitlines�sort�join�
IndexError�
ValueError�AssertionError�format)�output�resultr r r �normalize_trace_output s ��r$ c @ sH e Zd ZdZdZg Zddd�Zd
dd�Zddd�Zddd �Z d
d� Z
dS )�TraceBackendNc C s\ t | jt|| j �t|d �|d��}tt|| j d ���}|�� �� }W 5 Q R X ||fS )Nz.py)�script_file�python_file�optimize_pythonz .expected)r$ �trace_pythonr � EXTENSION�open�read�rstrip)�self�namer( �
actual_output�f�expected_outputr r r �run_case. s
�zTraceBackend.run_casec C s | j |g }|r|d|g7 }|S )Nz-c)�COMMAND)r. r&