diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2016-03-07 22:07:50 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2016-03-07 22:07:50 +0000 |
commit | 90cc15799fe189134d9580c1dc121d0b78df17ba (patch) | |
tree | 32ea2068c77c2e224d743479408818315931f64b /protocols/Telegram/tgl/libevent/test/check-dumpevents.py | |
parent | 33f7eca09be79fb9f1d1933f198b5ec60e465cd7 (diff) |
tgl.lib first compile version. Only release x86
git-svn-id: http://svn.miranda-ng.org/main/trunk@16445 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Telegram/tgl/libevent/test/check-dumpevents.py')
-rw-r--r-- | protocols/Telegram/tgl/libevent/test/check-dumpevents.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/protocols/Telegram/tgl/libevent/test/check-dumpevents.py b/protocols/Telegram/tgl/libevent/test/check-dumpevents.py new file mode 100644 index 0000000000..16fe9bc92f --- /dev/null +++ b/protocols/Telegram/tgl/libevent/test/check-dumpevents.py @@ -0,0 +1,54 @@ +#!/usr/bin/python2 +# +# Post-process the output of test-dumpevents and check it for correctness. +# + +import math +import re +import sys + +text = sys.stdin.readlines() + +try: + expect_inserted_pos = text.index("Inserted:\n") + expect_active_pos = text.index("Active:\n") + got_inserted_pos = text.index("Inserted events:\n") + got_active_pos = text.index("Active events:\n") +except ValueError: + print >>sys.stderr, "Missing expected dividing line in dumpevents output" + sys.exit(1) + +if not (expect_inserted_pos < expect_active_pos < + got_inserted_pos < got_active_pos): + print >>sys.stderr, "Sections out of order in dumpevents output" + sys.exit(1) + +now,T= text[1].split() +T = float(T) + +want_inserted = set(text[expect_inserted_pos+1:expect_active_pos]) +want_active = set(text[expect_active_pos+1:got_inserted_pos-1]) +got_inserted = set(text[got_inserted_pos+1:got_active_pos]) +got_active = set(text[got_active_pos+1:]) + +pat = re.compile(r'Timeout=([0-9\.]+)') +def replace_time(m): + t = float(m.group(1)) + if .9 < abs(t-T) < 1.1: + return "Timeout=T+1" + elif 2.4 < abs(t-T) < 2.6: + return "Timeout=T+2.5" + else: + return m.group(0) + +cleaned_inserted = set( pat.sub(replace_time, s) for s in got_inserted + if "Internal" not in s) + +if cleaned_inserted != want_inserted: + print >>sys.stderr, "Inserted event lists were not as expected!" + sys.exit(1) + +if set(got_active) != set(want_active): + print >>sys.stderr, "Active event lists were not as expected!" + sys.exit(1) + |