mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-05-02 01:01:09 +08:00
Merge bzr merge lp:~percona-toolkit-dev/percona-toolkit/better-jenkins-test
This commit is contained in:
+40
-15
@@ -1,9 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
######################################
|
# This script is used to do a test run on a Jenkins node. Jenkins jobs
|
||||||
# Source our alt_cmds.sh for _seq(). #
|
# set env vars based on job params (like MYSQL and TEST_CMD) then execute
|
||||||
######################################
|
# this script which does the rest. When this script exists, the Jenkins
|
||||||
. lib/bash/alt_cmds.sh
|
# job exists, so if some commands (like check-dev-env) fail, then the
|
||||||
|
# Jenkins job will fail too.
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# Set modes. #
|
# Set modes. #
|
||||||
@@ -20,17 +21,42 @@ util/check-dev-env
|
|||||||
#####################################
|
#####################################
|
||||||
# Install barebones MySQL binaries. #
|
# Install barebones MySQL binaries. #
|
||||||
#####################################
|
#####################################
|
||||||
if ! [ -d "mysql-${MYSQL}-barebones" ]; then
|
|
||||||
wget -q http://hackmysql.com/mysql-${MYSQL}-barebones.tar.gz
|
if uname -a | grep x86_64 >/dev/null 2>&1; then
|
||||||
tar xvfz mysql-${MYSQL}-barebones.tar.gz
|
ARCH="64"
|
||||||
|
else
|
||||||
|
ARCH="32"
|
||||||
|
fi
|
||||||
|
|
||||||
|
MYSQL_BIN_DIR="$HOME/mysql-bin"
|
||||||
|
[ -d "$MYSQL_BIN_DIR" ] || mkdir "$MYSQL_BIN_DIR"
|
||||||
|
|
||||||
|
find_mysql_base_dir() {
|
||||||
|
find "$MYSQL_BIN_DIR" -name "mysql-$1*" -type d | tail -n 1
|
||||||
|
}
|
||||||
|
|
||||||
|
MYSQL_BASE_DIR="$(find_mysql_base_dir $MYSQL)"
|
||||||
|
if [ -z "$MYSQL_BASE_DIR" ]; then
|
||||||
|
(
|
||||||
|
cd $MYSQL_BIN_DIR
|
||||||
|
wget -q -O mysql.tar.gz http://hackmysql.com/barebones/mysql/$MYSQL/$ARCH
|
||||||
|
tar xvfz mysql.tar.gz
|
||||||
|
rm mysql.tar.gz
|
||||||
|
)
|
||||||
|
MYSQL_BASE_DIR="$(find_mysql_base_dir $MYSQL)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$("$MYSQL_BASE_DIR/bin/mysqld" -V)" ]; then
|
||||||
|
echo "$MYSQL_BASE_DIR/bin/mysqld does not execute" >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# Set required env vars. #
|
# Set required env vars. #
|
||||||
##########################
|
##########################
|
||||||
export PERCONA_TOOLKIT_BRANCH="$PWD"
|
export PERCONA_TOOLKIT_BRANCH="$PWD"
|
||||||
export PERCONA_TOOLKIT_SANDBOX="$PWD/mysql-${MYSQL}-barebones"
|
export PERCONA_TOOLKIT_SANDBOX="$MYSQL_BASE_DIR"
|
||||||
export PATH="$PATH:/usr/sbin:$PWD/mysql-${MYSQL}-barebones/bin"
|
export PATH="$PATH:/usr/sbin:$MYSQL_BASE_DIR/bin"
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
# Check and start test env. #
|
# Check and start test env. #
|
||||||
@@ -55,13 +81,12 @@ fi
|
|||||||
# Run the tests. #
|
# Run the tests. #
|
||||||
##################
|
##################
|
||||||
EXIT_STATUS=0
|
EXIT_STATUS=0
|
||||||
ITERATIONS="${ITERATIONS:-1}"
|
TEST_CMD="${TEST_CMD:-"prove -r t/"}"
|
||||||
for iter in $(_seq $ITERATIONS); do
|
|
||||||
(
|
(
|
||||||
$TEST_CMD
|
$TEST_CMD
|
||||||
)
|
)
|
||||||
EXIT_STATUS=$(($? | 0))
|
EXIT_STATUS=$(($? | 0))
|
||||||
done
|
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# Clean up. #
|
# Clean up. #
|
||||||
|
|||||||
Executable
+46
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This script makes a barebones tarball from a full MySQL binary tarball.
|
||||||
|
# A full tarball is > 150M, but a barebones is usually < 40M. The barebones
|
||||||
|
# tarballs are fetched from hackmysql.com by sandbox/jenkins-test to create
|
||||||
|
# MySQL sandboxes for testing.
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
tarball="$1"
|
||||||
|
version=$(echo $tarball | awk -F'-' '{print $2}')
|
||||||
|
full_dir=${tarball%".tar.gz"}
|
||||||
|
|
||||||
|
tar xvfz $tarball \
|
||||||
|
"$full_dir/COPYING" \
|
||||||
|
"$full_dir/README" \
|
||||||
|
"$full_dir/share/errmsg*" \
|
||||||
|
"$full_dir/share/charset*" \
|
||||||
|
"$full_dir/share/english*" \
|
||||||
|
"$full_dir/share/mysql/errmsg*" \
|
||||||
|
"$full_dir/share/mysql/charset*" \
|
||||||
|
"$full_dir/share/mysql/english*" \
|
||||||
|
"$full_dir/bin/my_print_defaults" \
|
||||||
|
"$full_dir/bin/mysql" \
|
||||||
|
"$full_dir/bin/mysqld" \
|
||||||
|
"$full_dir/bin/mysqladmin" \
|
||||||
|
"$full_dir/bin/mysqlbinlog" \
|
||||||
|
"$full_dir/bin/mysqld" \
|
||||||
|
"$full_dir/bin/mysqld_safe" \
|
||||||
|
"$full_dir/bin/safe_mysqld"
|
||||||
|
|
||||||
|
echo "This tarball was created from $tarball. It contains only the files necessary for creating a Percona Toolkit sandbox test server." > $full_dir/README.barebones
|
||||||
|
|
||||||
|
file_info=$(file "$full_dir/bin/mysqld")
|
||||||
|
if file "$full_dir/bin/mysqld" | grep -q "x86_64"; then
|
||||||
|
arch="x86_64"
|
||||||
|
else
|
||||||
|
arch="i386"
|
||||||
|
fi
|
||||||
|
|
||||||
|
bare_dir="mysql-$version-$arch-barebones"
|
||||||
|
mv $full_dir $bare_dir
|
||||||
|
tar cvfz $bare_dir.tar.gz $bare_dir
|
||||||
|
rm -rf $bare_dir
|
||||||
|
|
||||||
|
exit
|
||||||
Reference in New Issue
Block a user