Skip to content

Instantly share code, notes, and snippets.

@heshed
Last active December 16, 2015 03:29
Show Gist options
  • Save heshed/5369651 to your computer and use it in GitHub Desktop.
Save heshed/5369651 to your computer and use it in GitHub Desktop.
funkload test, no sudo power, no network access * funkload * http://funkload.nuxeo.org/ * required packages * gnuplot 4.2 * http://www.gnuplot.info/ * python-virtualenv * http://pypi.python.org/pypi/funkload/ or http://funkload.nuxeo.org/snapshots/ * http://funkload.nuxeo.org/3dparty/ * docutils * webunit * tcpwatch * install no sudo power, no n…
#########################################################
# python funkload 설치 및 데모 시연 스크립트
# HTTP 서버의 response times, throughput
# CPU/Memory/Load/Network 레포팅을 볼 수 있다.
# robot test 또는 jenkins 와 통합이 가능하다.
# author : tech-heshed
# date : 2013.4.5
#########################################################
# Global variables
ENV_NAME='FUNKLOAD'
PREFIX_GNUPOLT=$PWD/gnuplot
VIRTUALENV=virtualenv-1.9.tar.gz
PACKAGES=packages
#########################################################
# gnuplot 4.2.0 install
function gnuplot() {
GNUPLOT=gnuplot-4.2.0.tar.gz
pushd $PACKAGES
tar xfz $GNUPLOT
pushd ${GNUPLOT%.tar.gz}
./configure --prefix=$PREFIX_GNUPOLT
make
make install
popd
popd
rm -rf ${GNUPLOT%.tar.gz}
}
#########################################################
# virtualenv extraction and make env
function virtualenv() {
ENV_OPTS='--never-download'
pushd $PACKAGES
tar xzf $VIRTUALENV
popd
# make ENV
$PYTHON $PACKAGES/${VIRTUALENV%.tar.gz}/virtualenv.py $ENV_OPTS $ENV_NAME
}
#########################################################
# set python binary path and gnuplot
function set_path() {
if [ -f $ENV_NAME/bin/activate ]; then
source $ENV_NAME/bin/activate
echo 'Virtualenv $ENV_NAME Activated!!'
fi
PYTHON=$(which python)
}
#########################################################
### setup
function install() {
# set python binary path
set_path
# install gnuplot and add to $PATH
gnuplot
# make virtual env for python
virtualenv
# reset python binary path after creating virtualenv
set_path
# install funkload libraries to python virtualenv site-packages
funkload
}
#########################################################
# test funkload
function funkload_demo() {
if [ ! -d "$ENV_NAME" ]
then
start
else
set_path
fi
# install demo and run
fl-install-demo
pushd funkload-demo/xmlrpc/
make test
make bench
popd
}
case "$1" in
install) install
;;
test) funkload_demo
;;
clean) cleanup
;;
*) echo "Usage: $0 install|clean|test"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment