Skip to content

Commit

Permalink
Merge pull request hpc#29 from Alexey-Rivkin/test_on_VMs
Browse files Browse the repository at this point in the history
CI: Testing on VMs
  • Loading branch information
Alexey-Rivkin authored May 25, 2023
2 parents 61dd8b6 + cf8557d commit bbb5cef
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
57 changes: 57 additions & 0 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ stages:
workingDirectory: $(System.DefaultWorkingDirectory)/test/gtest
- stage: Build
dependsOn: Codestyle
jobs:
- job: Build
pool:
Expand Down Expand Up @@ -101,3 +102,59 @@ stages:
make
displayName: Build Ubuntu
condition: contains(variables['build_container'], 'ubuntu')
- stage: Test
dependsOn: Codestyle
jobs:
- job: Test
workspace:
clean: all
pool:
name: MLNX
demands:
- ucx_vagrant

strategy:
matrix:
centos7:
BOX_NAME: centos7
ubuntu18:
BOX_NAME: ubuntu1804
ubuntu20:
BOX_NAME: ubuntu2004
ubuntu22:
BOX_NAME: ubuntu2204

steps:
- checkout: self
clean: true
fetchDepth: 100

- bash: |
set -x
export VAGRANT_HOME=/opt/vagrant_home
vagrant up
displayName: Bring up VM
workingDirectory: $(System.DefaultWorkingDirectory)/ci/vm/
- bash: |
vagrant ssh -- -t '
cd xpmem/test/share
sudo ./run.sh
'
displayName: Old tests
workingDirectory: $(System.DefaultWorkingDirectory)/ci/vm/
- bash: |
vagrant ssh -- -t '
sudo ./xpmem/test/gtest/gtest
'
displayName: Gtest
workingDirectory: $(System.DefaultWorkingDirectory)/ci/vm/
- bash: |
vagrant destroy -f
vagrant global-status --prune
condition: always()
displayName: Bring down VM
workingDirectory: $(System.DefaultWorkingDirectory)/ci/vm/
13 changes: 13 additions & 0 deletions ci/vm/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env ruby

Vagrant.configure("2") do |config|
config.vm.box = "generic/#{ENV['BOX_NAME']}"
config.vm.provision "shell", :path => "entrypoint.sh", args: "#{ENV['BOX_NAME']} #{ENV['SYSTEM_PULLREQUEST_PULLREQUESTNUMBER']}"
config.vm.define "#{ENV['BOX_NAME']}" do |vm01|
vm01.vm.provider :libvirt do |libvirt|
vm01.vm.box_check_update = false
libvirt.memory = 8192
libvirt.cpus = 8
end
end
end
69 changes: 69 additions & 0 deletions ci/vm/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
set -Exeuo pipefail

OS=$1
PR_NUM=$2

install_packages() {
if [[ $OS == *"ubuntu"* ]]; then
apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get install -yq \
automake \
dkms \
git \
libtool &&
apt-get clean && rm -rf /var/lib/apt/lists/*
elif [[ $OS == *"centos"* ]]; then
yum install -y -q centos-release-scl
yum install -y -q \
automake \
devtoolset-8-gcc \
devtoolset-8-gcc-c++ \
elfutils-libelf-devel \
git \
libtool \
make &&
yum clean all
fi
}

xpmem_build() {
git clone -q https://github.com/openucx/xpmem.git
cd xpmem
git fetch origin pull/"$PR_NUM"/merge
git checkout FETCH_HEAD
./autogen.sh
if [[ $OS == *"ubuntu"* ]]; then
./configure --with-kerneldir=/usr/src/linux-headers-"$(uname -r)"
make -s
make check
elif [[ $OS == *"centos"* ]]; then
# Build with GCC-8
scl enable devtoolset-8 -- bash -c "
./configure --with-kerneldir=/usr/src/kernels/'$(uname -r)'
make -s
make check
"
fi
}

xpmem_load() {
sudo insmod kernel/xpmem.ko
cat /sys/module/xpmem/srcversion
modinfo kernel/xpmem.ko
if modinfo kernel/xpmem.ko | grep -qf /sys/module/xpmem/srcversion; then
echo "XPMEM loaded successfully"
else
echo "Error: Failed to load xpmem kernel module" >&2
exit 1
fi
}

err_report() {
echo "Exited with ERROR in line $1"
}
trap 'err_report $LINENO' ERR

install_packages
xpmem_build
xpmem_load

0 comments on commit bbb5cef

Please sign in to comment.