3 # Post-process the output of test-dumpevents and check it for correctness.
10 text = sys.stdin.readlines()
13 expect_inserted_pos = text.index("Inserted:\n")
14 expect_active_pos = text.index("Active:\n")
15 got_inserted_pos = text.index("Inserted events:\n")
16 got_active_pos = text.index("Active events:\n")
18 sys.stderr.write("Missing expected dividing line in dumpevents output")
21 if not (expect_inserted_pos < expect_active_pos <
22 got_inserted_pos < got_active_pos):
23 sys.stderr.write("Sections out of order in dumpevents output")
26 now,T= text[1].split()
29 want_inserted = set(text[expect_inserted_pos+1:expect_active_pos])
30 want_active = set(text[expect_active_pos+1:got_inserted_pos-1])
31 got_inserted = set(text[got_inserted_pos+1:got_active_pos])
32 got_active = set(text[got_active_pos+1:])
34 pat = re.compile(r'Timeout=([0-9\.]+)')
37 if .9 < abs(t-T) < 1.1:
39 elif 2.4 < abs(t-T) < 2.6:
40 return "Timeout=T+2.5"
44 cleaned_inserted = set( pat.sub(replace_time, s) for s in got_inserted
45 if "Internal" not in s)
47 if cleaned_inserted != want_inserted:
48 sys.stderr.write("Inserted event lists were not as expected!")
51 if set(got_active) != set(want_active):
52 sys.stderr.write("Active event lists were not as expected!")