Re: [Maria-developers] Rev 4: Added wrapper scripts for automated runs of sql-bench
Am 29.12.2009 um 15:09 schrieb Sergei Golubchik ser...@pisem.net: Hi, Hakan! On Dec 29, Hakan Kuecuekyilmaz wrote: At file:///Users/hakan/work/monty_program/mariadb-tools/ revno: 4 revision-id: ha...@askmonty.org-20091229134253-zdbgd0ym9m7cokii parent: kniel...@knielsen-hq.org-20091218103524-nof6wfpuku60r9rn committer: Hakan Kuecuekyilmaz ha...@askmonty.org branch nick: mariadb-tools timestamp: Tue 2009-12-29 14:42:53 +0100 message: Added wrapper scripts for automated runs of sql-bench. === added directory 'sql-bench' === added file 'sql-bench/run-sql-bench.sh' --- a/sql-bench/run-sql-bench.sh1970-01-01 00:00:00 + +++ b/sql-bench/run-sql-bench.sh2009-12-29 13:42:53 + @@ -0,0 +1,236 @@ +#!/bin/bash +# +# Run sql-bench for every given configuration file +# we find in the directory $SQL_BENCH_CONFIGS. +# +# Note: Do not run this script with root privileges. +# We use killall -9, which can cause severe side effects! You can use killall -u `whoami` not perfect, but still much safer. I think that's not much safer. If run by root, then whoami will return root. I will add a simple check whether the script was started by root and if so, simply abort. Thanks for noting out this one, Hakan ___ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp
Re: [Maria-developers] Rev 4: Added wrapper scripts for automated runs of sql-bench
Sergei Golubchik ser...@pisem.net writes: On Dec 29, Hakan Kuecuekyilmaz wrote: +# Note: Do not run this script with root privileges. +# We use killall -9, which can cause severe side effects! You can use killall -u `whoami` not perfect, but still much safer. There is another, robust way to do this: Make the parent process a group leader with setpgid(0,0). Then `kill -9 -$$` will kill only the processes started from that parent (or from children, recursively). Or use setsid to create a session leader for even more robust killing (there is a setsid command available to do this within shell scripts). (You might not need this for your purpose, but I thought I would mention it in case you at some point may want to run this in Buildbot or similar). - Kristian. ___ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp
[Maria-developers] Rev 4: Added wrapper scripts for automated runs of sql-bench. in file:///Users/hakan/work/monty_program/mariadb-tools/
At file:///Users/hakan/work/monty_program/mariadb-tools/ revno: 4 revision-id: ha...@askmonty.org-20091229134253-zdbgd0ym9m7cokii parent: kniel...@knielsen-hq.org-20091218103524-nof6wfpuku60r9rn committer: Hakan Kuecuekyilmaz ha...@askmonty.org branch nick: mariadb-tools timestamp: Tue 2009-12-29 14:42:53 +0100 message: Added wrapper scripts for automated runs of sql-bench. === added directory 'sql-bench' === added file 'sql-bench/run-sql-bench.sh' --- a/sql-bench/run-sql-bench.sh1970-01-01 00:00:00 + +++ b/sql-bench/run-sql-bench.sh2009-12-29 13:42:53 + @@ -0,0 +1,236 @@ +#!/bin/bash +# +# Run sql-bench for every given configuration file +# we find in the directory $SQL_BENCH_CONFIGS. +# +# Note: Do not run this script with root privileges. +# We use killall -9, which can cause severe side effects! +# +# Hakan Kuecuekyilmaz hakan at askmonty dot org 2009-12-05. +# + +if [ $# != 2 ]; then +echo '[ERROR]: Please provide exactly two options.' +echo Example: $0 [/path/to/bzr/repository] [name_without_spaces] +echo ' [name_without_spaces] is used as identifier in the result file.' + +exit 1 +else +REPOSITORY=$1 +REPOSITORY_NAME=$2 +fi + +# +# Directories. +# +SQL_BENCH_CONFIGS='/home/hakan/sql-bench-configurations' +SQL_BENCH_RESULTS='/home/hakan/sql-bench-results' +WORK_DIR='/tmp' + +# +# Variables. +# +# We need at least 1 GB disk space in our $WORK_DIR. +SPACE_LIMIT=100 +MYSQLADMIN_OPTIONS='--no-defaults' +MACHINE=$(hostname -s) +RUN_DATE=$(date +%Y-%m-%d) + +# Timeout in seconds for waiting for mysqld to start. +TIMEOUT=100 + +# +# Binaries. +# +BZR='/usr/local/bin/bzr' +MYSQLADMIN='client/mysqladmin' + +# +# Check system. +# +# We should at least have $SPACE_LIMIT in $WORKDIR. +AVAILABLE=$(df $WORK_DIR | grep -v Filesystem | awk '{ print $4 }') + +if [ $AVAILABLE -lt $SPACE_LIMIT ]; then +echo [ERROR]: We need at least $ONE_GB space in $WORK_DIR. +echo 'Exiting.' + +exit 1 +fi + +# +# Run sql-bench. +# +for i in ${SQL_BENCH_CONFIGS}/*.inc +do +# Set configuration and check that all required parameters are set. +source $i + +if [ x$MARIADB_CONFIG == x ]; then +echo '[ERROR]: $MARIADB_CONFIG is not set.' +echo 'Exiting.' + +exit 1 +fi + +if [ x$SQLBENCH_OPTIONS == x ]; then +echo '[ERROR]: $SQLBENCH_OPTIONS is not set.' +echo 'Exiting.' + +exit 1 +fi + +if [ x$MARIADB_OPTIONS == x ]; then +echo '[ERROR]: $MARIADB_OPTIONS is not set.' +echo 'Exiting.' + +exit 1 +fi + +# Check out and compile. +REVISION_ID=$($BZR version-info $REPOSITORY | grep revision-id) +if [ $? != 0 ]; then +echo '[ERROR]: bzr version-info failed. Please provide' +echo ' a working bzr repository' +echo 'Exiting.' + +exit 1 +fi + +cd $WORK_DIR +# Clean up of previous runs +killall -9 mysqld + +TEMP_DIR=$(mktemp --directory) +if [ $? != 0 ]; then +echo [ERROR]: mktemp in $WORK_DIR failed. +echo 'Exiting.' + +exit 1 +fi + +# bzr export refuses to export to an existing directory, +# therefore we use a build directory. +echo Branching from $REPOSITORY to ${TEMP_DIR}/build + +$BZR export --format=dir ${TEMP_DIR}/build $REPOSITORY +if [ $? != 0 ]; then +echo '[ERROR]: bzr export failed.' +echo 'Exiting.' + +exit 1 +fi + +cd ${TEMP_DIR}/build +BUILD/autorun.sh +if [ $? != 0 ]; then +echo '[ERROR]: BUILD/autorun.sh failed.' +echo ' Please check your development environment.' +echo 'Exiting.' + +exit 1 +fi + +./configure $MARIADB_CONFIG +if [ $? != 0 ]; then +echo [ERROR]: ./configure $MARIADB_CONFIG failed. +echo Please check your MARIADB_CONFIG in $i. +echo 'Exiting.' + +exit 1 +fi + +make -j4 +if [ $? != 0 ]; then +echo '[ERROR]: make failed.' +echo ' Please check your build logs.' +echo 'Exiting.' + +exit 1 +fi + +# Start mysqld. +MARIADB_SOCKET=${TEMP_DIR}/mysql.sock +MARIADB_OPTIONS=$MARIADB_OPTIONS \ + --datadir=$TEMP_DIR \ + --tmpdir=$TEMP_DIR \ + --socket=$MARIADB_SOCKET + +MYSQLADMIN_OPTIONS=$MYSQLADMIN_OPTIONS \ + --socket=$MARIADB_SOCKET + +sql/mysqld $MARIADB_OPTIONS + +j=0 +STARTED=-1 +while [ $j -le $TIMEOUT ] +do +$MYSQLADMIN $MYSQLADMIN_OPTIONS -uroot ping /dev/null 21 +if [ $? = 0 ]; then +STARTED=0 + +break +fi + +sleep 1 +j=$(($j + 1)) +done + +if [ $STARTED != 0 ]; then +echo '[ERROR]: Start of mysqld failed.' +echo ' Please check your error log.' +echo 'Exiting.' + +exit 1 +fi +
Re: [Maria-developers] Rev 4: Added wrapper scripts for automated runs of sql-bench
Hi, Hakan! On Dec 29, Hakan Kuecuekyilmaz wrote: At file:///Users/hakan/work/monty_program/mariadb-tools/ revno: 4 revision-id: ha...@askmonty.org-20091229134253-zdbgd0ym9m7cokii parent: kniel...@knielsen-hq.org-20091218103524-nof6wfpuku60r9rn committer: Hakan Kuecuekyilmaz ha...@askmonty.org branch nick: mariadb-tools timestamp: Tue 2009-12-29 14:42:53 +0100 message: Added wrapper scripts for automated runs of sql-bench. === added directory 'sql-bench' === added file 'sql-bench/run-sql-bench.sh' --- a/sql-bench/run-sql-bench.sh 1970-01-01 00:00:00 + +++ b/sql-bench/run-sql-bench.sh 2009-12-29 13:42:53 + @@ -0,0 +1,236 @@ +#!/bin/bash +# +# Run sql-bench for every given configuration file +# we find in the directory $SQL_BENCH_CONFIGS. +# +# Note: Do not run this script with root privileges. +# We use killall -9, which can cause severe side effects! You can use killall -u `whoami` not perfect, but still much safer. Regards / Mit vielen Grüßen, Sergei -- __ ___ ___ __ / |/ /_ __/ __/ __ \/ / Sergei Golubchik s...@sun.com / /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect /_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028 ___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel Vorsitzender des Aufsichtsrates: Martin Häring ___ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp