From c21933644001ec721d602490a3a6392b73cba592 Mon Sep 17 00:00:00 2001 From: pranomostro Date: Thu, 15 Dec 2016 17:43:49 +0100 Subject: Make tests faster by not starting three different sessions after each other. --- Makefile | 2 +- tests/test-chat | 9 --------- tests/test-file | 9 --------- tests/test-ratox | 10 ++++++++++ tests/test-request | 8 -------- 5 files changed, 11 insertions(+), 27 deletions(-) delete mode 100755 tests/test-chat delete mode 100755 tests/test-file create mode 100755 tests/test-ratox delete mode 100755 tests/test-request diff --git a/Makefile b/Makefile index ffd8af2..feb140f 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,6 @@ clean: check: all @echo testing - @cd tests; sh test-chat && sh test-file && sh test-request + @cd tests; sh test-ratox .PHONY: all binlib bin install uninstall clean check diff --git a/tests/test-chat b/tests/test-chat deleted file mode 100755 index 97bc838..0000000 --- a/tests/test-chat +++ /dev/null @@ -1,9 +0,0 @@ -. ./common - -spawn_users -add_friends -send_text -echo :: $(basename $0) - $(echolor 2 OK) - -cleanup -exit 0 diff --git a/tests/test-file b/tests/test-file deleted file mode 100755 index 2499aa6..0000000 --- a/tests/test-file +++ /dev/null @@ -1,9 +0,0 @@ -. ./common - -spawn_users -add_friends -send_file -echo :: $(basename $0) - $(echolor 2 OK) - -cleanup -exit 0 diff --git a/tests/test-ratox b/tests/test-ratox new file mode 100755 index 0000000..89b7ce1 --- /dev/null +++ b/tests/test-ratox @@ -0,0 +1,10 @@ +. ./common + +spawn_users +add_friends +send_text +send_file +echo :: $(basename $0) - $(echolor 2 OK) + +cleanup +exit 0 diff --git a/tests/test-request b/tests/test-request deleted file mode 100755 index 63b9312..0000000 --- a/tests/test-request +++ /dev/null @@ -1,8 +0,0 @@ -. ./common - -spawn_users -add_friends -echo :: $(basename $0) - $(echolor 2 OK) - -cleanup -exit 0 -- cgit v1.2.3 From b8bebb90b93f9240f73c68d03e41383d5ed1849f Mon Sep 17 00:00:00 2001 From: pranomostro Date: Sat, 17 Dec 2016 13:22:22 +0100 Subject: Update the tests so that they send multiple messages and files and also change the names and statuses. --- tests/common | 18 +++++++++++++++++- tests/test-ratox | 9 +++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/common b/tests/common index 462677d..3dd9628 100644 --- a/tests/common +++ b/tests/common @@ -36,13 +36,29 @@ add_friends() { while [ $(cat u1/$id2/online) -eq 0 ]; do sleep 1; done } +change_name() { + NAME=$(dd bs=64 count=1 if=/dev/urandom 2>/dev/null|tr -cd '\11\12\15\40-\176\n'|sed 's/$/\n/') + id1=$(cut -b-64 < u1/id) + echo ":: changing name of u1" + echo "$NAME" >u1/name/in + while ! grep -Fq -- "$NAME" u2/$id1/name; do sleep 1; done +} + +change_status() { + STATUS=$(dd bs=128 count=1 if=/dev/urandom 2>/dev/null|tr -cd '\11\12\15\40-\176\n'|sed 's/$/\n/') + id1=$(cut -b-64 < u1/id) + echo ":: changing status of u1" + echo "$STATUS" >u1/name/in + while ! grep -Fq -- "$STATUS" u2/$id1/name; do sleep 1; done +} + send_text() { RND=$(tr -cd 'A-F0-9' u1/$id2/text_in - while ! grep -q "$RND" u2/$id1/text_out; do sleep 1; done + while ! grep -q -- "$RND" u2/$id1/text_out; do sleep 1; done } send_file() { diff --git a/tests/test-ratox b/tests/test-ratox index 89b7ce1..b478ef7 100755 --- a/tests/test-ratox +++ b/tests/test-ratox @@ -2,8 +2,13 @@ spawn_users add_friends -send_text -send_file +for i in $(seq 1 16); do + change_name + change_status + send_text + send_file +done + echo :: $(basename $0) - $(echolor 2 OK) cleanup -- cgit v1.2.3