Skip to content

Commit

Permalink
vagrant: add Vagrantfile to test native in FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Jul 27, 2020
1 parent 42eb044 commit 8dd2f6f
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
47 changes: 47 additions & 0 deletions dist/tools/vagrant/freebsd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# RIOT FreeBSD VM

## About
This provides a [Vagrantfile] to compile and test the RIOT [`native`][native]
platform on FreeBSD stable (12.1).

## Requirements
Make sure your system satisfies the latest version of all following dependencies:
* [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
* [VirtualBox Extension Pack](https://www.virtualbox.org/wiki/Downloads)
* [Vagrant](https://www.vagrantup.com/downloads.html)

## General usage
The following commands must be run from this directory on the host system

```
vagrant plugin install vagrant-disksize # for big enough disk
vagrant up
vagrant provision # depending on the vagrant version this might alreardy be
# executed with vagrant up
```
This will start up and set-up the virtual machine.
```
vagrant ssh
```
This logs you into the VM as vagrant user.

See the general vagrant [README.md](../README.md) for more commands.

## Inside the VM
Once logged in to the VM you can run compile and run tests e.g.

```sh
make -C tests/shell all -j
make -C tests/shell test
```

Even tests requiring network interface access should be able to work:

```sh
sudo dist/tools/tapsetup/tapsetup
make -C tests/gnrc_dhcpv6_client_6lbr all -j16
sudo make -C tests/gnrc_dhcpv6_client_6lbr test
```

[Vagrantfile]: ./Vagrantfile
[native]: https://doc.riot-os.org/group__boards__native.html
38 changes: 38 additions & 0 deletions dist/tools/vagrant/freebsd/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
$init_riot = <<-INIT_RIOT
# vim for xxd
pkg install -y bash git gmake gcc cmake afl afl++ \
python3 py37-pip py37-scipy py37-pycrypto py37-cython py37-scapy \
vim
chsh -s /usr/local/bin/bash vagrant
if ! [ -d /home/vagrant/RIOT ]; then
git clone --recurse-submodules https://github.com/RIOT-OS/RIOT /home/vagrant/RIOT
fi
chown -R vagrant: /home/vagrant/RIOT
curl https://raw.githubusercontent.com/RIOT-OS/riotdocker/master/requirements.txt \
> /tmp/requirements.txt
su - vagrant -c "pip install --user -r /tmp/requirements.txt"
# install most current pexpect to prevent async bug
su - vagrant -c "pip install --upgrade --user pexpect"
grep -q "export MAKE=gmake" /home/vagrant/.profile || \
echo "export MAKE=gmake" >> /home/vagrant/.profile
grep -q "export LINK=gcc" /home/vagrant/.profile || \
echo "export LINK=gcc" >> /home/vagrant/.profile
grep -q "export CC=gcc" /home/vagrant/.profile || \
echo "export CC=gcc" >> /home/vagrant/.profile
grep -q 'export PATH=/home/vagrant/.local/bin:${PATH}' /home/vagrant/.profile || \
echo 'export PATH=/home/vagrant/.local/bin:${PATH}' >> /home/vagrant/.profile
# make gmake default make
if ! [ -h /home/vagrant/.local/bin/make ]; then
# might not be a symlink, so remove
rm -f /home/vagrant/.local/bin/make
su - vagrant -c 'ln -s /usr/local/bin/gmake /home/vagrant/.local/bin/make'
fi
INIT_RIOT

Vagrant.configure("2") do |config|
config.vm.define "RIOT-FreeBSD"
config.vm.box = "freebsd/FreeBSD-12.1-STABLE"
config.disksize.size = '50GB'
config.vm.provision "shell",
inline: $init_riot
end

0 comments on commit 8dd2f6f

Please sign in to comment.