vagrant: add Vagrantfile to test native in FreeBSD

This commit is contained in:
Martine S. Lenders 2020-07-07 20:21:50 +02:00 committed by Martine S. Lenders
parent 42eb044ec6
commit f9e3c0f513
No known key found for this signature in database
GPG Key ID: CCD317364F63286F
2 changed files with 108 additions and 0 deletions

70
dist/tools/vagrant/freebsd/README.md vendored Normal file
View File

@ -0,0 +1,70 @@
# 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 applications requiring network interface access should be able to work:
```sh
sudo dist/tools/tapsetup/tapsetup
make -C examples/gnrc_networking all -j16
make -C examples/gnrc_networking term
```
```
> ifconfig
ifconfig
Iface 6 HWaddr: F1:28:23:23:F1:28
L2-PDU:1500 MTU:1500 HL:64 RTR
RTR_ADV
Source address length: 6
Link type: wired
inet6 addr: fe80::f328:23ff:fe23:f128 scope: link TNT[1]
inet6 group: ff02::2
inet6 group: ff02::1
inet6 group: ff02::1:ff23:f128
Statistics for Layer 2
RX packets 5 bytes 738
TX packets 2 (Multicast: 2) bytes 78
TX succeeded 2 errors 0
Statistics for IPv6
RX packets 4 bytes 340
TX packets 2 (Multicast: 2) bytes 128
TX succeeded 2 errors 0
```
[Vagrantfile]: ./Vagrantfile
[native]: https://doc.riot-os.org/group__boards__native.html

38
dist/tools/vagrant/freebsd/Vagrantfile vendored Normal file
View File

@ -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