Regression testing

This commit is contained in:
o9000 2017-09-28 15:08:26 +02:00
parent b58a6512b3
commit 5302fb4ba7

View file

@ -35,6 +35,10 @@ def print(*args, **kwargs):
return r
def print_err(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def run(cmd, output=False):
return subprocess.Popen(cmd,
stdin=devnull,
@ -57,6 +61,14 @@ def sleep(n):
n -= 1
def install_deps_ubuntu():
p = run(["sudo", "apt-get update; apt-get build-dep tint2; apt-get install -y git Xvfb xsettingsd openbox compton x11-utils gnome-calculator"])
out, _ = p.communicate()
if p.returncode != 0:
print_err("Process exited with code:", p.returncode, "and output:", out)
raise RuntimeError("install_deps() failed!")
def start_xvfb():
stop_xvfb()
xvfb = run(["Xvfb", ":{0}".format(display), "-screen", "0", "1280x720x24", "-nolisten", "tcp", "-dpi", "96"])
@ -295,7 +307,7 @@ def checkout(version):
p = run("rm -rf tmpclone; git clone https://gitlab.com/o9000/tint2.git tmpclone; cd tmpclone; git checkout {0}".format(version), True)
out, _ = p.communicate()
if p.returncode != 0:
sys.stderr.write(out)
print_err(out)
raise RuntimeError("git clone failed!")
@ -303,7 +315,11 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument("--src_dir", default=get_default_src_dir())
parser.add_argument("--for_version", default="HEAD")
parser.add_argument("--install_deps", dest="install_deps", action="store_true")
parser.set_defaults(install_deps=False)
args = parser.parse_args()
if args.install_deps:
install_deps_ubuntu()
if args.for_version != "HEAD":
checkout(args.for_version)
args.src_dir = "./tmpclone"