]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | #!/bin/bash |
2 | ||
3 | ||
4 | if test -f "./unittest/build_and_test_full.sh" ; then | |
5 | echo "Unit test (full features) will run on a local Debian system." | |
6 | rm -rf output | |
7 | else | |
8 | echo "This script must be started from the civetweb root directory using ./unittest/build_and_test_full.sh" | |
9 | exit | |
10 | fi | |
11 | ||
12 | ||
13 | # Exit with an error message when any command fails. | |
14 | set -e | |
15 | trap 'lastline=$thisline; thisline=$BASH_COMMAND' DEBUG | |
16 | trap 'echo "ERROR: \"${lastline}\" command failed (error $?)"' EXIT | |
17 | ||
18 | ||
19 | # Create a test directory and add the CGI test executable | |
20 | if test -f "./output/" ; then | |
21 | echo "Removing old \"output\" folder." | |
22 | rm -rf output | |
23 | fi | |
24 | mkdir output | |
25 | gcc unittest/cgi_test.c -o output/cgi_test.cgi | |
26 | cd output | |
27 | ||
28 | ||
29 | # Perform build and test steps in "output" directory. | |
30 | echo "Starting unit test. Write protocol to \"unittest.log\" file." | |
31 | echo "Starting unit test" > unittest.log | |
32 | git log -1 >> unittest.log | |
33 | cmake -DCIVETWEB_ENABLE_SSL=YES -DCIVETWEB_DISABLE_CGI=NO -DCIVETWEB_ENABLE_WEBSOCKETS=YES -DCIVETWEB_ENABLE_SERVER_STATS=YES -DCIVETWEB_ENABLE_IPV6=YES .. &>> unittest.log | |
34 | make all &>> unittest.log | |
35 | make test &>> unittest.log | |
36 | echo "Unit test completed. See \"unittest.log\" file." | |
37 | tail -10 unittest.log | grep " tests passed" | |
38 | cd .. | |
39 | ||
40 | ||
41 | # Exit with success | |
42 | trap '' EXIT | |
43 | exit 0 |