Hi team,
I'm in the process of creating a Vagrant file which is close to the customer's 
ENV.
It is heavilly based on Viktor's beaker task.
I use it for building and testing my code. And it is pretty important to build 
with ASAN.

Currently, what I do is:
1. Set 'ASAN_ON = 1' in rpm.mk
2. Run `make -f rpm.mk srpms` target
3. Build the RPM using `mock -q my_generated.srpm`
4. Install it

Then I've tried running `dscreate` manually or running tests with py.test.
Every time I have the same error here: 
/run/dirsrv/ns-slapd-standalone1.asan.XXXXX

    ==22487==LeakSanitizer has encountered a fatal error.
    ==22487==HINT: For debugging, try setting environment variable 
LSAN_OPTIONS=verbosity=1:log_threads=1
    ==22487==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)

I've tried setting `export LSAN_OPTIONS=verbosity=1:log_threads=1` and run once 
again.
Same issue.

Did anybody encountered the issue? Maybe, Viktor or William, could you please 
check?
I'm putting the Vagrantfile to the attachments so you can reproduce.
Just run: `ASAN=on vagrant up` from the directory with Vagrantfile.

William, I think, libvirt is present on SUSE so you should have no issues with 
this too...

Thanks,
Simon
# -*- mode: ruby -*-
# vi: set ft=ruby :

$script = <<SCRIPT
set -e
set -x

if id dirsrv >/dev/null 2>&1; then
    echo "User dirsrv already exists"
else
    echo "User dirsrv doesn't exist, adding it"
    sudo useradd -r -u 389 -s /sbin/nologin -d /usr/share/dirsrv dirsrv
fi

PIP="/usr/local/bin/pip3"
PYTHON="python3"
sudo dnf install -y "$PYTHON-devel" git make wget vim mlocate
sudo updatedb

# install pip
sudo curl -s https://bootstrap.pypa.io/get-pip.py | sudo $PYTHON

if [ ! -d "389-ds-base" ]; then
    # clone ds repo
    git clone -b "${BRANCH:-master}" 
"${REPO:-https://pagure.io/389-ds-base.git}"; 389-ds-base
fi

# checkout pull request
if [ ! -z "${PR}" ]; then
    echo "$PR"
    pushd 389-ds-base
    git config --add remote.origin.fetch "+refs/pull/*:refs/remotes/origin/pr/*"
    git fetch
    git checkout "origin/pr/$PR/head"
    popd
fi

# checkout commit
if [ ! -z "${COMMIT}" ]; then
    pushd 389-ds-base
    git fetch --unshallow
    git checkout "$COMMIT"
    popd
fi

# apply a patch
if [ ! -z "${PATCH}" ]; then
    curl -s -O "$PATCH"
    pushd 389-ds-base
    git am "../$(basename $PATCH)"
    popd
fi

# build 389-ds-base with mock
sudo dnf builddep -y 389-ds-base
sudo dnf install -y mock rpm-build
sudo usermod -a -G mock vagrant
pushd 389-ds-base
make -f rpm.mk clean

# enable ASAN
if [ ! -z "${ASAN}" ]; then
    sed -i 's/ASAN_ON = 0/ASAN_ON = 1/g' rpm.mk
fi

make -f rpm.mk srpms
SRPM=$(ls -1 dist/srpms/)
MOCKRESULT="/var/lib/mock/*/result"
mock -q "dist/srpms/$SRPM"
pushd $MOCKRESULT
gzip *log
RPM_NVRA=$(rpm -qp --qf "%{n}-%{v}-%{r}" $MOCKRESULT/*src.rpm) || true
MOCKREPO=/home/vagrant/repos/$RPM_NVRA
mkdir -p $MOCKREPO
cp -r $MOCKRESULT/* $MOCKREPO/
popd

sudo yum install -y policycoreutils-python-utils
sudo yum reinstall -y python3-setuptools python2-setuptools

sudo semanage port -a -t ldap_port_t -p tcp 38900-39299
sudo semanage port -a -t ldap_port_t -p tcp 63600-63999

# Install 389-ds-base from provided repo instead of the version from compose
pushd $MOCKREPO
sudo mv *src.rpm ../
sudo dnf install -y *rpm
popd

dscreate create-template inst.inf
sed -i 's/;root_password = Directory_Manager_Password/root_password = 
password/g' inst.inf
if [ ! -z "${SUFFIX}" ]; then
    sed -i 's/;create_suffix_entry = False/create_suffix_entry = True/g' 
inst.inf
    sed -i 's/;sample_entries = no/sample_entries = yes/g' inst.inf
    sed -i 's/;suffix =/suffix = dc=example,dc=com/g' inst.inf
fi
sudo dscreate from-file inst.inf

SCRIPT

Vagrant.configure("2") do |config|
  config.vm.box = "fedora/29-cloud-base"
  config.vm.network "private_network", type: "dhcp"

  config.vm.provision "shell", privileged: false, inline: $script, env: {
          "REPO" => ENV["REPO"],
          "BRANCH" => ENV["BRANCH"],
          "PR" => ENV["PR"],
          "COMMIT" => ENV["COMMIT"],
          "PATCH" => ENV["PATCH"],
          "ASAN" => ENV["ASAN"],
          "SUFFIX" => ENV["SUFFIX"]
  }

  config.vm.provider "libvirt" do |v|
      v.memory = 1024
      v.cpus = 2
  end

  config.vm.define "master1", primary: true do |master1|
    master1.vm.box = "fedora/29-cloud-base"
  end

  config.vm.define "master2", autostart: false do |master2|
    master2.vm.box = "fedora/29-cloud-base"
  end
  #config.vm.network "forwarded_port", guest: 8080, host: 8080
  #config.vm.network "forwarded_port", guest: 5000, host: 5000
  #config.vm.network "forwarded_port", guest: 35357, host: 35357

  #config.vm.synced_folder ".", "/vagrant"
end

Attachment: signature.asc
Description: PGP signature

_______________________________________________
389-devel mailing list -- 389-devel@lists.fedoraproject.org
To unsubscribe send an email to 389-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/389-devel@lists.fedoraproject.org

Reply via email to