summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-05-23 16:44:58 +0300
committerLars Wirzenius <liw@liw.fi>2020-05-23 16:44:58 +0300
commitec3ba471f72593202fd7d2f45b918d35998b3b7e (patch)
tree2bde6edfd2d28f96903be3304d1d50faa5a476cb
parentce8bd60732297c41b6816e3f0ffb9f4646f6305d (diff)
downloadewww-ec3ba471f72593202fd7d2f45b918d35998b3b7e.tar.gz
test: kill server started by scenario at end of scenario
-rw-r--r--ewww.py8
-rw-r--r--ewww.yaml1
2 files changed, 8 insertions, 1 deletions
diff --git a/ewww.py b/ewww.py
index 2e45aa9..4f06b47 100644
--- a/ewww.py
+++ b/ewww.py
@@ -6,6 +6,7 @@ import os
import random
import re
import shutil
+import signal
import subprocess
import time
import urllib.parse
@@ -100,7 +101,12 @@ def start_server(ctx, filename=None):
)
_run_exit(ctx, 0)
- ctx["pid"] = open("ewww.pid").read()
+ ctx["pid"] = int(open("ewww.pid").read().strip())
+
+
+# Stop previously started server.
+def stop_server(ctx):
+ os.kill(ctx["pid"], signal.SIGKILL)
# Make a HTTP request.
diff --git a/ewww.yaml b/ewww.yaml
index 94c33c1..d1a13ab 100644
--- a/ewww.yaml
+++ b/ewww.yaml
@@ -3,6 +3,7 @@
- given: a running server using config file {filename}
function: start_server
+ cleanup: stop_server
- given: "{count} files in {dirname}"
function: fixme