commit c2c3f8a50440b3cd1693e5602790447803db32c2
parent ffc03728ebfcd0235332c52872ef40fe0b81acfc
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 20 Jan 2018 18:15:26 +0100
fix test driver
Diffstat:
4 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
@@ -1,11 +1,13 @@
-check_PROGRAMS = \
+noinst_PROGRAMS = \
test_twister_webserver
test_twister_webserver_SOURCES = \
test_twister_webserver.c
-
test_twister_webserver_LDADD = \
-lmicrohttpd
TESTS = \
- test_twister # shell script
+ test_twister.sh
+
+EXTRA_DIST = \
+ $(TESTS)
diff --git a/src/test/test_twister b/src/test/test_twister
@@ -1,20 +0,0 @@
-#!/bin/bash
-
-# Steps:
-
-# 1) Launch the Web server.
-
-./test_twister_webserver &
-
-# 2) Launch the Twister.
-# 3) Use the Twister-APIs via the C-L tool.
-
-# 4) Use curl to GET /something
-
-status_code=$(curl -s http://localhost:8080/ -o /dev/null \
- -w "%{http_code}")
-
-
-echo $status_code
-
-# 5) Check the HTTP status code is the hacked!
diff --git a/src/test/test_twister.sh b/src/test/test_twister.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# Steps:
+
+# 1) Launch the Web server.
+./test_twister_webserver &
+
+# 2) Launch the Twister.
+# 3) Use the Twister-APIs via the C-L tool.
+
+# 4) Use curl to GET /something
+status_code=$(curl -s http://localhost:8080/ -o /dev/null \
+ -w "%{http_code}")
+
+
+echo $status_code
+
+# 5) Check the HTTP status code is the hacked!
+kill %1
+
+# shutdown webserver
diff --git a/src/test/test_twister_webserver.c b/src/test/test_twister_webserver.c
@@ -22,7 +22,7 @@
/**
* This code is in the public domain.
*/
-
+#include <limits.h>
#include <sys/types.h>
#ifndef _WIN32
#include <sys/select.h>
@@ -72,8 +72,7 @@ main (void)
&answer_to_connection, NULL, MHD_OPTION_END);
if (NULL == daemon)
return 1;
-
- (void) getchar ();
+ sleep (UINT_MAX);
MHD_stop_daemon (daemon);
return 0;