Skip to content
Snippets Groups Projects
Commit 7fd3f60e authored by Mikhail Novosyolov's avatar Mikhail Novosyolov
Browse files

bbb-test v0.3:

- Chromium-based browsers support
- new tabs/windows switch
- better portatibility (bash may be not /bin/bash on BSD systems, 'which' command is not POSIX-compatible)
- detect local IP via hostname command
- allow passing arguements to script in any order
- allow connecting via HTTPS
- allow setting custom sleep time
parent b75e579a
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2008-2017 by BigBlueButton Inc.
# Copyright (c) 2008-2019 by BigBlueButton Inc.
# Copyright (c) 2017-2019 by Dumalogiya (https://dumalogiya.ru)
#
# Documentation:
# http://code.google.com/p/bigbluebutton/wiki/Testing
......@@ -21,21 +22,35 @@
#
# Author(s):
# Fred Dixon <ffdixon@bigbluebutton.org>
# Mikhail Novosyolov <mikhailnov@dumalogiya.ru>
#
# Changelog:
# 2011-01-22 FFD Inital Version
# 2017-03-08 Mikhail Novosyolov, Dumalogiya online school <mikhailnov@dumalogiya.ru>, changed Firefox command line call for its new API
# 2017-03-08 Mikhail Novosyolov <mikhailnov@dumalogiya.ru>, v0.2:
# - changed Firefox command line call for its new API
# 2019-03-31 Mikhail Novosyolov <mikhailnov@dumalogiya.ru>, v0.3:
# - Chromium-based browsers support
# - new tabs/windows switch
# - better portatibility (bash may be not /bin/bash on BSD systems, 'which' command is not POSIX-compatible)
# - detect local IP via hostname command
# - allow passing arguements to script in any order
# - allow connecting via HTTPS
# - allow setting custom sleep time
VERSION=0.2
IP=$(ifconfig | grep -v '127.0.0.1' | grep -E "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" | head -1 | cut -d: -f2 | awk '{ print $1}')
VERSION=0.3
IP="$(hostname -I | cut -f1 -d' ')"
while [ $# -gt 0 ]; do
while [ -n "$1" ]; do
case $1 in
--h|-h) HOST=$2; shift 2 ;;
--n|-n) NUMBER=$2; shift 2 ;;
*) echo "$0: Unrecognized option: $1" >&2; exit 1;
--x|-x) set -x ;;
--h|-h) shift; HOST="$1" ;;
--n|-n) shift; NUMBER="$1" ;;
--b|-b) shift; BROWSER="$1" ;;
--m|-m) shift; NEWOBJ="$1" ;;
--s|-s) shift; SLEEP="$1" ;;
*) echo "$0: Unrecognized option: $1" >&2; exit 1 ;;
esac
shift
done
if [ -z "$HOST" ] || [ -z "$NUMBER" ]; then
......@@ -44,45 +59,66 @@ if [ -z "$HOST" ] || [ -z "$NUMBER" ]; then
echo "$0 [options]"
echo
echo "To launch BigBlueButton clients that connect to remote server:"
echo " -x debug mode (optional, default off)"
echo " -h remote_bigbluebutton_host"
echo " -n number_of_clients"
echo " -n number_of_clients"
echo " -b web_browser_command (optional, Firefox and Chromium/Chrome are supported, Firefox is default)"
echo " -m tab|window (Open new tabs or new windows in the browser, default is tabs)"
echo " -s Sleep time in seconds between opening new connections, default is 5"
echo
echo "Example:"
echo "Examples:"
echo " $0 -h 192.168.0.104 -n 10"
echo " $0 -h 192.168.0.104 -n 10 -b chromium-browser -m window"
echo " $0 -h https://192.168.0.104 -n 10 -b firefox -s 5"
exit 1
fi
#
# We'll use a get request to demo1.jsp to create clients
# bbb-demo must be installed on the server
#
# http://192.168.0.104/bigbluebutton/demo/demo1.jsp?username=Fred2&action=create
# HOST="http://$HOST/bigbluebutton/demo/demo1.jsp?action=create&username=user"
HOST="http://$HOST"
if ! echo "$HOST" | grep -qE '^http://|^https://'; then
HOST="http://${HOST}"
fi
BROWSER="${BROWSER:-firefox}"
NEWOBJ="${NEWOBJ:-tab}"
SLEEP="${SLEEP:-5}"
case "$BROWSER" in
firefox*|newmoon*|palemoon* )
BROWSER_ARGS="-new-${NEWOBJ} -url"
;;
*chrome*|chromium*|opera*|vivaldi*|yandex* )
BROWSER_ARGS="--new-${NEWOBJ}"
;;
esac
if ! wget $HOST/bigbluebutton/api -O - --quiet | grep -q SUCCESS; then
echo "Startup unsuccessful: could not connect to $HOST/api"
exit 1
fi
REQUIRED_CMD="wget ${BROWSER}"
for cmd in ${REQUIRED_CMD}
do
if ! command -v "$cmd" >/dev/null 2>&1; then
echo "Unable to locate ${cmd}"
exit 1
fi
done
if ! which firefox >/dev/null 2>&1; then
echo "Unable to locate firefox"
if ! wget "${HOST}/bigbluebutton/api" -O - --quiet | grep -q SUCCESS; then
echo "Startup unsuccessful: could not connect to $HOST/api"
exit 1
fi
firefox &
sleep 3
i=0
while [ $i != "$NUMBER" ]; do
echo "Connecting user $IP-$i"
firefox -new-tab -url "$HOST/demo/demo1.jsp?action=create&username=$IP-$i" &
"$BROWSER" ${BROWSER_ARGS} "$HOST/demo/demo1.jsp?action=create&username=${IP}-${i}" &
# We'll give BigBlueButton a moment to process the incoming request from this IP.
# If we try to open 10 clients at the same time, the session IDs for each client will
# likely not go to the specific tab (as thay all share the same IP address)
sleep 5
sleep "$SLEEP"
i=$[$i+1]
done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment