David Caro has uploaded a new change for review. Change subject: Adding vdsm unit test job ......................................................................
Adding vdsm unit test job Change-Id: I15f5ab3882e266c4b446749d37d355acc3f9db9d Signed-off-by: David Caro <[email protected]> --- A jobs/confs/shell-scripts/mock_run.sh A jobs/confs/shell-scripts/vdsm_unit-tests.sh A jobs/confs/yaml/builders/mock_run.yaml A jobs/confs/yaml/jobs/vdsm/vdsm_unit-tests.yaml A jobs/confs/yaml/templates/vdsm-unit-tests.yaml 5 files changed, 223 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/jenkins refs/changes/88/34888/1 diff --git a/jobs/confs/shell-scripts/mock_run.sh b/jobs/confs/shell-scripts/mock_run.sh new file mode 100644 index 0000000..733d229 --- /dev/null +++ b/jobs/confs/shell-scripts/mock_run.sh @@ -0,0 +1,148 @@ +#!/bin/bash -xe +echo "shell-scripts/mock_run.sh" +# Do some black magic +# PARAMETERS +# +# project +# Name of the project it runs on, specifically the dir where the code +# has been cloned +# +# distro +# Distribution it should create the rpms for (usually el6, el7, fc19 or +# fc20) +# +# arch +# Architecture to build the packages for +# +# extra-packages +# List of packages to install +# +# extra-repos +# List of extra repositories to use when building, in a space separated list +# of name,url pairs +# +# env +# Extra environment variables +# +# script +# Script to run inside mock, with the jenkins/jobs/confs/shell-scripts as +# basepath +# +# copy_dirs +# Directories to copy inside the chroot + +distro="{distro}" +arch="{arch}" +copy_dirs=({copy-dirs}) +project="{project}" +extra_packages=({extra-packages}) +extra_repos=({extra-repos}) +extra_env="{env}" +script="{script}" + + +### Generate the mock configuration +pushd "$WORKSPACE"/jenkins/mock_configs +arch="{arch}" +case $distro in + fc*) distribution="fedora-${{distro#fc}}";; + el*) distribution="epel-${{distro#el}}";; + *) echo "Unknown distro $distro"; exit 1;; +esac +mock_conf="${{distribution}}-$arch-ovirt-snapshot" +mock_repos=() +for mock_repo in "${{extra_repos[@]}}"; do + mock_repos+=("--repo" "$mock_repo") +done +echo "#### Generating mock configuration" +./mock_genconfig \ + --name="$mock_conf" \ + --base="$distribution-$arch.cfg" \ + --option="basedir=$WORKSPACE/mock/" \ + "${{mock_repos[@]}}" \ +> "$mock_conf.cfg" +sudo touch /var/cache/mock/*/root_cache/cache.tar.gz || : +cat "$mock_conf.cfg" +popd + +pkg_array=() +for package in "${{packages[@]}}"; do + [[ -f "$package" ]] \ + || {{ + echo "ERROR: Package $package not found!" + exit 1 + }} +done + +## prepare the command line +my_mock="/usr/bin/mock" +my_mock+=" --configdir=$WORKSPACE/jenkins/mock_configs" +my_mock+=" --root=$mock_conf" + +## init the chroot +$my_mock \ + --init + +### Configure extra yum vars +echo "Configuring custom env variables for repo urls" +$my_mock \ + --no-clean \ + --shell <<EOF + mkdir -p /etc/yum/vars + echo "$distro" > /etc/yum/vars/distro +EOF + +## Needed when running shell on different arch than the host, because rpmdb is +## copied from it when creating the chroot and x86_64 rpmdb is not compatible on +## i686 +$my_mock \ + --no-clean \ + --shell <<EOF +rm -f /var/lib/rpm/__db* +rpm --rebuilddb +EOF + +### Install any extra packages if needed +if [[ -n "$extra_packages" ]]; then + echo "##### Installing extra dependencies: $extra_packages" + $my_mock \ + --no-clean \ + --install "${{extra_packages[@]}}" +fi + +### Make sure that the destination home dir exists +$my_mock \ + --no-clean \ + --shell <<EOFMAKINGTHISHARDTOMATCH +mkdir -p /tmp/run +EOFMAKINGTHISHARDTOMATCH + +### Copy workspace code to the chroot +[[ "$copy_dirs" ]] \ +&& {{ + for dir in "${{copy_dirs[@]}}"; do + $my_mock \ + --no-clean \ + --copyin "$dir" /tmp/run/"$dir" + done +}} +### Copy also the jenkins dir +$my_mock \ + --no-clean \ + --copyin "jenkins" /tmp/run/jenkins + +### Run the script +echo "##### Running inside mock" +$my_mock \ + --no-clean \ + --shell <<EOFMAKINGTHISHARDTOMATCH +SCRIPT="/tmp/run/jenkins/jobs/confs/shell-scripts/{script}" +export HOME=/tmp/run +cd +pwd +ls -l /tmp/run/jenkins/jobs/confs +ls -l /tmp/run/jenkins/jobs/confs/shell-scripts/ + +chmod +x \$SCRIPT +\$SCRIPT +EOFMAKINGTHISHARDTOMATCH diff --git a/jobs/confs/shell-scripts/vdsm_unit-tests.sh b/jobs/confs/shell-scripts/vdsm_unit-tests.sh new file mode 100644 index 0000000..8265794 --- /dev/null +++ b/jobs/confs/shell-scripts/vdsm_unit-tests.sh @@ -0,0 +1,25 @@ +#!/bin/bash +echo "shell-scripts/vdsm_unit-tests.sh" +# +# Runs the vdsm unit tests +# +# Paramteres +# +WORKDIR="/tmp/run/vdsm" + +pushd "$WORKDIR" +for var in ${{!GERRIT_*}}; do + export -n $var +done + +# Nose 1.3.0 and later segatult with this flag +#export NOSE_WITH_XUNIT=1 + +export NOSE_SKIP_STRESS_TESTS=1 +# disable pep8 checks on unit test, since we have seperate job on it. +export PEP8=$(which true) +export PYFLAKES=$(which true) + +sh -x autogen.sh --system +make all +make check diff --git a/jobs/confs/yaml/builders/mock_run.yaml b/jobs/confs/yaml/builders/mock_run.yaml new file mode 100644 index 0000000..0021ba7 --- /dev/null +++ b/jobs/confs/yaml/builders/mock_run.yaml @@ -0,0 +1,7 @@ +- builder: + name: mock-run + builders: + - shell: !include-raw shell-scripts/global_setup.sh + - shell: !include-raw shell-scripts/mock_setup.sh + - shell: !include-raw shell-scripts/mock_run.sh + - shell: !include-raw shell-scripts/mock_cleanup.sh diff --git a/jobs/confs/yaml/jobs/vdsm/vdsm_unit-tests.yaml b/jobs/confs/yaml/jobs/vdsm/vdsm_unit-tests.yaml new file mode 100644 index 0000000..e120c9f --- /dev/null +++ b/jobs/confs/yaml/jobs/vdsm/vdsm_unit-tests.yaml @@ -0,0 +1,20 @@ +- project: + name: vdsm_unit-tests + project: + - vdsm + trigger: + - created + version: + - master: + branch: master + extra-repos: | + ovirt-master-snapshot,http://resources.ovirt.org/pub/ovirt-master-snapshot/rpm/$distro + ovirt-master-snapshot-static,http://resources.ovirt.org/pub/ovirt-master-snapshot-static/rpm/$distro + mock-build-type: + - onlyrpm + distro: + - fc21 + arch: + - x86_64 + jobs: + - '{project}_{version}_unit-tests_{trigger}_staging' diff --git a/jobs/confs/yaml/templates/vdsm-unit-tests.yaml b/jobs/confs/yaml/templates/vdsm-unit-tests.yaml new file mode 100644 index 0000000..9ac5de4 --- /dev/null +++ b/jobs/confs/yaml/templates/vdsm-unit-tests.yaml @@ -0,0 +1,23 @@ +- job-template: + name: '{project}_{version}_unit-tests_{trigger}_staging' + parameters: + - gerrit-params: + branch: '{branch}' + scm: + - '{project}-gerrit' + - jenkins: + branch: master + triggers: + - 'on-patch-{trigger}': + project: '{project}' + branch: '{branch}' + builders: + - mock-run: + project: '{project}' + distro: '{distro}' + arch: '{arch}' + extra-packages: '{extra-packages}' + script: '{project}_unit-tests.sh' + copy-dirs: '{project}' + publishers: + - exported-artifacts -- To view, visit http://gerrit.ovirt.org/34888 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I15f5ab3882e266c4b446749d37d355acc3f9db9d Gerrit-PatchSet: 1 Gerrit-Project: jenkins Gerrit-Branch: master Gerrit-Owner: David Caro <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
