3
3
"""Tests for the extraction tool object."""
4
4
5
5
import argparse
6
+ import sys
6
7
import unittest
7
8
8
9
try :
@@ -20,7 +21,24 @@ class ExtractionToolTest(test_lib.CLIToolTestCase):
20
21
21
22
# pylint: disable=protected-access
22
23
23
- _EXPECTED_PERFORMANCE_OPTIONS = """\
24
+ _PYTHON3_13_OR_LATER = sys .version_info [0 :2 ] >= (3 , 13 )
25
+
26
+ if _PYTHON3_13_OR_LATER :
27
+ _EXPECTED_PERFORMANCE_OPTIONS = """\
28
+ usage: extraction_tool_test.py [--buffer_size BUFFER_SIZE]
29
+ [--queue_size QUEUE_SIZE]
30
+
31
+ Test argument parser.
32
+
33
+ {0:s}:
34
+ --buffer_size, --buffer-size, --bs BUFFER_SIZE
35
+ The buffer size for the output (defaults to 196MiB).
36
+ --queue_size, --queue-size QUEUE_SIZE
37
+ The maximum number of queued items per worker
38
+ (defaults to 125000)
39
+ """ .format (test_lib .ARGPARSE_OPTIONS )
40
+ else :
41
+ _EXPECTED_PERFORMANCE_OPTIONS = """\
24
42
usage: extraction_tool_test.py [--buffer_size BUFFER_SIZE]
25
43
[--queue_size QUEUE_SIZE]
26
44
@@ -35,7 +53,43 @@ class ExtractionToolTest(test_lib.CLIToolTestCase):
35
53
""" .format (test_lib .ARGPARSE_OPTIONS )
36
54
37
55
if resource is None :
38
- _EXPECTED_PROCESSING_OPTIONS = """\
56
+ if _PYTHON3_13_OR_LATER :
57
+ _EXPECTED_PROCESSING_OPTIONS = """\
58
+ usage: extraction_tool_test.py [--single_process]
59
+ [--temporary_directory DIRECTORY]
60
+ [--vfs_back_end TYPE]
61
+ [--worker_memory_limit SIZE]
62
+ [--worker_timeout MINUTES] [--workers WORKERS]
63
+
64
+ Test argument parser.
65
+
66
+ {0:s}:
67
+ --single_process, --single-process
68
+ Indicate that the tool should run in a single process.
69
+ --temporary_directory, --temporary-directory DIRECTORY
70
+ Path to the directory that should be used to store
71
+ temporary files created during processing.
72
+ --vfs_back_end, --vfs-back-end TYPE
73
+ The preferred dfVFS back-end: "auto", "fsext",
74
+ "fsfat", "fshfs", "fsntfs", "tsk" or "vsgpt".
75
+ --worker_memory_limit, --worker-memory-limit SIZE
76
+ Maximum amount of memory (data segment and shared
77
+ memory) a worker process is allowed to consume in
78
+ bytes, where 0 represents no limit. The default limit
79
+ is 2147483648 (2 GiB). If a worker process exceeds
80
+ this limit it is killed by the main (foreman) process.
81
+ --worker_timeout, --worker-timeout MINUTES
82
+ Number of minutes before a worker process that is not
83
+ providing status updates is considered inactive. The
84
+ default timeout is 15.0 minutes. If a worker process
85
+ exceeds this timeout it is killed by the main
86
+ (foreman) process.
87
+ --workers WORKERS Number of worker processes. The default is the number
88
+ of available system CPUs minus one, for the main
89
+ (foreman) process.
90
+ """ .format (test_lib .ARGPARSE_OPTIONS )
91
+ else :
92
+ _EXPECTED_PROCESSING_OPTIONS = """\
39
93
usage: extraction_tool_test.py [--single_process]
40
94
[--temporary_directory DIRECTORY]
41
95
[--vfs_back_end TYPE]
@@ -71,7 +125,53 @@ class ExtractionToolTest(test_lib.CLIToolTestCase):
71
125
""" .format (test_lib .ARGPARSE_OPTIONS )
72
126
73
127
else :
74
- _EXPECTED_PROCESSING_OPTIONS = """\
128
+ if _PYTHON3_13_OR_LATER :
129
+ _EXPECTED_PROCESSING_OPTIONS = """\
130
+ usage: extraction_tool_test.py [--single_process]
131
+ [--process_memory_limit SIZE]
132
+ [--temporary_directory DIRECTORY]
133
+ [--vfs_back_end TYPE]
134
+ [--worker_memory_limit SIZE]
135
+ [--worker_timeout MINUTES] [--workers WORKERS]
136
+
137
+ Test argument parser.
138
+
139
+ {0:s}:
140
+ --process_memory_limit, --process-memory-limit SIZE
141
+ Maximum amount of memory (data segment) a process is
142
+ allowed to allocate in bytes, where 0 represents no
143
+ limit. The default limit is 4294967296 (4 GiB). This
144
+ applies to both the main (foreman) process and the
145
+ worker processes. This limit is enforced by the
146
+ operating system and will supersede the worker memory
147
+ limit (--worker_memory_limit).
148
+ --single_process, --single-process
149
+ Indicate that the tool should run in a single process.
150
+ --temporary_directory, --temporary-directory DIRECTORY
151
+ Path to the directory that should be used to store
152
+ temporary files created during processing.
153
+ --vfs_back_end, --vfs-back-end TYPE
154
+ The preferred dfVFS back-end: "auto", "fsext",
155
+ "fsfat", "fshfs", "fsntfs", "tsk" or "vsgpt".
156
+ --worker_memory_limit, --worker-memory-limit SIZE
157
+ Maximum amount of memory (data segment and shared
158
+ memory) a worker process is allowed to consume in
159
+ bytes, where 0 represents no limit. The default limit
160
+ is 2147483648 (2 GiB). If a worker process exceeds
161
+ this limit it is killed by the main (foreman) process.
162
+ --worker_timeout, --worker-timeout MINUTES
163
+ Number of minutes before a worker process that is not
164
+ providing status updates is considered inactive. The
165
+ default timeout is 15.0 minutes. If a worker process
166
+ exceeds this timeout it is killed by the main
167
+ (foreman) process.
168
+ --workers WORKERS Number of worker processes. The default is the number
169
+ of available system CPUs minus one, for the main
170
+ (foreman) process.
171
+ """ .format (test_lib .ARGPARSE_OPTIONS )
172
+
173
+ else :
174
+ _EXPECTED_PROCESSING_OPTIONS = """\
75
175
usage: extraction_tool_test.py [--single_process]
76
176
[--process_memory_limit SIZE]
77
177
[--temporary_directory DIRECTORY]
@@ -115,7 +215,40 @@ class ExtractionToolTest(test_lib.CLIToolTestCase):
115
215
(foreman) process.
116
216
""" .format (test_lib .ARGPARSE_OPTIONS )
117
217
118
- _EXPECTED_TIME_ZONE_OPTION = """\
218
+
219
+ if _PYTHON3_13_OR_LATER :
220
+ _EXPECTED_TIME_ZONE_OPTION = """\
221
+ usage: extraction_tool_test.py [--codepage CODEPAGE] [--language LANGUAGE_TAG]
222
+ [--no_extract_winevt_resources] [-z TIME_ZONE]
223
+
224
+ Test argument parser.
225
+
226
+ {0:s}:
227
+ --codepage CODEPAGE The preferred codepage, which is used for decoding
228
+ single-byte or multi-byte character extracted strings.
229
+ --language LANGUAGE_TAG
230
+ The preferred language, which is used for extracting
231
+ and formatting Windows EventLog message strings. Use "
232
+ --language list" to see a list of supported language
233
+ tags. The en-US (LCID 0x0409) language is used as
234
+ fallback if preprocessing could not determine the
235
+ system language or no language information is
236
+ available in the winevt-rc.db database.
237
+ --no_extract_winevt_resources, --no-extract-winevt-resources
238
+ Do not extract Windows EventLog resources such as
239
+ event message template strings. By default Windows
240
+ EventLog resources will be extracted when a Windows
241
+ EventLog parser is enabled.
242
+ -z, --zone, --timezone TIME_ZONE
243
+ preferred time zone of extracted date and time values
244
+ that are stored without a time zone indicator. The
245
+ time zone is determined based on the source data where
246
+ possible otherwise it will default to UTC. Use "list"
247
+ to see a list of available time zones.
248
+ """ .format (test_lib .ARGPARSE_OPTIONS )
249
+
250
+ else :
251
+ _EXPECTED_TIME_ZONE_OPTION = """\
119
252
usage: extraction_tool_test.py [--codepage CODEPAGE] [--language LANGUAGE_TAG]
120
253
[--no_extract_winevt_resources] [-z TIME_ZONE]
121
254
0 commit comments