From fad00f61a7ef6ce05119bef5b2181004e7882747 Mon Sep 17 00:00:00 2001 From: pranomostro Date: Fri, 23 Dec 2016 14:25:48 +0100 Subject: Removed tests, updated version number. --- tests/common | 61 ------------------------------------------------------------ 1 file changed, 61 deletions(-) delete mode 100644 tests/common (limited to 'tests/common') diff --git a/tests/common b/tests/common deleted file mode 100644 index 462677d..0000000 --- a/tests/common +++ /dev/null @@ -1,61 +0,0 @@ -BIN="$(cd ..; pwd)/ratox" -test -x $BIN || exit 1 - -echolor() { - printf '[1;3%dm%s\n' "$1" "$2" -} - -cleanup() { - echo ":: cleaning" - kill $(pgrep -f 'abduco -n test-u1') - kill $(pgrep -f 'abduco -n test-u2') - rm -rf u1 u2 -} - -trap cleanup INT - -spawn_users() { - for u in u1 u2; do - echo ":: creating user $u" - mkdir -p $u - abduco -n test-$u sh -c "cd $u;$BIN 2>&1|tee LOG" - done - sleep 1 -} - -add_friends() { - echo ":: send u2 a friend request from u1" - id1=$(cut -b-64 < u1/id) - id2=$(cut -b-64 < u2/id) - cat u2/id > u1/request/in - while [ ! -p u2/request/out/$id1 ]; do sleep 1; done - echo ":: accepting request from $id1" - echo 1 > u2/request/out/$id1 - while [ ! -d u2/$id1 ]; do sleep 1; done - echo ":: u1: waiting for u2 to come online" - while [ $(cat u1/$id2/online) -eq 0 ]; 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 -} - -send_file() { - TMP1=$(mktemp) - TMP2=$(mktemp) - /dev/null - id1=$(cut -b-64 < u1/id) - id2=$(cut -b-64 < u2/id) - echo ":: u1: sending file $TMP1" - cat $TMP1 > u1/$id2/file_in & - while [ $(wc -c $TMP2 - echo ":: verifying $TMP1 and $TMP2" - sha1sum $TMP1 | sed "s,$TMP1,$TMP2," | sha1sum -c -} -- cgit v1.2.3