|
| 1 | +# Running Tests |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Validation scripts that are normally run when a pull request for sonic-sairedis is |
| 6 | +created can be manually run from source by following these steps. |
| 7 | + |
| 8 | +## Start with a clean build |
| 9 | + |
| 10 | +If you don't already have a build, create one. |
| 11 | + |
| 12 | +``` |
| 13 | +$ make target/sonic-vs.img.gz |
| 14 | +``` |
| 15 | + |
| 16 | +## Running the tests with make check |
| 17 | + |
| 18 | +To run these tests, do the following: |
| 19 | + |
| 20 | +In sonic-buildimage/rules/config, enable KEEP_SLAVE_ON: |
| 21 | + |
| 22 | +``` |
| 23 | +KEEP_SLAVE_ON = yes |
| 24 | +``` |
| 25 | + |
| 26 | +Then, build (do not make clean, just start a new build). In the following example, |
| 27 | +primary build is stretch-based at the time of writing: |
| 28 | + |
| 29 | +``` |
| 30 | +$ make target/sonic-vs.img.gz |
| 31 | +``` |
| 32 | + |
| 33 | +If the build complains nothing to do, remove the target |
| 34 | + |
| 35 | +``` |
| 36 | +$ make target/sonic-vs.img.gz |
| 37 | +make: 'target/sonic-vs.img.gz' is up to date. |
| 38 | +$ rm target/sonic-vs.img.gz |
| 39 | +``` |
| 40 | + |
| 41 | +and try again. |
| 42 | + |
| 43 | +The first docker you will drop into is jessie, exit that docker by typing |
| 44 | +exit at the prompt, and the build will continue with stretch: |
| 45 | + |
| 46 | +``` |
| 47 | +make: Nothing to be done for 'jessie'. |
| 48 | +user@1c34bd0395d1:/sonic$ exit |
| 49 | +exit |
| 50 | +make[1]: Leaving directory '/home/slogan/sonic2/sonic-buildimage' |
| 51 | +EXTRA_DOCKER_TARGETS=sonic-vs.img.gz BLDENV=stretch make -f Makefile.work stretch |
| 52 | +make[1]: Entering directory '/home/slogan/sonic2/sonic-buildimage' |
| 53 | +SONiC Build System |
| 54 | +... |
| 55 | +user@288feb4edd39:/sonic$ |
| 56 | +``` |
| 57 | + |
| 58 | +At this point, some debians from the build need to be installed. Copy and paste the following into |
| 59 | +a bash script, and execute to install redis, dependency libs, and enable rsyslog logging to aid |
| 60 | +in debugging test script failures. Do this in the docker, in /sonic directory (paths in the |
| 61 | +script are relative to that location): |
| 62 | + |
| 63 | +``` |
| 64 | +sudo dpkg -i target/debs/stretch/libhiredis*.deb |
| 65 | +# Install libnl3 |
| 66 | +sudo dpkg -i target/debs/stretch/libnl-3-200_*.deb |
| 67 | +sudo dpkg -i target/debs/stretch/libnl-3-dev_*.deb |
| 68 | +sudo dpkg -i target/debs/stretch/libnl-genl-3-200_*.deb |
| 69 | +sudo dpkg -i target/debs/stretch/libnl-genl-3-dev_*.deb |
| 70 | +sudo dpkg -i target/debs/stretch/libnl-route-3-200_*.deb |
| 71 | +sudo dpkg -i target/debs/stretch/libnl-route-3-dev_*.deb |
| 72 | +sudo dpkg -i target/debs/stretch/libnl-nf-3-200_*.deb |
| 73 | +sudo dpkg -i target/debs/stretch/libnl-nf-3-dev_*.deb |
| 74 | +sudo dpkg -i target/debs/stretch/libnl-cli-3-200_*.deb |
| 75 | +sudo dpkg -i target/debs/stretch/libnl-cli-3-dev_*.deb |
| 76 | +# Install common library |
| 77 | +sudo dpkg -i target/debs/stretch/libswsscommon_*.deb |
| 78 | +sudo dpkg -i target/debs/stretch/libswsscommon-dev_*.deb |
| 79 | +# Install REDIS |
| 80 | +sudo apt-get install -y liblua5.1-0 lua-bitop lua-cjson |
| 81 | +sudo dpkg -i target/debs/stretch/redis-tools_*.deb |
| 82 | +sudo dpkg -i target/debs/stretch/redis-server_*.deb |
| 83 | +sudo sed -ri 's/^# unixsocket/unixsocket/' /etc/redis/redis.conf |
| 84 | +sudo sed -ri 's/^unixsocketperm .../unixsocketperm 777/' /etc/redis/redis.conf |
| 85 | +sudo sed -ri 's/redis-server.sock/redis.sock/' /etc/redis/redis.conf |
| 86 | +sudo service redis-server start |
| 87 | +sudo service rsyslog start |
| 88 | +``` |
| 89 | + |
| 90 | +Now you can execute the tests by issuing make check. Failures will be |
| 91 | +reported to the console. |
| 92 | + |
| 93 | + |
| 94 | +``` |
| 95 | +user@288feb4edd39:/sonic$ cd src/sonic-sairedis/tests |
| 96 | +user@288feb4edd39:/sonic/src/sonic-sairedis/tests$ make check |
| 97 | +... |
| 98 | +``` |
| 99 | + |
| 100 | +Diagnosing failures can be aided by inspecting logs in /var/log/syslog |
0 commit comments