File: server-hello

package info (click to toggle)
lua-http 0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,100 kB
  • sloc: makefile: 60; sh: 16
file content (30 lines) | stat: -rwxr-xr-x 717 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
#
# lua-http debian/tests/server-hello
#
# Test that runs server_hello.lua from the lua-http examples
# It replies with a "Hello world!" if the request is not a HEAD method.
#
# Author: Santiago Ruano Rincón <santiago@debian.org>

set -e

PORT=12345
HELLO_WORLD="Hello world!"

# lua-fifo currently (as of 20200212, 0.2-3) supports lua5.1 and 5.2

lua5.2 /usr/share/doc/lua-http/examples/server_hello.lua $PORT 2>&1 &
SERVER_PID=$!
trap "kill $SERVER_PID" 0 INT QUIT ABRT PIPE TERM
sleep 2
OUTPUT=`curl --silent http://localhost:$PORT`


# The server should return "Hello world!"
if [ ! "$OUTPUT" = "$HELLO_WORLD" ] ; then
    echo "Outcome: $OUTPUT"
    echo "Expected: $HELLO_WORLD"
    exit 1
fi
exit 0