summaryrefslogtreecommitdiff
path: root/.travis/cmake-freebsd-env.sh
diff options
context:
space:
mode:
authorMaxim Biro <nurupo.contributions@gmail.com>2020-03-04 23:11:38 -0500
committerMaxim Biro <nurupo.contributions@gmail.com>2020-03-10 06:16:00 -0400
commit26fd89437bc0351df01766a69b2b475467f85ac0 (patch)
treee2560b283fdb7371e50b31ddc4af4298e28b4aee /.travis/cmake-freebsd-env.sh
parentbd7b7fadbacbb84144ed2160109befa106623d5d (diff)
Update and fix FreeBSD setup on Travis-CI
- Bump FreeBSD to 12.1. - Simplify stage1 logic. - Re-try downloading the image from a different mirror if one fails. - Use the `expect` utility instead of dealing with screen's log file. - Re-run failed toxcore test one more time and in sequence.
Diffstat (limited to '.travis/cmake-freebsd-env.sh')
-rw-r--r--.travis/cmake-freebsd-env.sh38
1 files changed, 36 insertions, 2 deletions
diff --git a/.travis/cmake-freebsd-env.sh b/.travis/cmake-freebsd-env.sh
index 8ae7e738..7d698940 100644
--- a/.travis/cmake-freebsd-env.sh
+++ b/.travis/cmake-freebsd-env.sh
@@ -1,10 +1,44 @@
1#!/bin/sh 1#!/bin/sh
2 2
3NPROC=`nproc` 3# Common variables and functions
4
5NPROC=$(nproc)
4 6
5SCREEN_SESSION=freebsd 7SCREEN_SESSION=freebsd
6SSH_PORT=10022 8SSH_PORT=10022
7 9
10FREEBSD_VERSION="12.1"
11IMAGE_NAME=FreeBSD-${FREEBSD_VERSION}-RELEASE-amd64.raw
12# https://download.freebsd.org/ftp/releases/VM-IMAGES/12.1-RELEASE/amd64/Latest/
13IMAGE_SHA512="a65da6260f5f894fc86fbe1f27dad7800906da7cffaa5077f82682ab74b6dd46c4ce87158c14b726d74ca3c6d611bea3bb336164da3f1cb990550310b110da22"
14
8RUN() { 15RUN() {
9 ssh -t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p $SSH_PORT "$@" 16 ssh -t -o ConnectionAttempts=120 -o ConnectTimeout=2 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p $SSH_PORT "$@"
17}
18
19start_vm() {
20 screen -d -m qemu-system-x86_64 -curses -m 2048 -smp $NPROC -net user,hostfwd=tcp::${SSH_PORT}-:22 -net nic "$IMAGE_NAME"
21
22 # Wait for ssh to start listening on the port
23 while ! echo "exit" | nc localhost ${SSH_PORT} | grep 'OpenSSH'; do
24 sleep 5
25 done
26
27 # Test that ssh works
28 RUN uname -a
29 RUN last
30}
31
32stop_vm()
33{
34 # Turn it off
35 # We use this contraption because for some reason `shutdown -h now` and
36 # `poweroff` result in FreeBSD not shutting down on Travis (they work on my
37 # machine though)
38 RUN "shutdown -p +5sec && sleep 30" || true
39
40 # Wait for the qemu process to terminate
41 while pgrep qemu; do
42 sleep 5
43 done
10} 44}