6 def line_count(file_path
):
8 with
open(file_path
) as f
:
14 def sha256_checksum(filename
, block_size
=65536):
15 sha256
= hashlib
.sha256()
16 with
open(filename
, 'rb') as f
:
17 for block
in iter(lambda: f
.read(block_size
), b
''):
19 return sha256
.hexdigest()
22 # TODO: timeout as a parameter or Settings
23 # TODO: Custom exception
24 def wait_for_file(path
):
27 while not os
.path
.exists(path
):
31 raise Exception("File still does not exists. Timeout expired")
34 # TODO: find better exception
35 def create_empty_file(path
):
36 if os
.path
.exists(path
):
37 raise Exception("Path already exist")
38 open(path
, 'w').close()
41 def __dummy_sigusr1_handler():
45 def sessiond_spawn(runtime
):
46 previous_handler
= signal
.signal(signal
.SIGUSR1
, __dummy_sigusr1_handler
)
47 sessiond
= runtime
.spawn_subprocess("lttng-sessiond -vvv -S")
48 signal
.sigtimedwait({signal
.SIGUSR1
}, 60)
49 previous_handler
= signal
.signal(signal
.SIGUSR1
, previous_handler
)
55 def file_contains(stderr_file
, list_of_string
):
56 with
open(stderr_file
, 'r') as stderr
:
58 for s
in list_of_string
:
This page took 0.030885 seconds and 5 git commands to generate.