Skip to content

Commit

Permalink
Show serial output in automated HTTP server test
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Spinale <[email protected]>
  • Loading branch information
nspin committed Oct 4, 2023
1 parent 4da3dd1 commit ddda01b
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions hacking/nix/scope/world/instances/microkit/http-server/automate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@ def run(args):

time.sleep(3)

for url_base in [HTTP_URL_BASE, HTTPS_URL_BASE]:
sess = Session()
url = url_base + '/About/'
r = sess.get(url, verify=False, timeout=5)
print(r.status_code)
r.raise_for_status()
flush_read(child)

try:
for url_base in [HTTP_URL_BASE, HTTPS_URL_BASE]:
sess = Session()
url = url_base + '/About/'
r = sess.get(url, verify=False, timeout=5)
print(r.status_code)
r.raise_for_status()
finally:
flush_read(child)

def flush_read(child):
while True:
try:
child.read_nonblocking(timeout=0)
except pexpect.TIMEOUT:
break

if __name__ == '__main__':
main()

0 comments on commit ddda01b

Please sign in to comment.