e25ebc8e14896467754952125b28cd4c8a914932
[osm/vim-emu.git] / devops-stages / stage-pre-test.sh
1 #!/bin/bash
2 # Copyright (c) 2015 SONATA-NFV and Paderborn University
3 # ALL RIGHTS RESERVED.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # Neither the name of the SONATA-NFV, Paderborn University
18 # nor the names of its contributors may be used to endorse or promote
19 # products derived from this software without specific prior written
20 # permission.
21 #
22 # This work has been performed in the framework of the SONATA project,
23 # funded by the European Commission under Grant number 671517 through
24 # the Horizon 2020 and 5G-PPP programmes. The authors would like to
25 # acknowledge the contributions of their colleagues of the SONATA
26 # partner consortium (www.sonata-nfv.eu).
27 #
28 # Runs the unittests of "vim-emu". Script needs to be executed inside
29 # the vim-emu Docker container by user "root". It requires the container
30 # to be started in privileged mode.
31 #
32 set -e
33 echo "vim-emu stage-pre-test.sh"
34 exit 1 # lets fail here
35
36
37
38
39 # debugging
40 echo "stage-test.sh executed inside: $(hostname)"
41 echo "stage-test.sh executed by user: $(whoami)"
42 # disable root-required test for now to play around some more.
43 echo "Stopping early."
44 exit 0
45
46 # Attention: The following needs to be done as root
47 # trigger ovs setup since container entrypoint is overwritten by Jenkins
48 service openvswitch-switch start
49 # ensure the Docker image used during the unittests is there
50 docker pull 'ubuntu:trusty'
51
52 cd /son-emu/
53 # trigger pep8 style check
54 echo "flake8 version:"
55 flake8 --version
56 echo "Doing flake8 style check ..."
57 flake8 --exclude=.eggs,devops,build,examples/charms --ignore=E501,W605,W504 .
58 echo "done."
59 # trigger the tests
60 echo "Running unit tests ..."
61 pytest -v
62 echo "done."
63
64
65