Skip to content

Commit

Permalink
Just testing things
Browse files Browse the repository at this point in the history
  • Loading branch information
nurupo committed Mar 11, 2017
1 parent c1e3358 commit 0b979d9
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ matrix:
- env: JOB=toxcore ENV=windows ARCH=x86_64
services:
- docker
- env: JOB=toxcore ENV=freebsd
dist: trusty
sudo: required
fast_finish: true
allow_failures:
- env: JOB=toxcore ENV=osx RUN_TESTS=true
Expand Down
1 change: 1 addition & 0 deletions other/travis/env-freebsd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/bin/sh
142 changes: 142 additions & 0 deletions other/travis/freebsd-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/bin/bash

SCREEN_SESSION=freebsd
IMAGE_NAME=FreeBSD-11.0-RELEASE-amd64.raw
DL_URL=ftp://ftp8.us.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/11.0-RELEASE/amd64/Latest/${IMAGE_NAME}.xz
DL_SHA512="1bfdef9a106e41134cf92c5ceb7f7da468293d6611d16c0bc51482a8fb3088064204bacfe6a8b1afda169d9ab63e4bbd1c9ba1de06fe3fd604864d3fb0c07326"
SSH_PORT=10022

sudo apt-get install qemu -y

date

cd /tmp

wget $DL_URL

if ! ( echo "$DL_SHA512 $IMAGE_NAME.xz" | sha512sum -c --status - ) ; then
echo "Error: sha512 of $IMAGE_NAME.xz doesn't match the known one"
exit 1
fi

date

unxz $IMAGE_NAME.xz

date

send_keys()
{
screen -S $SCREEN_SESSION -X stuff "$1"
}

wait_for()
{
while ! grep "$1" screenlog.0 -q
do
sleep 1
done
}

ssh_run()
{
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p $SSH_PORT $@
}

free -m

# Start emulator
screen -L -S $SCREEN_SESSION -d -m qemu-system-x86_64 -curses -m 2000 -smp 2 -net user,hostfwd=tcp::${SSH_PORT}-:22 -net nic $IMAGE_NAME

# Wait for the boot screen options
wait_for "Autoboot in"

# Select the 1st option
send_keys '
'

# Wait for the system to boot and present the login prompt
wait_for "FreeBSD/amd64 ("

# Login as root user
send_keys 'root
'

cat screenlog.0

# Wait for the prompt
wait_for "root@:~"

# Configure network, ssh and start changing password
send_keys '
echo "ifconfig_em0=DHCP" >> /etc/rc.conf
'
sleep 2
send_keys '
echo "Port 22" >> /etc/ssh/sshd_config
'
sleep 2
send_keys '
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
'
sleep 2
send_keys '
echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
'
sleep 2
send_keys '
echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config
'
sleep 2
send_keys '
echo "sshd_enable=YES" >> /etc/rc.conf
'
sleep 2
send_keys '
sh /etc/rc.d/netif restart && sh /etc/rc.d/sshd start && passwd
'

# Wait for the password prompt
wait_for "Changing local password for root"

# Set password to empty
wait_for ""
send_keys '
'
wait_for "New Password"
send_keys '
'

sleep 2

date

# Update system
ssh_run freebsd-update --not-running-from-cron fetch
ssh_run freebsd-update --not-running-from-cron install

# Update package information
ssh_run env ASSUME_ALWAYS_YES=YES pkg update

# Install and set bash as the default shell for the root user
ssh_run env ASSUME_ALWAYS_YES=YES pkg install bash
ssh_run chsh -s /usr/local/bin/bash root

ssh_run uname -a

# Install required dependencies
ssh_run ASSUME_ALWAYS_YES=YES pkg install git opus libvpx libsodium gmake cmake pkgconf libcheck opencv2 portaudio libsndfile texinfo autotools

cd -

# Copy over toxcore code from Travis to qemu
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -P $SSH_PORT ./* root@localhost:~

ssh_run ls -lbh

ssh_run "cd build && cmake -DTEST_TIMEOUT_SECONDS=300 -DDEBUG=ON -DTRACE=ON .."
ssh_run "cd build && gmake"
ssh_run "cd build && export CTEST_OUTPUT_ON_FAILURE=1 gmake test"

date

0 comments on commit 0b979d9

Please sign in to comment.