-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-invalids.sh
executable file
·37 lines (32 loc) · 1.35 KB
/
test-invalids.sh
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
31
32
33
34
35
36
37
#!/bin/bash
# **************************************************************************** #
# #
# :::::::: #
# test-invalids.sh :+: :+: #
# +:+ #
# By: fbes <fbes@student.codam.nl> +#+ #
# +#+ #
# Created: 2022/07/14 19:37:28 by fbes #+# #+# #
# Updated: 2022/07/14 19:37:29 by fbes ######## odam.nl #
# #
# **************************************************************************** #
cd "$(dirname "$0")"
make
output=""
linenum=0
echo ""
echo "[TESTER] No server in this test script should ever start."
for filename in examples/configs/invalids/*.ini; do
echo ""
echo "Testing $filename..."
output=$(./webserv $filename 2>&1)
linenum=$(echo "$output" | tr -dc '0-9')
echo "Webserv returned:"
echo "$output"
echo ""
if [ ! -z "$linenum" ]; then
echo "Line it complained about:"
echo "$(head -n $linenum "$filename" | tail -n 1)"
fi
echo ""
done