MCPcopy Create free account
hub / github.com/FDio/vpp / show_progress

Function show_progress

test/run.py:33–58  ·  view source on GitHub ↗

Read lines from a subprocess stdout/stderr streams and write to sys.stdout & the logfile arguments: stream - subprocess stdout or stderr data stream exclude_pattern - lines matching this reg-ex will be excluded from stdout.

(stream, exclude_pattern=None)

Source from the content-addressed store, hash-verified

31
32
33def show_progress(stream, exclude_pattern=None):
34 """
35 Read lines from a subprocess stdout/stderr streams and write
36 to sys.stdout & the logfile
37
38 arguments:
39 stream - subprocess stdout or stderr data stream
40 exclude_pattern - lines matching this reg-ex will be excluded
41 from stdout.
42 """
43 while True:
44 s = stream.readline()
45 if not s:
46 break
47 data = s.decode("utf-8")
48 # Filter the annoying SIGTERM signal from the output when VPP is
49 # terminated after a test run
50 if "SIGTERM" not in data:
51 if exclude_pattern is not None:
52 if bool(re.search(exclude_pattern, data)) is False:
53 sys.stdout.write(data)
54 else:
55 sys.stdout.write(data)
56 logging.debug(data)
57 sys.stdout.flush()
58 stream.close()
59
60
61def get_env(args):

Callers 2

vm_test_runnerFunction · 0.85
post_vm_test_runFunction · 0.85

Calls 3

closeMethod · 0.80
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected