4 # Copyright(c) 2015 Neil Horman. All rights reserved.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
11 # * Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in
15 # the documentation and/or other materials provided with the
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 ABI_DIR=`mktemp -d -p /tmp ABI.XXXXXX`
36 echo "$0 <REV1> <REV2> <TARGET>"
49 echo "invalid revision: $TAG1"
54 echo "invalid revision: $TAG2"
62 echo "Must Specify REV1"
67 echo "Must Specify REV2"
72 echo "Must Specify a build target"
79 git checkout $CURRENT_BRANCH
83 # Make sure we configure SHARED libraries
84 # Also turn off IGB and KNI as those require kernel headers to build
86 sed -i -e"$ a\CONFIG_RTE_BUILD_SHARED_LIB=y" config/defconfig_$TARGET
87 sed -i -e"$ a\CONFIG_RTE_NEXT_ABI=n" config/defconfig_$TARGET
88 sed -i -e"$ a\CONFIG_RTE_EAL_IGB_UIO=n" config/defconfig_$TARGET
89 sed -i -e"$ a\CONFIG_RTE_LIBRTE_KNI=n" config/defconfig_$TARGET
90 sed -i -e"$ a\CONFIG_RTE_KNI_KMOD=n" config/defconfig_$TARGET
93 ###########################################
95 ############################################
97 #trap on ctrl-c to clean up
98 trap cleanup_and_exit SIGINT
100 if [ -z "$DPDK_MAKE_JOBS" ]
102 # This counts the number of cpus on the system
103 if [ -e /usr/bin/lscpu ]
105 DPDK_MAKE_JOBS=`lscpu -p=cpu | grep -v "#" | wc -l`
111 #Save the current branch
112 CURRENT_BRANCH=`git branch | grep \* | cut -d' ' -f2`
114 if [ -z "$CURRENT_BRANCH" ]
116 CURRENT_BRANCH=`git log --pretty=format:%H HEAD~1..HEAD`
121 export VERBOSE=/dev/stdout
123 export VERBOSE=/dev/null
126 # Validate that we have all the arguments we need
135 HASH1=$(git show -s --format=%H "$TAG1" -- 2> /dev/null | tail -1)
136 HASH2=$(git show -s --format=%H "$TAG2" -- 2> /dev/null | tail -1)
138 # Make sure our tags exist
146 # Make hashes available in output for non-local reference
147 TAG1="$TAG1 ($HASH1)"
148 TAG2="$TAG2 ($HASH2)"
150 ABICHECK=`which abi-compliance-checker 2>/dev/null`
153 log "INFO" "Cant find abi-compliance-checker utility"
157 ABIDUMP=`which abi-dumper 2>/dev/null`
160 log "INFO" "Cant find abi-dumper utility"
164 log "INFO" "We're going to check and make sure that applications built"
165 log "INFO" "against DPDK DSOs from version $TAG1 will still run when executed"
166 log "INFO" "against DPDK DSOs built from version $TAG2."
169 # Check to make sure we have a clean tree
170 git status | grep -q clean
173 log "WARN" "Working directory not clean, aborting"
177 # Move to the root of the git tree
180 log "INFO" "Checking out version $TAG1 of the dpdk"
181 # Move to the old version of the tree
186 # Checking abi compliance relies on using the dwarf information in
187 # The shared objects. Thats only included in the DSO's if we build
189 export EXTRA_CFLAGS="$EXTRA_CFLAGS -g -O0"
190 export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -g"
192 # Now configure the build
193 log "INFO" "Configuring DPDK $TAG1"
194 make config T=$TARGET O=$TARGET > $VERBOSE 2>&1
196 log "INFO" "Building DPDK $TAG1. This might take a moment"
197 make -j$DPDK_MAKE_JOBS O=$TARGET > $VERBOSE 2>&1
201 log "INFO" "THE BUILD FAILED. ABORTING"
205 # Move to the lib directory
207 log "INFO" "COLLECTING ABI INFORMATION FOR $TAG1"
210 $ABIDUMP $i -o $ABI_DIR/$i-ABI-0.dump -lver $HASH1
214 # Now clean the tree, checkout the second tag, and rebuild
217 # Move to the new version of the tree
218 log "INFO" "Checking out version $TAG2 of the dpdk"
223 # Now configure the build
224 log "INFO" "Configuring DPDK $TAG2"
225 make config T=$TARGET O=$TARGET > $VERBOSE 2>&1
227 log "INFO" "Building DPDK $TAG2. This might take a moment"
228 make -j$DPDK_MAKE_JOBS O=$TARGET > $VERBOSE 2>&1
232 log "INFO" "THE BUILD FAILED. ABORTING"
237 log "INFO" "COLLECTING ABI INFORMATION FOR $TAG2"
240 $ABIDUMP $i -o $ABI_DIR/$i-ABI-1.dump -lver $HASH2
244 # Start comparison of ABI dumps
245 for i in `ls $ABI_DIR/*-1.dump`
247 NEWNAME=`basename $i`
248 OLDNAME=`basename $i | sed -e"s/1.dump/0.dump/"`
249 LIBNAME=`basename $i | sed -e"s/-ABI-1.dump//"`
251 if [ ! -f $ABI_DIR/$OLDNAME ]
253 log "INFO" "$OLDNAME DOES NOT EXIST IN $TAG1. SKIPPING..."
256 #compare the abi dumps
257 $ABICHECK -l $LIBNAME -old $ABI_DIR/$OLDNAME -new $ABI_DIR/$NEWNAME
261 log "INFO" "ABI CHECK COMPLETE. REPORTS ARE IN compat_report directory"