From 83ab71cc26b45ce1954137076252808d112a532b Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Fri, 15 Jan 2016 00:49:24 -0800 Subject: [PATCH] Tests for #217 --- tests/actual.txt | 0 tests/run_tests.sh | 57 ++++++++++++++++++++++++++++++---------------- tests/tc001/run.sh | 2 +- tests/tc002/run.sh | 2 +- tests/tc003/run.sh | 4 ++-- tests/tc004/run.sh | 2 +- tests/tc005/run.sh | 2 +- tests/tc006/run.sh | 8 +++---- tests/tc007/run.sh | 4 ++-- tests/tc008/run.sh | 2 +- tests/tc009/run.sh | 6 ++--- tests/tc010/run.sh | 4 ++-- tests/tc011/run.sh | 2 +- tests/tc012/run.sh | 4 ++-- tests/tc013/run.sh | 4 ++-- tests/tc014/run.sh | 4 ++-- tests/tc015/run.sh | 4 ++-- tests/tc016/run.sh | 4 ++-- tests/tc017/run.sh | 2 +- tests/tc018/run.sh | 4 ++-- tests/tc019/run.sh | 4 ++-- tests/tc020/run.sh | 4 ++-- tests/tc021/run.sh | 2 +- tests/tc022/run.sh | 2 +- tests/tc023/run.sh | 4 ++-- tests/tc024/run.sh | 14 ++++++------ tests/tc025/run.sh | 2 +- 27 files changed, 85 insertions(+), 68 deletions(-) create mode 100644 tests/actual.txt diff --git a/tests/actual.txt b/tests/actual.txt new file mode 100644 index 0000000..e69de29 diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 29a7975..cf1da05 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -11,35 +11,52 @@ pass_count=0 # Make sure that the server is shut down echo "Shutting down currently-running server..." ../bin/dcd-client --shutdown 2>/dev/null > /dev/null +../bin/dcd-client --shutdown --tcp 2>/dev/null > /dev/null sleep 1s; -# Start up the server -echo "Starting server..." -../bin/dcd-server --ignoreConfig -I $IMPORTS 2>stderr.txt > stdout.txt & -sleep 1s; +for socket in unix tcp; do + echo "Running tests for $socket sockets" -# Run tests -for testCase in tc*; do - cd $testCase; - - ./run.sh; - if [ $? -eq 0 ]; then - echo -e "${YELLOW}$testCase:${NORMAL} ... ${GREEN}Pass${NORMAL}"; - let pass_count=pass_count+1 + # Start up the server + echo "Starting server..." + if [[ $socket == "unix" ]]; then + ../bin/dcd-server --ignoreConfig -I $IMPORTS 2>stderr.txt > stdout.txt & else - echo -e "${YELLOW}$testCase:${NORMAL} ... ${RED}Fail${NORMAL}"; - let fail_count=fail_count+1 + ../bin/dcd-server --tcp --ignoreConfig -I $IMPORTS 2>stderr.txt > stdout.txt & fi + sleep 1s; - cd - > /dev/null; + # Run tests + for testCase in tc*; do + cd $testCase + + if [[ $socket == "unix" ]]; then + ./run.sh "" + else + ./run.sh "--tcp" + fi + if [[ $? -eq 0 ]]; then + echo -e "${YELLOW}$socket:$testCase:${NORMAL} ... ${GREEN}Pass${NORMAL}"; + let pass_count=pass_count+1 + else + echo -e "${YELLOW}$socket:$testCase:${NORMAL} ... ${RED}Fail${NORMAL}"; + let fail_count=fail_count+1 + fi + + cd - > /dev/null; + done + + # Shut down + echo "Shutting down server..." + if [[ $socket == "unix" ]]; then + ../bin/dcd-client --shutdown 2>/dev/null > /dev/null + else + ../bin/dcd-client --shutdown --tcp 2>/dev/null > /dev/null + fi done -# Shut down -echo "Shutting down server..." -../bin/dcd-client --shutdown 2>/dev/null > /dev/null - # Report -if [ $fail_count -eq 0 ]; then +if [[ $fail_count -eq 0 ]]; then echo -e "${GREEN}${pass_count} tests passed and ${fail_count} failed.${NORMAL}" else echo -e "${RED}${pass_count} tests passed and ${fail_count} failed.${NORMAL}" diff --git a/tests/tc001/run.sh b/tests/tc001/run.sh index 4afc788..9c7daf9 100755 --- a/tests/tc001/run.sh +++ b/tests/tc001/run.sh @@ -1,5 +1,5 @@ set -e set -u -../../bin/dcd-client file.d -c12 > actual.txt +../../bin/dcd-client $1 file.d -c12 > actual.txt diff actual.txt expected.txt diff --git a/tests/tc002/run.sh b/tests/tc002/run.sh index 5653647..0bcbfde 100755 --- a/tests/tc002/run.sh +++ b/tests/tc002/run.sh @@ -1,5 +1,5 @@ set -e set -u -../../bin/dcd-client file.d -c52 > actual.txt +../../bin/dcd-client $1 file.d -c52 > actual.txt diff actual.txt expected.txt diff --git a/tests/tc003/run.sh b/tests/tc003/run.sh index f26e2bf..24f3602 100755 --- a/tests/tc003/run.sh +++ b/tests/tc003/run.sh @@ -1,8 +1,8 @@ set -e set -u -../../bin/dcd-client file.d -c839 > actual1.txt +../../bin/dcd-client $1 file.d -c839 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c862 > actual2.txt +../../bin/dcd-client $1 file.d -c862 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc004/run.sh b/tests/tc004/run.sh index 0fe8f48..4c55c94 100755 --- a/tests/tc004/run.sh +++ b/tests/tc004/run.sh @@ -1,5 +1,5 @@ set -e set -u -../../bin/dcd-client file.d -c13 > actual.txt +../../bin/dcd-client $1 file.d -c13 > actual.txt diff actual.txt expected.txt diff --git a/tests/tc005/run.sh b/tests/tc005/run.sh index e78def1..c3b3062 100755 --- a/tests/tc005/run.sh +++ b/tests/tc005/run.sh @@ -1,5 +1,5 @@ set -e set -u -../../bin/dcd-client file.d -c154 > actual.txt +../../bin/dcd-client $1 file.d -c154 > actual.txt diff actual.txt expected.txt diff --git a/tests/tc006/run.sh b/tests/tc006/run.sh index 78a2a09..7b80b64 100755 --- a/tests/tc006/run.sh +++ b/tests/tc006/run.sh @@ -1,14 +1,14 @@ set -e set -u -../../bin/dcd-client file.d -c184 > actual1.txt +../../bin/dcd-client $1 file.d -c184 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c199 > actual2.txt +../../bin/dcd-client $1 file.d -c199 > actual2.txt diff actual2.txt expected2.txt -../../bin/dcd-client file.d -c216 > actual3.txt +../../bin/dcd-client $1 file.d -c216 > actual3.txt diff actual3.txt expected3.txt -../../bin/dcd-client file.d -c231 > actual4.txt +../../bin/dcd-client $1 file.d -c231 > actual4.txt diff actual4.txt expected4.txt diff --git a/tests/tc007/run.sh b/tests/tc007/run.sh index 0bc1745..e6c624c 100755 --- a/tests/tc007/run.sh +++ b/tests/tc007/run.sh @@ -1,8 +1,8 @@ set -e set -u -../../bin/dcd-client file.d -c97 > actual1.txt +../../bin/dcd-client $1 file.d -c97 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c130 > actual2.txt +../../bin/dcd-client $1 file.d -c130 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc008/run.sh b/tests/tc008/run.sh index fc40d3c..224788d 100755 --- a/tests/tc008/run.sh +++ b/tests/tc008/run.sh @@ -1,5 +1,5 @@ set -e set -u -../../bin/dcd-client file.d -c113 > actual1.txt +../../bin/dcd-client $1 file.d -c113 > actual1.txt diff actual1.txt expected1.txt diff --git a/tests/tc009/run.sh b/tests/tc009/run.sh index d7e9ea1..4c52ea7 100755 --- a/tests/tc009/run.sh +++ b/tests/tc009/run.sh @@ -1,11 +1,11 @@ set -e set -u -../../bin/dcd-client file.d -c83 > actual1.txt +../../bin/dcd-client $1 file.d -c83 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c93 > actual2.txt +../../bin/dcd-client $1 file.d -c93 > actual2.txt diff actual2.txt expected2.txt -../../bin/dcd-client file.d -c148 > actual3.txt +../../bin/dcd-client $1 file.d -c148 > actual3.txt diff actual3.txt expected3.txt diff --git a/tests/tc010/run.sh b/tests/tc010/run.sh index 70cb4bf..a9cfee0 100755 --- a/tests/tc010/run.sh +++ b/tests/tc010/run.sh @@ -6,12 +6,12 @@ cp testfile1_old.d ../imports/testfile1.d # than one second sleep 1s; -../../bin/dcd-client file.d -c84 > actual1.txt +../../bin/dcd-client $1 file.d -c84 > actual1.txt diff actual1.txt expected1.txt cp testfile1_new.d ../imports/testfile1.d # Same here sleep 1s; -../../bin/dcd-client file.d -c84 > actual2.txt +../../bin/dcd-client $1 file.d -c84 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc011/run.sh b/tests/tc011/run.sh index 8fae6ed..d4f6489 100755 --- a/tests/tc011/run.sh +++ b/tests/tc011/run.sh @@ -1,5 +1,5 @@ set -e set -u -../../bin/dcd-client file.d -c48 > actual1.txt +../../bin/dcd-client $1 file.d -c48 > actual1.txt diff actual1.txt expected1.txt diff --git a/tests/tc012/run.sh b/tests/tc012/run.sh index a82297c..a79e8a3 100755 --- a/tests/tc012/run.sh +++ b/tests/tc012/run.sh @@ -1,8 +1,8 @@ set -e set -u -../../bin/dcd-client file.d -c35 > actual1.txt +../../bin/dcd-client $1 file.d -c35 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c61 > actual2.txt +../../bin/dcd-client $1 file.d -c61 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc013/run.sh b/tests/tc013/run.sh index 7324a02..64c65a7 100755 --- a/tests/tc013/run.sh +++ b/tests/tc013/run.sh @@ -1,8 +1,8 @@ set -e set -u -../../bin/dcd-client file.d -c187 > actual1.txt +../../bin/dcd-client $1 file.d -c187 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c211 > actual2.txt +../../bin/dcd-client $1 file.d -c211 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc014/run.sh b/tests/tc014/run.sh index 032b74c..7883039 100755 --- a/tests/tc014/run.sh +++ b/tests/tc014/run.sh @@ -6,12 +6,12 @@ cp testfile2_old.d ../imports/testfile2.d # than one second sleep 1s; -../../bin/dcd-client file.d -c39 > actual1.txt +../../bin/dcd-client $1 file.d -c39 > actual1.txt diff actual1.txt expected1.txt cp testfile2_new.d ../imports/testfile2.d # Same here sleep 1s; -../../bin/dcd-client file.d -c39 > actual2.txt +../../bin/dcd-client $1 file.d -c39 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc015/run.sh b/tests/tc015/run.sh index 6ab4dc2..16cb5b7 100755 --- a/tests/tc015/run.sh +++ b/tests/tc015/run.sh @@ -1,8 +1,8 @@ set -e set -u -../../bin/dcd-client file1.d -c84 > actual1.txt +../../bin/dcd-client $1 file1.d -c84 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file2.d -c73 > actual2.txt +../../bin/dcd-client $1 file2.d -c73 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc016/run.sh b/tests/tc016/run.sh index a3311a4..446f354 100755 --- a/tests/tc016/run.sh +++ b/tests/tc016/run.sh @@ -1,8 +1,8 @@ set -e set -u -../../bin/dcd-client file.d -c24 > actual1.txt +../../bin/dcd-client $1 file.d -c24 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c57 > actual2.txt +../../bin/dcd-client $1 file.d -c57 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc017/run.sh b/tests/tc017/run.sh index 5ffe242..e55e675 100755 --- a/tests/tc017/run.sh +++ b/tests/tc017/run.sh @@ -1,5 +1,5 @@ set -e set -u -../../bin/dcd-client file.d -c33 > actual.txt +../../bin/dcd-client $1 file.d -c33 > actual.txt diff actual.txt expected.txt diff --git a/tests/tc018/run.sh b/tests/tc018/run.sh index 545cb43..3a59839 100755 --- a/tests/tc018/run.sh +++ b/tests/tc018/run.sh @@ -1,8 +1,8 @@ set -e set -u -../../bin/dcd-client file.d -c61 > actual1.txt +../../bin/dcd-client $1 file.d -c61 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c88 > actual2.txt +../../bin/dcd-client $1 file.d -c88 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc019/run.sh b/tests/tc019/run.sh index 83f690b..7247b9c 100755 --- a/tests/tc019/run.sh +++ b/tests/tc019/run.sh @@ -1,8 +1,8 @@ set -e set -u -../../bin/dcd-client file.d -c84 > actual1.txt +../../bin/dcd-client $1 file.d -c84 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c111 > actual2.txt +../../bin/dcd-client $1 file.d -c111 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc020/run.sh b/tests/tc020/run.sh index 8751e55..49dbb3d 100755 --- a/tests/tc020/run.sh +++ b/tests/tc020/run.sh @@ -1,8 +1,8 @@ set -e set -u -../../bin/dcd-client file.d -c159 > actual1.txt +../../bin/dcd-client $1 file.d -c159 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c199 > actual2.txt +../../bin/dcd-client $1 file.d -c199 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc021/run.sh b/tests/tc021/run.sh index 03fe27b..f64af43 100755 --- a/tests/tc021/run.sh +++ b/tests/tc021/run.sh @@ -1,5 +1,5 @@ set -e set -u -../../bin/dcd-client file.d -c1 > actual.txt +../../bin/dcd-client $1 file.d -c1 > actual.txt diff actual.txt expected.txt diff --git a/tests/tc022/run.sh b/tests/tc022/run.sh index 7964eb9..6e2b067 100755 --- a/tests/tc022/run.sh +++ b/tests/tc022/run.sh @@ -1,5 +1,5 @@ set -e set -u -../../bin/dcd-client file.d -c16 > actual.txt +../../bin/dcd-client $1 file.d -c16 > actual.txt diff actual.txt expected.txt diff --git a/tests/tc023/run.sh b/tests/tc023/run.sh index 86ea69f..ef46816 100755 --- a/tests/tc023/run.sh +++ b/tests/tc023/run.sh @@ -1,8 +1,8 @@ set -e set -u -../../bin/dcd-client file.d -c117 > actual1.txt +../../bin/dcd-client $1 file.d -c117 > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c89 > actual2.txt +../../bin/dcd-client $1 file.d -c89 > actual2.txt diff actual2.txt expected2.txt diff --git a/tests/tc024/run.sh b/tests/tc024/run.sh index e480213..71eeeb2 100755 --- a/tests/tc024/run.sh +++ b/tests/tc024/run.sh @@ -1,23 +1,23 @@ set -e set -u -../../bin/dcd-client file.d -c286 -d > actual1.txt +../../bin/dcd-client $1 file.d -c286 -d > actual1.txt diff actual1.txt expected1.txt -../../bin/dcd-client file.d -c290 -d > actual2.txt +../../bin/dcd-client $1 file.d -c290 -d > actual2.txt diff actual2.txt expected2.txt -../../bin/dcd-client file.d -c294 -d > actual3.txt +../../bin/dcd-client $1 file.d -c294 -d > actual3.txt diff actual3.txt expected3.txt -../../bin/dcd-client file.d -c298 -d> actual4.txt +../../bin/dcd-client $1 file.d -c298 -d> actual4.txt diff actual4.txt expected4.txt -../../bin/dcd-client file.d -c302 -d> actual5.txt +../../bin/dcd-client $1 file.d -c302 -d> actual5.txt diff actual5.txt expected5.txt -../../bin/dcd-client file.d -c306 -d> actual6.txt +../../bin/dcd-client $1 file.d -c306 -d> actual6.txt diff actual6.txt expected6.txt -../../bin/dcd-client file.d -c313 -d> actual7.txt +../../bin/dcd-client $1 file.d -c313 -d> actual7.txt diff actual7.txt expected7.txt diff --git a/tests/tc025/run.sh b/tests/tc025/run.sh index 02e6232..65ff518 100755 --- a/tests/tc025/run.sh +++ b/tests/tc025/run.sh @@ -1,5 +1,5 @@ set -e set -u -../../bin/dcd-client file.d -c94 > actual1.txt +../../bin/dcd-client $1 file.d -c94 > actual1.txt diff actual1.txt expected1.txt