~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_strace.py

  • Committer: Vincent Ladeuil
  • Date: 2007-07-02 11:07:10 UTC
  • mto: (2584.1.1 Aaron's integration)
  • mto: This revision was merged to the branch mainline in revision 2585.
  • Revision ID: v.ladeuil+lp@free.fr-20070702110710-jjzry7iv7hbqinrm
Fix #102019 by not asking strace to follow children forks during tests.

* bzrlib/tests/test_strace.py:
(TestStrace.test_strace_callable_is_called,
TestStrace.test_strace_callable_result,
TestStrace.test_strace_result_has_raw_log): Don't follow childrens
when calling strace to avoid random hanging.

* bzrlib/strace.py:
(strace): Provides a way do disable the strace '-f' option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        output = []
52
52
        def function(positional, *args, **kwargs):
53
53
            output.append((positional, args, kwargs))
54
 
        strace(function, "a", "b", c="c")
 
54
        strace(function, "a", "b", c="c",
 
55
               strace_follow_childrens=False)
55
56
        self.assertEqual([("a", ("b",), {"c":"c"})], output)
56
57
 
57
58
    def test_strace_callable_result(self):
58
59
        def function():
59
60
            return "foo"
60
 
        result, strace_result = strace(function)
 
61
        result, strace_result = strace(function,
 
62
                                       strace_follow_childrens=False)
61
63
        self.assertEqual("foo", result)
62
64
        self.assertIsInstance(strace_result, StraceResult)
63
65
 
65
67
        """Checks that a reasonable raw strace log was found by strace."""
66
68
        def function():
67
69
            self.build_tree(['myfile'])
68
 
        _, result = strace(function)
 
70
        _, result = strace(function,
 
71
                           strace_follow_childrens=False)
69
72
        self.assertContainsRe(result.raw_log, 'myfile')