Regression tests
This commit is contained in:
parent
246048d8be
commit
71db6de14f
1 changed files with 52 additions and 42 deletions
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import __builtin__
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
reload(sys)
|
reload(sys)
|
||||||
sys.setdefaultencoding('utf8')
|
sys.setdefaultencoding('utf8')
|
||||||
|
@ -18,6 +22,12 @@ error = ":negative_squared_cross_mark:"
|
||||||
stress_duration = 1
|
stress_duration = 1
|
||||||
|
|
||||||
|
|
||||||
|
def print(*args, **kwargs):
|
||||||
|
r = __builtin__.print(*args, **kwargs)
|
||||||
|
__builtin__.print("\n")
|
||||||
|
return r
|
||||||
|
|
||||||
|
|
||||||
def run(cmd, output=False):
|
def run(cmd, output=False):
|
||||||
return subprocess.Popen(cmd,
|
return subprocess.Popen(cmd,
|
||||||
stdin=devnull,
|
stdin=devnull,
|
||||||
|
@ -156,88 +166,88 @@ def test(tint2path, config):
|
||||||
out, _ = tint2.communicate()
|
out, _ = tint2.communicate()
|
||||||
exitcode = tint2.returncode
|
exitcode = tint2.returncode
|
||||||
if exitcode != 0:
|
if exitcode != 0:
|
||||||
print "tint2 crashed with exit code {0}!".format(exitcode)
|
print("tint2 crashed with exit code {0}!".format(exitcode))
|
||||||
print "Output:"
|
print("Output:")
|
||||||
print "```"
|
print("```")
|
||||||
print out
|
print(out)
|
||||||
print "```"
|
print("```")
|
||||||
return
|
return
|
||||||
min_fps, med_fps = compute_min_med_fps(out)
|
min_fps, med_fps = compute_min_med_fps(out)
|
||||||
leaks = find_asan_leaks(out)
|
leaks = find_asan_leaks(out)
|
||||||
sys.stderr.write("\n")
|
sys.stderr.write("\n")
|
||||||
mem_status = ok if mem < 20 else warning if mem < 40 else error
|
mem_status = ok if mem < 20 else warning if mem < 40 else error
|
||||||
print "Memory usage: %.1f %s %s" % (mem, "MB", mem_status)
|
print("Memory usage: %.1f %s %s" % (mem, "MB", mem_status))
|
||||||
leak_status = ok if not leaks else error
|
leak_status = ok if not leaks else error
|
||||||
print "Memory leak count:", len(leaks), leak_status
|
print("Memory leak count:", len(leaks), leak_status)
|
||||||
for leak in leaks:
|
for leak in leaks:
|
||||||
print "Memory leak:"
|
print("Memory leak:")
|
||||||
for line in leak:
|
for line in leak:
|
||||||
print line
|
print(line)
|
||||||
fps_status = ok if min_fps > 60 else warning if min_fps > 40 else error
|
fps_status = ok if min_fps > 60 else warning if min_fps > 40 else error
|
||||||
print "FPS:", "min:", min_fps, "median:", med_fps, fps_status
|
print("FPS:", "min:", min_fps, "median:", med_fps, fps_status)
|
||||||
if mem_status != ok or leak_status != ok or fps_status != ok:
|
if mem_status != ok or leak_status != ok or fps_status != ok:
|
||||||
print "Output:"
|
print("Output:")
|
||||||
print "```"
|
print("```")
|
||||||
print out
|
print(out)
|
||||||
print "```"
|
print("```")
|
||||||
stop_xvfb()
|
stop_xvfb()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
utc_datetime = datetime.datetime.utcnow()
|
utc_datetime = datetime.datetime.utcnow()
|
||||||
print "Last updated:", utc_datetime.strftime("%Y-%m-%d %H:%M UTC")
|
print("Last updated:", utc_datetime.strftime("%Y-%m-%d %H:%M UTC"))
|
||||||
out, _ = run("git show -s '--format=%H %s'", True).communicate()
|
out, _ = run("git show -s '--format=%H %s'", True).communicate()
|
||||||
print "Last commit:", out.strip()
|
print("Last commit:", out.strip())
|
||||||
diff, _ = run("git diff", True).communicate()
|
diff, _ = run("git diff", True).communicate()
|
||||||
diff = diff.strip()
|
diff = diff.strip()
|
||||||
diff_staged, _ = run("git diff --staged", True).communicate()
|
diff_staged, _ = run("git diff --staged", True).communicate()
|
||||||
diff_staged = diff_staged.strip()
|
diff_staged = diff_staged.strip()
|
||||||
if diff or diff_staged:
|
if diff or diff_staged:
|
||||||
print "Repository not clean", warning
|
print("Repository not clean", warning)
|
||||||
if diff:
|
if diff:
|
||||||
print "Diff:"
|
print("Diff:")
|
||||||
print "```"
|
print("```")
|
||||||
print diff
|
print(diff)
|
||||||
print "```"
|
print("```")
|
||||||
if diff_staged:
|
if diff_staged:
|
||||||
print "Diff staged:"
|
print("Diff staged:")
|
||||||
print "```"
|
print("```")
|
||||||
print diff_staged
|
print(diff_staged)
|
||||||
print "```"
|
print("```")
|
||||||
print ""
|
print("")
|
||||||
print "# Compilation"
|
print("# Compilation")
|
||||||
cmake_flags = "-DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON"
|
cmake_flags = "-DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON"
|
||||||
print "Flags:", cmake_flags
|
print("Flags:", cmake_flags)
|
||||||
start = time.time()
|
start = time.time()
|
||||||
c = run("rm -rf build; mkdir build; cd build; cmake {0} ../../ ; make -j7".format(cmake_flags), True)
|
c = run("rm -rf build; mkdir build; cd build; cmake {0} ../../ ; make -j7".format(cmake_flags), True)
|
||||||
out, _ = c.communicate()
|
out, _ = c.communicate()
|
||||||
duration = time.time() - start
|
duration = time.time() - start
|
||||||
if c.returncode != 0:
|
if c.returncode != 0:
|
||||||
print "Status: Failed!", error
|
print("Status: Failed!", error)
|
||||||
print "Output:"
|
print("Output:")
|
||||||
print "```"
|
print("```")
|
||||||
print out
|
print(out)
|
||||||
print "```"
|
print("```")
|
||||||
return
|
return
|
||||||
if "warning:" in out:
|
if "warning:" in out:
|
||||||
print "Status: Succeeded with warnings!", warning
|
print("Status: Succeeded with warnings!", warning)
|
||||||
print "Warnings:"
|
print("Warnings:")
|
||||||
print "```"
|
print("```")
|
||||||
for line in out.split("\n"):
|
for line in out.split("\n"):
|
||||||
if "warning:" in line:
|
if "warning:" in line:
|
||||||
print line
|
print(line)
|
||||||
print "```"
|
print("```")
|
||||||
else:
|
else:
|
||||||
print "Status: Succeeded in %.1f seconds" % (duration,), ok
|
print("Status: Succeeded in %.1f seconds" % (duration,), ok)
|
||||||
configs = []
|
configs = []
|
||||||
configs += ["./configs/tint2/" +s for s in os.listdir("./configs/tint2") ]
|
configs += ["./configs/tint2/" +s for s in os.listdir("./configs/tint2") ]
|
||||||
configs += ["../themes/" + s for s in os.listdir("../themes")]
|
configs += ["../themes/" + s for s in os.listdir("../themes")]
|
||||||
index = 0
|
index = 0
|
||||||
for config in configs:
|
for config in configs:
|
||||||
index += 1
|
index += 1
|
||||||
print ""
|
print("")
|
||||||
print "# Test", index
|
print("# Test", index)
|
||||||
print "Config:", config.split("/")[-1].replace(".tint2rc", "")
|
print("Config: [{0}]({1})".format(config.split("/")[-1].replace(".tint2rc", ""), "https://gitlab.com/o9000/tint2/blob/master/test/" + config))
|
||||||
test("./build/tint2", config)
|
test("./build/tint2", config)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue