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
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import __builtin__
|
||||
|
||||
import sys
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf8')
|
||||
|
@ -18,6 +22,12 @@ error = ":negative_squared_cross_mark:"
|
|||
stress_duration = 1
|
||||
|
||||
|
||||
def print(*args, **kwargs):
|
||||
r = __builtin__.print(*args, **kwargs)
|
||||
__builtin__.print("\n")
|
||||
return r
|
||||
|
||||
|
||||
def run(cmd, output=False):
|
||||
return subprocess.Popen(cmd,
|
||||
stdin=devnull,
|
||||
|
@ -156,88 +166,88 @@ def test(tint2path, config):
|
|||
out, _ = tint2.communicate()
|
||||
exitcode = tint2.returncode
|
||||
if exitcode != 0:
|
||||
print "tint2 crashed with exit code {0}!".format(exitcode)
|
||||
print "Output:"
|
||||
print "```"
|
||||
print out
|
||||
print "```"
|
||||
print("tint2 crashed with exit code {0}!".format(exitcode))
|
||||
print("Output:")
|
||||
print("```")
|
||||
print(out)
|
||||
print("```")
|
||||
return
|
||||
min_fps, med_fps = compute_min_med_fps(out)
|
||||
leaks = find_asan_leaks(out)
|
||||
sys.stderr.write("\n")
|
||||
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
|
||||
print "Memory leak count:", len(leaks), leak_status
|
||||
print("Memory leak count:", len(leaks), leak_status)
|
||||
for leak in leaks:
|
||||
print "Memory leak:"
|
||||
print("Memory leak:")
|
||||
for line in leak:
|
||||
print line
|
||||
print(line)
|
||||
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:
|
||||
print "Output:"
|
||||
print "```"
|
||||
print out
|
||||
print "```"
|
||||
print("Output:")
|
||||
print("```")
|
||||
print(out)
|
||||
print("```")
|
||||
stop_xvfb()
|
||||
|
||||
|
||||
def main():
|
||||
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()
|
||||
print "Last commit:", out.strip()
|
||||
print("Last commit:", out.strip())
|
||||
diff, _ = run("git diff", True).communicate()
|
||||
diff = diff.strip()
|
||||
diff_staged, _ = run("git diff --staged", True).communicate()
|
||||
diff_staged = diff_staged.strip()
|
||||
if diff or diff_staged:
|
||||
print "Repository not clean", warning
|
||||
print("Repository not clean", warning)
|
||||
if diff:
|
||||
print "Diff:"
|
||||
print "```"
|
||||
print diff
|
||||
print "```"
|
||||
print("Diff:")
|
||||
print("```")
|
||||
print(diff)
|
||||
print("```")
|
||||
if diff_staged:
|
||||
print "Diff staged:"
|
||||
print "```"
|
||||
print diff_staged
|
||||
print "```"
|
||||
print ""
|
||||
print "# Compilation"
|
||||
print("Diff staged:")
|
||||
print("```")
|
||||
print(diff_staged)
|
||||
print("```")
|
||||
print("")
|
||||
print("# Compilation")
|
||||
cmake_flags = "-DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON"
|
||||
print "Flags:", cmake_flags
|
||||
print("Flags:", cmake_flags)
|
||||
start = time.time()
|
||||
c = run("rm -rf build; mkdir build; cd build; cmake {0} ../../ ; make -j7".format(cmake_flags), True)
|
||||
out, _ = c.communicate()
|
||||
duration = time.time() - start
|
||||
if c.returncode != 0:
|
||||
print "Status: Failed!", error
|
||||
print "Output:"
|
||||
print "```"
|
||||
print out
|
||||
print "```"
|
||||
print("Status: Failed!", error)
|
||||
print("Output:")
|
||||
print("```")
|
||||
print(out)
|
||||
print("```")
|
||||
return
|
||||
if "warning:" in out:
|
||||
print "Status: Succeeded with warnings!", warning
|
||||
print "Warnings:"
|
||||
print "```"
|
||||
print("Status: Succeeded with warnings!", warning)
|
||||
print("Warnings:")
|
||||
print("```")
|
||||
for line in out.split("\n"):
|
||||
if "warning:" in line:
|
||||
print line
|
||||
print "```"
|
||||
print(line)
|
||||
print("```")
|
||||
else:
|
||||
print "Status: Succeeded in %.1f seconds" % (duration,), ok
|
||||
print("Status: Succeeded in %.1f seconds" % (duration,), ok)
|
||||
configs = []
|
||||
configs += ["./configs/tint2/" +s for s in os.listdir("./configs/tint2") ]
|
||||
configs += ["../themes/" + s for s in os.listdir("../themes")]
|
||||
index = 0
|
||||
for config in configs:
|
||||
index += 1
|
||||
print ""
|
||||
print "# Test", index
|
||||
print "Config:", config.split("/")[-1].replace(".tint2rc", "")
|
||||
print("")
|
||||
print("# Test", index)
|
||||
print("Config: [{0}]({1})".format(config.split("/")[-1].replace(".tint2rc", ""), "https://gitlab.com/o9000/tint2/blob/master/test/" + config))
|
||||
test("./build/tint2", config)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in a new issue