Skip to content

Adding Travis-CI which builds gateware #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ language:
compiler:
- gcc

env:
matrix:
- BOARD=atlys TARGET=base
- BOARD=atlys TARGET=hdmi2usb
- BOARD=atlys TARGET=hdmi2ethernet
- BOARD=opsis TARGET=base
- BOARD=opsis TARGET=hdmi2usb

install:
- wget -q -O- https://raw.githubusercontent.com/mithro/travis-trusty/master/setup.sh | bash
- chmod a+rx $PWD/.travis/*.sh
Expand Down
108 changes: 108 additions & 0 deletions .travis/package-xilinx-filter-strace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/usr/bin/python

import sys
import re
import os

if "--verbose" not in sys.argv:
verbose = False
def write(*args, **kw):
pass
else:
verbose = True
write = sys.stderr.write

prefix = sys.argv[-1]
prefix_re = '"(%s[^"]*)"' % prefix.replace('/', '/+')

cmds = {}
finished_cmds = {}
waiting_on = {}
files = set()

last_pid = None
for lineno, rawline in enumerate(sys.stdin.readlines()):
try:
bits = re.match(r"^(?P<pid>[0-9]+) (?P<line>.*?)(?P<unfinished> <unfinished \.\.\.>)?$", rawline)

pid = bits.group('pid')
line = bits.group('line')

if pid != last_pid:
if pid not in cmds:
if "execve" in line:
write("%08i: fork+exec, using new line %r\n" % (lineno, line))
cmds[pid] = line
else:
if last_pid in cmds:
last_command = cmds[last_pid]
else:
last_command = finished_cmds[last_pid]
write("%08i: Not a fork+exec (%r), using last line %r\n" % (lineno, line, last_command))
cmds[pid] = last_command
last_pid = pid

# Connect together lines where the kernel switched between processes
# 31093 vfork( <unfinished ...>
# 31439 execve("/opt/Xilinx/14.7/ISE_DS/ISE/bin/lin64/unwrapped/wbtc", ["/opt/Xilinx/14.7/ISE_DS/ISE/bin/"..., "-f", "/home/tansell/foss/timvideos/hdm"...], [/* 79 vars */]) = 0
# 31093 <... vfork resumed> )
unfinished = bits.group('unfinished')
assert "<unfinished ...>" not in line
if unfinished:
assert pid not in waiting_on
waiting_on[pid] = line + unfinished
continue
if "resumed>" in line:
assert pid in waiting_on
line = waiting_on[pid] + " " + line
del waiting_on[pid]

if "exited with" in line:
assert pid not in waiting_on
finished_cmds[pid] = cmds[pid]
del cmds[pid]
continue
else:
assert pid in cmds

# Command exec tracking
if "execve" in line and cmds[pid] != line:
write("%08i: Replacing %r with %r\n" % (lineno, cmds[pid], line))
cmds[pid] = line

# Did the syscall succeed?
success = "-1 ENOENT" not in line

# Does the syscall use the prefix?
bits = re.search(prefix_re, line)
if not bits:
continue

# Normalize the path
path = bits.group(1)
path = os.path.normpath(path)
if path.startswith('//'):
path = path[1:]

assert path.startswith(prefix)

# Did the file exist?
if not success:
assert not os.path.exists(path)
continue
else:
assert os.path.exists(path)

# Skip directories
if os.path.isdir(path):
continue

write("%08i: Found %r via command %r (Previously seen: %r)\n" % (lineno, path, cmds[pid], path in files))

files.add(path)
except Exception as e:
sys.stderr.write("%08i: %r %r\n" % (lineno, e, rawline))
raise

for filename in sorted(files):
print filename
61 changes: 61 additions & 0 deletions .travis/package-xilinx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

set -x
set -e

SETUP_SRC=$(realpath ${BASH_SOURCE[0]})
SETUP_DIR=$(dirname $SETUP_SRC)
TOP_DIR=$(realpath $SETUP_DIR/..)

for ARG in XILINX_PASSPHRASE_IN RACKSPACE_USER RACKSPACE_API; do
if [ -z "${!ARG}" ]; then
echo "$ARG not set"
exit 1
else
echo "$ARG='${!ARG}'"
fi
done

BASE=$TOP_DIR/build/package-xilinx
echo $BASE
mkdir -p $BASE

export PREFIX="/opt/Xilinx/"

# This is based on https://github.com/m-labs/migen/blob/master/tools/strace_tailor.sh
STRACE_LOG=$BASE/strace.log
if [ ! -f $STRACE_LOG ]; then
export PROGS=fpgalink
strace -e trace=file,process -f -o ${STRACE_LOG} bash $SETUP_DIR/run.sh
fi

STRACE_FILES=$BASE/strace.files.log
cat $STRACE_LOG | python $SETUP_DIR/package-xilinx-filter-strace.py $PREFIX > $STRACE_FILES

XILINX_DIR=$BASE/xilinx-stripped
if [ -d $XILINX_DIR ]; then
rm -rf $XILINX_DIR
fi

mkdir -p $XILINX_DIR
cat $STRACE_FILES | xargs -d '\n' \
cp --parents --no-dereference --preserve=all -t $XILINX_DIR

FILENAME="$BASE/xilinx-ise-$(git describe).tar.bz2"
echo $FILENAME
(
cd $XILINX_DIR
tar --preserve-permissions -jcvf $FILENAME opt
)
echo $XILINX_PASSPHRASE_IN | gpg --passphrase-fd 0 --cipher-algo AES256 -c $FILENAME

(
cd $BASE
TB_COMMAND="turbolift -u $RACKSPACE_USER -a $RACKSPACE_API --os-rax-auth iad upload -c xilinx"

# Upload the tar bz
$TB_COMMAND -s . --sync --pattern-match ".*\.gpg"
# Upload the index file
md5sum *.gpg | sort -k2 > index.txt
$TB_COMMAND -s index.txt
)
Loading