summaryrefslogtreecommitdiffstats
path: root/testing/mozbase/mozcrash/tests/test_stackwalk.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /testing/mozbase/mozcrash/tests/test_stackwalk.py
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/mozbase/mozcrash/tests/test_stackwalk.py')
-rw-r--r--testing/mozbase/mozcrash/tests/test_stackwalk.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/mozbase/mozcrash/tests/test_stackwalk.py b/testing/mozbase/mozcrash/tests/test_stackwalk.py
new file mode 100644
index 0000000000..924de68173
--- /dev/null
+++ b/testing/mozbase/mozcrash/tests/test_stackwalk.py
@@ -0,0 +1,45 @@
+#!/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()