source: test/do-test-build-dpdk.sh @ caf7841

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivendag_formatrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since caf7841 was caf7841, checked in by Richard Sanger <rsanger@…>, 4 years ago

Add test for building libtrace with DPDK

Checks that libtrace compiles with a number of different versions of DPDK.

  • Property mode set to 100755
File size: 3.2 KB
Line 
1#!/bin/bash
2# Checks that versions of the DPDK library compile successfully
3# Ensure that all DPDK requirements are installed on the system
4
5TEST_DIR=$(pwd)
6LIBTRACE_DIR="$TEST_DIR"/../
7DPDK_DOWNLOAD_PATH=http://wand.nz/~rjs51/dpdk/
8DOWNLOAD_DIR="$TEST_DIR"/DPDK_source
9BUILD_DIR="$TEST_DIR"/DPDK_builds
10BUILD_THREADS=9
11
12
13OK=0
14FAIL=""
15
16do_test() {
17        if "$@"; then
18                OK=$[ $OK + 1]
19        else
20                FAIL="$FAIL
21$@"
22        fi
23}
24
25# Versions to check
26declare -a dpdk_versions=(
27        "dpdk-1.7.1.tar.gz"
28        "dpdk-1.8.0.tar.gz"
29        "dpdk-2.0.0.tar.gz"
30        "dpdk-2.1.0.tar.gz"
31        "dpdk-2.2.0.tar.gz"
32        "dpdk-16.04.tar.gz"
33        "dpdk-16.07.tar.gz"
34        "dpdk-16.11.tar.gz"
35        )
36
37mkdir "$DOWNLOAD_DIR" > /dev/null 2>&1
38if [ ! -d "$DOWNLOAD_DIR" ]; then
39        echo "ERROR: Could not create download directory"
40        return 1
41fi
42cd "$DOWNLOAD_DIR"
43
44# Download versions of DPDK
45for dpdk_version in "${dpdk_versions[@]}"
46do
47        if [ ! -e "$dpdk_version" ]; then
48                wget "$DPDK_DOWNLOAD_PATH"/"$dpdk_version" > /dev/null
49                if [ $? -ne 0 ]; then
50                        echo "ERROR: Failed to download" "$dpdk_version"
51                else
52                        tar xf "$dpdk_version"
53                        if [ $? -ne 0 ]; then
54                                echo "ERROR: Failed to extract" "$dpdk_version"
55                        fi
56                fi
57        fi
58done
59
60# Build the DPDK libraries
61# We try to not overwrite these, so that a rebuild is faster
62cd "$DOWNLOAD_DIR"
63for dpdk_build in $(ls -d */)
64do
65        cd "$dpdk_build"
66        echo "Building $dpdk_build - this might take some time"
67        do_test make install T=x86_64-native-linuxapp-gcc \
68                             CONFIG_RTE_BUILD_COMBINE_LIBS=y \
69                             EXTRA_CFLAGS="-fPIC" -j $BUILD_THREADS \
70                             > build_stdout.txt 2> build_stderr.txt
71        cd ..
72done
73
74rm -r "$BUILD_DIR" > /dev/null 2>&1
75mkdir "$BUILD_DIR"
76if [ ! -d "$BUILD_DIR" ]; then
77        echo "ERROR: Could not create build directory"
78        return 1
79fi
80
81# Build libtrace against each version
82cd "$DOWNLOAD_DIR"
83for dpdk_build in $(ls -d */)
84do
85        cd "$LIBTRACE_DIR"
86        echo "Building libtrace with $dpdk_build - this may take some time"
87        export RTE_SDK="$DOWNLOAD_DIR"/"$dpdk_build"
88        export RTE_TARGET=x86_64-native-linuxapp-gcc
89
90        make clean > /dev/null 2> /dev/null
91        OUTPUT_PREFIX="$BUILD_DIR"/"$dpdk_build" 
92        rm -r "$OUTPUT_PREFIX" > /dev/null 2> /dev/null
93        mkdir "$OUTPUT_PREFIX"
94        if [ ! -d "$OUTPUT_PREFIX" ]; then
95                echo "ERROR: Could not create libtrace build directory $dpdk_build"
96                continue
97        fi
98        ./bootstrap.sh > /dev/null 2> /dev/null
99        do_test ./configure --with-dpdk --prefix="$OUTPUT_PREFIX" \
100                > "$OUTPUT_PREFIX"/conf_out.txt 2> "$OUTPUT_PREFIX"/conf_err.txt
101        do_test grep "configure: Compiled with DPDK live capture support: Yes" \
102                     "$OUTPUT_PREFIX"/conf_out.txt 
103        do_test make -j $BUILD_THREADS \
104                > "$OUTPUT_PREFIX"/make_out.txt 2> "$OUTPUT_PREFIX"/make_err.txt
105        do_test make install \
106                > "$OUTPUT_PREFIX"/install_out.txt 2> "$OUTPUT_PREFIX"/install_err.txt
107done
108
109# Check we actually included dpdk
110cd "$BUILD_DIR"
111for dpdk_build in $(ls -d */)
112do
113        cd "$BUILD_DIR"/"$dpdk_build"/bin
114        ./tracepktdump -H | grep "dpdk format module"
115        if [ $? -ne 0 ]; then
116                FAIL="$FAIL
117Failed to build $dpdk_build libtrace"
118        fi
119done
120
121echo
122echo "Tests passed: $OK"
123echo "Tests failed: $FAIL"
124if [ "$FAIL" != "" ]; then
125        echo "Some tests failed check the output logs"\
126             "conf/make/install[_err/_out].txt" \
127             "in the build directory"
128fi
Note: See TracBrowser for help on using the repository browser.