uber-archive / pyflame

🔥 Pyflame: A Ptracing Profiler For Python. This project is deprecated and not maintained.
Apache License 2.0
2.98k stars 240 forks source link

Add python 3.7 support #168

Closed toabctl closed 5 years ago

CLAassistant commented 5 years ago

CLA assistant check
All committers have signed the CLA.

toabctl commented 5 years ago

Running the tests locally (on openSUSE Tumbleweed with python 3.7.2 I get:

Running test suite against interpreter Python 3.7.2
============================= test session starts ==============================
platform linux -- Python 3.7.2, pytest-4.3.0, py-1.7.0, pluggy-0.8.1 -- /home/tom/devel/pyflame/.test_env/bin/python3.7
cachedir: .pytest_cache
rootdir: /home/tom/devel/pyflame, inifile:
collecting ... collected 37 items

tests/test_end_to_end.py::test_travis_build_environment SKIPPED          [  2%]
tests/test_end_to_end.py::test_rpm_build_environment PASSED              [  5%]
tests/test_end_to_end.py::test_monitor FAILED                            [  8%]
tests/test_end_to_end.py::test_non_gil FAILED                            [ 10%]
tests/test_end_to_end.py::test_threaded FAILED                           [ 13%]
tests/test_end_to_end.py::test_unthreaded FAILED                         [ 16%]
tests/test_end_to_end.py::test_legacy_pid_handling FAILED                [ 18%]
tests/test_end_to_end.py::test_legacy_pid_handling_too_many_pids PASSED  [ 21%]
tests/test_end_to_end.py::test_dash_t_and_dash_p PASSED                  [ 24%]
tests/test_end_to_end.py::test_unsupported_abi PASSED                    [ 27%]
tests/test_end_to_end.py::test_exclude_idle FAILED                       [ 29%]
tests/test_end_to_end.py::test_utf8_output FAILED                        [ 32%]
tests/test_end_to_end.py::test_exit_early FAILED                         [ 35%]
tests/test_end_to_end.py::test_sample_not_python PASSED                  [ 37%]
tests/test_end_to_end.py::test_trace[False-False] FAILED                 [ 40%]
tests/test_end_to_end.py::test_trace[False-True] FAILED                  [ 43%]
tests/test_end_to_end.py::test_trace[True-False] FAILED                  [ 45%]
tests/test_end_to_end.py::test_trace[True-True] FAILED                   [ 48%]
tests/test_end_to_end.py::test_trace_not_python PASSED                   [ 51%]
tests/test_end_to_end.py::test_pyflame_a_pyflame PASSED                  [ 54%]
tests/test_end_to_end.py::test_pyflame_nonexistent_file PASSED           [ 56%]
tests/test_end_to_end.py::test_trace_no_arg PASSED                       [ 59%]
tests/test_end_to_end.py::test_sample_no_arg PASSED                      [ 62%]
tests/test_end_to_end.py::test_sample_extra_args PASSED                  [ 64%]
tests/test_end_to_end.py::test_permission_error PASSED                   [ 67%]
tests/test_end_to_end.py::test_invalid_pid[-1] PASSED                    [ 70%]
tests/test_end_to_end.py::test_invalid_pid[0] PASSED                     [ 72%]
tests/test_end_to_end.py::test_invalid_pid[1606938044258990275541962092341162602522202993782792835301376] PASSED [ 75%]
tests/test_end_to_end.py::test_invalid_pid[not a pid] PASSED             [ 78%]
tests/test_end_to_end.py::test_include_ts FAILED                         [ 81%]
tests/test_end_to_end.py::test_include_ts_exclude_idle FAILED            [ 83%]
tests/test_end_to_end.py::test_version[-v] PASSED                        [ 86%]
tests/test_end_to_end.py::test_version[--version] PASSED                 [ 89%]
tests/test_end_to_end.py::test_trace_forker FAILED                       [ 91%]
tests/test_end_to_end.py::test_sigchld FAILED                            [ 94%]
tests/test_end_to_end.py::test_thread_dump FAILED                        [ 97%]
tests/test_end_to_end.py::test_no_line_numbers FAILED                    [100%]

=================================== FAILURES ===================================
_________________________________ test_monitor _________________________________

dijkstra = <subprocess.Popen object at 0x7f464e49a0f0>

    def test_monitor(dijkstra):
        """Basic test for the monitor mode."""
        proc = subprocess.Popen(
            [path_to_pyflame(), '-p', str(dijkstra.pid)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:208: AssertionError
_________________________________ test_non_gil _________________________________

sleeper = <subprocess.Popen object at 0x7f464e6b5400>

    def test_non_gil(sleeper):
        """Basic test for non-GIL/native code processes."""
        proc = subprocess.Popen(
            [path_to_pyflame(), '-p', str(sleeper.pid)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:223: AssertionError
________________________________ test_threaded _________________________________

threaded_sleeper = <subprocess.Popen object at 0x7f464e849978>

    @pytest.mark.skipif(MISSING_THREADS, reason='build does not have threads')
    def test_threaded(threaded_sleeper):
        """Basic test for non-GIL/native code processes."""
        proc = subprocess.Popen(
            [path_to_pyflame(), '--threads', '-p',
             str(threaded_sleeper.pid)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:240: AssertionError
_______________________________ test_unthreaded ________________________________

threaded_busy = <subprocess.Popen object at 0x7f464e47f240>

    def test_unthreaded(threaded_busy):
        """Test only one process is profiled by default."""
        proc = subprocess.Popen(
            [path_to_pyflame(), '-s', '0', '-p',
             str(threaded_busy.pid)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:273: AssertionError
___________________________ test_legacy_pid_handling ___________________________

threaded_busy = <subprocess.Popen object at 0x7f464e513be0>

    def test_legacy_pid_handling(threaded_busy):
        # test PID parsing when -p is not used
        proc = subprocess.Popen(
            [path_to_pyflame(), '-s', '0',
             str(threaded_busy.pid)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True)
        out, err = communicate(proc)
        assert err.startswith('WARNING: ')
>       assert proc.returncode == 0
E       assert 1 == 0
E         -1
E         +0

tests/test_end_to_end.py:289: AssertionError
______________________________ test_exclude_idle _______________________________

sleeper = <subprocess.Popen object at 0x7f464e556128>

    def test_exclude_idle(sleeper):
        """Basic test for idle processes."""
        proc = subprocess.Popen(
            [path_to_pyflame(), '-x', '-p',
             str(sleeper.pid)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:337: AssertionError
_______________________________ test_utf8_output _______________________________

unicode_sleeper = <subprocess.Popen object at 0x7f464e5b4ac8>

    @pytest.mark.skipif(
        sys.getfilesystemencoding().lower() != 'utf-8',
        reason='requires UTF-8 filesystem, see '
        'https://bugs.python.org/issue8242')
    @pytest.mark.skipif(sys.version_info < (3, 3), reason="requires Python 3.3+")
    def test_utf8_output(unicode_sleeper):
        proc = subprocess.Popen(
            [path_to_pyflame(), '-x', '-p',
             str(unicode_sleeper.pid)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:357: AssertionError
_______________________________ test_exit_early ________________________________

exit_early = <subprocess.Popen object at 0x7f464e5f7588>

    def test_exit_early(exit_early):
        proc = subprocess.Popen(
            [path_to_pyflame(), '-s', '10', '-p',
             str(exit_early.pid)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:379: AssertionError
___________________________ test_trace[False-False] ____________________________

force_abi = False, trace_threads = False

    @pytest.mark.parametrize('force_abi', [False, True])
    @pytest.mark.parametrize('trace_threads', [False]
                             if MISSING_THREADS else [False, True])
    def test_trace(force_abi, trace_threads):
        args = [path_to_pyflame()]
        if force_abi:
            abi_string = '%d%d' % sys.version_info[:2]
            args.extend(['--abi', abi_string])
        if trace_threads:
            args.append('--threads')
        args.extend(['-t', sys.executable, 'tests/exit_early.py', '-s'])

        proc = subprocess.Popen(
            args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:413: AssertionError
____________________________ test_trace[False-True] ____________________________

force_abi = True, trace_threads = False

    @pytest.mark.parametrize('force_abi', [False, True])
    @pytest.mark.parametrize('trace_threads', [False]
                             if MISSING_THREADS else [False, True])
    def test_trace(force_abi, trace_threads):
        args = [path_to_pyflame()]
        if force_abi:
            abi_string = '%d%d' % sys.version_info[:2]
            args.extend(['--abi', abi_string])
        if trace_threads:
            args.append('--threads')
        args.extend(['-t', sys.executable, 'tests/exit_early.py', '-s'])

        proc = subprocess.Popen(
            args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Unknown or unsupported ABI version: 37\n'

tests/test_end_to_end.py:413: AssertionError
____________________________ test_trace[True-False] ____________________________

force_abi = False, trace_threads = True

    @pytest.mark.parametrize('force_abi', [False, True])
    @pytest.mark.parametrize('trace_threads', [False]
                             if MISSING_THREADS else [False, True])
    def test_trace(force_abi, trace_threads):
        args = [path_to_pyflame()]
        if force_abi:
            abi_string = '%d%d' % sys.version_info[:2]
            args.extend(['--abi', abi_string])
        if trace_threads:
            args.append('--threads')
        args.extend(['-t', sys.executable, 'tests/exit_early.py', '-s'])

        proc = subprocess.Popen(
            args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:413: AssertionError
____________________________ test_trace[True-True] _____________________________

force_abi = True, trace_threads = True

    @pytest.mark.parametrize('force_abi', [False, True])
    @pytest.mark.parametrize('trace_threads', [False]
                             if MISSING_THREADS else [False, True])
    def test_trace(force_abi, trace_threads):
        args = [path_to_pyflame()]
        if force_abi:
            abi_string = '%d%d' % sys.version_info[:2]
            args.extend(['--abi', abi_string])
        if trace_threads:
            args.append('--threads')
        args.extend(['-t', sys.executable, 'tests/exit_early.py', '-s'])

        proc = subprocess.Popen(
            args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Unknown or unsupported ABI version: 37\n'

tests/test_end_to_end.py:413: AssertionError
_______________________________ test_include_ts ________________________________

sleeper = <subprocess.Popen object at 0x7f464e6662e8>

    def test_include_ts(sleeper):
        """Basic test for timestamp processes."""
        proc = subprocess.Popen(
            [path_to_pyflame(), '--flamechart', '-p',
             str(sleeper.pid)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True)
        out, err = proc.communicate()
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:520: AssertionError
_________________________ test_include_ts_exclude_idle _________________________

sleeper = <subprocess.Popen object at 0x7f464e6bee48>

    def test_include_ts_exclude_idle(sleeper):
        """Basic test for timestamp processes."""
        proc = subprocess.Popen(
            [path_to_pyflame(), '--flamechart', '-x', '-p',
             str(sleeper.pid)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True)
        out, err = proc.communicate()
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:538: AssertionError
______________________________ test_trace_forker _______________________________

    def test_trace_forker():
        t0 = time.time()
        proc = subprocess.Popen(
            [path_to_pyflame(), '-t', sys.executable, 'tests/forker.py'],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True)
        out, err = communicate(proc)
        elapsed = time.time() - t0
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:574: AssertionError
_________________________________ test_sigchld _________________________________

    def test_sigchld():
        t0 = time.time()
        proc = subprocess.Popen(
            [
                path_to_pyflame(), '-t', sys.executable, './tests/sleeper.py',
                '-t', '2', '-f'
            ],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE)
        out, err = communicate(proc)
        elapsed = time.time() - t0
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:593: AssertionError
_______________________________ test_thread_dump _______________________________

threaded_dijkstra = <subprocess.Popen object at 0x7f464e513400>

    @pytest.mark.skipif(MISSING_THREADS, reason='build does not have threads')
    def test_thread_dump(threaded_dijkstra):
        time.sleep(0.5)
        proc = subprocess.Popen(
            [path_to_pyflame(), '-d', '-p',
             str(threaded_dijkstra.pid)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:610: AssertionError
_____________________________ test_no_line_numbers _____________________________

dijkstra = <subprocess.Popen object at 0x7f464e602588>

    def test_no_line_numbers(dijkstra):
        """Basic test for --no-line-numbers"""
        proc = subprocess.Popen(
            [path_to_pyflame(), '-p',
             str(dijkstra.pid), "--no-line-numbers"],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True)
        out, err = communicate(proc)
>       assert not err
E       AssertionError: assert not 'Failed to locate libpython within timeout period.\n'

tests/test_end_to_end.py:630: AssertionError
=============== 18 failed, 18 passed, 1 skipped in 9.26 seconds ================
randomstuff commented 5 years ago

This does not work for me and I don't think how it can work seeing the changes wrt the globals.

toabctl commented 5 years ago

There is already #153