Skip to content
Snippets Groups Projects

test_with_chroot.sh: do not require superuser privileges

Files
2
+ 42
72
@@ -130,7 +130,7 @@ class RecvNullExc(Exception):
pass
def main():
def connect():
for i in range(100):
try:
sock = socket.create_connection(("127.0.0.1", 5910), timeout=5)
@@ -177,78 +177,48 @@ def main():
+ b"".join(encoding.to_bytes(4, "big") for encoding in encodings)
)
# setup done
print("waiting for reform-setup-wizard", file=sys.stderr)
time.sleep(20)
# welcome
move(sock, Point(1050, 625))
screenshot(sock, rect, "00welcome.png")
click(sock, Point(1050, 625))
time.sleep(4)
# keyboard
move(sock, Point(1050, 625))
screenshot(sock, rect, "01keyboard.png")
click(sock, Point(1050, 625))
# time
time.sleep(4)
move(sock, Point(1050, 625))
screenshot(sock, rect, "02time.png")
click(sock, Point(1050, 625))
# desktop
time.sleep(4)
move(sock, Point(1050, 915))
screenshot(sock, rect, "03desktop.png")
click(sock, Point(1050, 915))
# root
time.sleep(4)
screenshot(sock, rect, "04root.png")
keypress(sock, "p")
time.sleep(1)
keypress(sock, "Tab")
time.sleep(1)
keypress(sock, "p")
time.sleep(1)
keypress(sock, "Tab")
time.sleep(1)
keypress(sock, "space")
# hostname
time.sleep(4)
screenshot(sock, rect, "05hostname.png")
keypress(sock, "m")
time.sleep(1)
keypress(sock, "m")
time.sleep(1)
keypress(sock, "Tab")
time.sleep(1)
keypress(sock, "space")
# account
time.sleep(4)
screenshot(sock, rect, "06account.png")
keypress(sock, "u")
time.sleep(1)
keypress(sock, "Tab")
time.sleep(1)
keypress(sock, "p")
time.sleep(1)
keypress(sock, "Tab")
time.sleep(1)
keypress(sock, "p")
time.sleep(1)
keypress(sock, "Tab")
time.sleep(1)
screenshot(sock, rect, "07final.png")
keypress(sock, "space")
return sock, rect
time.sleep(4)
sock.close()
def main():
sock = None
rect = None
mousepos = Point(0, 0)
for line in sys.stdin:
if line.startswith("#"):
continue
line = line.strip()
tokens = line.split()
if len(tokens) < 1:
raise Exception("no tokens")
match tokens[0]:
case "connect":
sock, rect = connect()
case "sleep":
if len(tokens) != 2:
raise Exception(f"missing argument {line}")
time.sleep(float(tokens[1]))
case "capture":
if len(tokens) != 2:
raise Exception(f"missing argument {line}")
if sock is None or rect is None:
raise Exception("must connect first")
screenshot(sock, rect, tokens[1])
case "key":
if len(tokens) != 2:
raise Exception(f"missing argument {line}")
keypress(sock, tokens[1])
case "mousemove":
if len(tokens) != 3:
raise Exception(f"missing argument {line}")
mousepos = Point(int(tokens[1]), int(tokens[2]))
move(sock, mousepos)
case "click":
click(sock, mousepos)
case _:
raise Exception(f"unknown command: {tokens[0]}")
if sock is not None:
sock.close()
if __name__ == "__main__":
Loading