DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (f2644bf19c9f)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#!/usr/bin/env python
# coding=UTF-8

from __future__ import absolute_import

import os

import mozunit

from conftest import fspath


def test_stackwalk_not_found(check_for_crashes, minidump_files, tmpdir, capsys):
    """Test that check_for_crashes can handle unicode in dump_directory."""
    stackwalk = tmpdir.join('stackwalk')

    assert 1 == check_for_crashes(stackwalk_binary=fspath(stackwalk),
                                  quiet=False)

    out, _ = capsys.readouterr()
    assert "MINIDUMP_STACKWALK binary not found" in out


def test_stackwalk_envvar(check_for_crashes, minidump_files, stackwalk):
    """Test that check_for_crashes uses the MINIDUMP_STACKWALK environment var."""
    os.environ['MINIDUMP_STACKWALK'] = fspath(stackwalk)
    try:
        assert 1 == check_for_crashes(stackwalk_binary=None)
    finally:
        del os.environ['MINIDUMP_STACKWALK']


def test_stackwalk_unicode(check_for_crashes, minidump_files, tmpdir, capsys):
    """Test that check_for_crashes can handle unicode in dump_directory."""
    stackwalk = tmpdir.mkdir(u"🍪").join('stackwalk')
    stackwalk.write('fake binary')
    stackwalk.chmod(0o744)

    assert 1 == check_for_crashes(stackwalk_binary=fspath(stackwalk),
                                  quiet=False)

    out, err = capsys.readouterr()
    assert fspath(stackwalk) in out


if __name__ == '__main__':
    mozunit.main()