File: base_process.py

package info (click to toggle)
plaso 20241006-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 673,228 kB
  • sloc: python: 91,831; sh: 557; xml: 97; makefile: 17; sql: 14; vhdl: 11
file content (63 lines) | stat: -rw-r--r-- 1,681 bytes parent folder | download | duplicates (2)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the multi-processing base process."""

import unittest

from plaso.engine import configurations
from plaso.multi_process import base_process

from tests import test_lib as shared_test_lib


class TestProcess(base_process.MultiProcessBaseProcess):
  """Implementation of the multi-processing base process for testing."""

  def _GetStatus(self):
    """Returns status information.

    Returns:
      dict[str, object]: status attributes, indexed by name.
    """
    # TODO: implement.
    return {}

  def _Main(self):
    """The process main loop.

    This method is called when the process is ready to start. A sub class should
    override this method to do the necessary actions in the main loop.
    """
    # TODO: implement.
    return

  def SignalAbort(self):
    """Signals the process to abort."""
    # TODO: implement.
    return


class MultiProcessBaseProcessTest(shared_test_lib.BaseTestCase):
  """Tests the multi-processing base process."""

  # pylint: disable=protected-access

  def testInitialization(self):
    """Tests the initialization."""
    configuration = configurations.ProcessingConfiguration()

    test_process = TestProcess(configuration, name='TestBase')
    self.assertIsNotNone(test_process)

  # TODO: add test for name property.
  # TODO: add test for _OnCriticalError.
  # TODO: add test for _SigSegvHandler.
  # TODO: add test for _SigTermHandler.
  # TODO: add test for _StartProcessStatusRPCServer.
  # TODO: add test for _StopProcessStatusRPCServer.
  # TODO: add test for _WaitForStatusNotRunning.
  # TODO: add test for run.


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