From: Thomas Monjalon Date: Thu, 15 Dec 2016 21:47:44 +0000 (+0100) Subject: scripts: move to devtools X-Git-Tag: spdx-start~5201 X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=9a98f50e890b876fb6664bff36783f1afc273312 scripts: move to devtools The remaining scripts in the scripts/ directory are only useful to developers. That's why devtools/ is a better name. Signed-off-by: Thomas Monjalon Tested-by: Ferruh Yigit --- diff --git a/MAINTAINERS b/MAINTAINERS index 2e3d7211de..f2c260762d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -24,13 +24,13 @@ General Project Administration M: Thomas Monjalon T: git://dpdk.org/dpdk F: MAINTAINERS -F: scripts/check-maintainers.sh -F: scripts/check-git-log.sh -F: scripts/check-includes.sh -F: scripts/checkpatches.sh -F: scripts/git-log-fixes.sh -F: scripts/load-devel-config -F: scripts/test-build.sh +F: devtools/check-maintainers.sh +F: devtools/check-git-log.sh +F: devtools/check-includes.sh +F: devtools/checkpatches.sh +F: devtools/git-log-fixes.sh +F: devtools/load-devel-config +F: devtools/test-build.sh Stable Branches --------------- diff --git a/devtools/check-git-log.sh b/devtools/check-git-log.sh new file mode 100755 index 0000000000..f79f0a2dba --- /dev/null +++ b/devtools/check-git-log.sh @@ -0,0 +1,206 @@ +#! /bin/sh + +# BSD LICENSE +# +# Copyright 2016 6WIND S.A. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND S.A. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Check commit logs (headlines and references) +# +# If any doubt about the formatting, please check in the most recent history: +# git log --format='%>|(15)%cr %s' --reverse | grep -i + +if [ "$1" = '-h' -o "$1" = '--help' ] ; then + cat <<- END_OF_HELP + usage: $(basename $0) [-h] [range] + + Check commit log formatting. + The git range can be specified as a "git log" option, + e.g. -1 to check only the latest commit. + The default range starts from origin/master to HEAD. + END_OF_HELP + exit +fi + +selfdir=$(dirname $(readlink -e $0)) +range=${1:-origin/master..} +# convert -N to HEAD~N.. in order to comply with git-log-fixes.sh getopts +if printf -- $range | grep -q '^-[0-9]\+' ; then + range="HEAD$(printf -- $range | sed 's,^-,~,').." +fi + +commits=$(git log --format='%h' --reverse $range) +headlines=$(git log --format='%s' --reverse $range) +bodylines=$(git log --format='%b' --reverse $range) +fixes=$(git log --format='%h %s' --reverse $range | grep -i ': *fix' | cut -d' ' -f1) +stablefixes=$($selfdir/git-log-fixes.sh $range | sed '/(N\/A)$/d' | cut -d' ' -f2) +tags=$(git log --format='%b' --reverse $range | grep -i -e 'by *:' -e 'fix.*:') +bytag='\(Reported\|Suggested\|Signed-off\|Acked\|Reviewed\|Tested\)-by:' + +# check headline format (spacing, no punctuation, no code) +bad=$(echo "$headlines" | grep --color=always \ + -e ' ' \ + -e '^ ' \ + -e ' $' \ + -e '\.$' \ + -e '[,;!?&|]' \ + -e ':.*_' \ + -e '^[^:]\+$' \ + -e ':[^ ]' \ + -e ' :' \ + | sed 's,^,\t,') +[ -z "$bad" ] || printf "Wrong headline format:\n$bad\n" + +# check headline prefix when touching only drivers, e.g. net/ +bad=$(for commit in $commits ; do + headline=$(git log --format='%s' -1 $commit) + files=$(git diff-tree --no-commit-id --name-only -r $commit) + [ -z "$(echo "$files" | grep -v '^\(drivers\|doc\|config\)/')" ] || + continue + drv=$(echo "$files" | grep '^drivers/' | cut -d "/" -f 2,3 | sort -u) + drvgrp=$(echo "$drv" | cut -d "/" -f 1 | uniq) + if [ $(echo "$drvgrp" | wc -l) -gt 1 ] ; then + echo "$headline" | grep -v '^drivers:' + elif [ $(echo "$drv" | wc -l) -gt 1 ] ; then + echo "$headline" | grep -v "^$drvgrp" + else + echo "$headline" | grep -v "^$drv" + fi +done | sed 's,^,\t,') +[ -z "$bad" ] || printf "Wrong headline prefix:\n$bad\n" + +# check headline label for common typos +bad=$(echo "$headlines" | grep --color=always \ + -e '^example[:/]' \ + -e '^apps/' \ + -e '^testpmd' \ + -e 'test-pmd' \ + -e '^bond:' \ + | sed 's,^,\t,') +[ -z "$bad" ] || printf "Wrong headline label:\n$bad\n" + +# check headline lowercase for first words +bad=$(echo "$headlines" | grep --color=always \ + -e '^.*[A-Z].*:' \ + -e ': *[A-Z]' \ + | sed 's,^,\t,') +[ -z "$bad" ] || printf "Wrong headline uppercase:\n$bad\n" + +# check headline uppercase (Rx/Tx, VF, L2, MAC, Linux, ARM...) +bad=$(echo "$headlines" | grep -E --color=always \ + -e '\<(rx|tx|RX|TX)\>' \ + -e '\<[pv]f\>' \ + -e '\<[hsf]w\>' \ + -e '\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + -e ':.*\' \ + | sed 's,^,\t,') +[ -z "$bad" ] || printf "Wrong headline lowercase:\n$bad\n" + +# special case check for VMDq to give good error message +bad=$(echo "$headlines" | grep -E --color=always \ + -e '\<(vmdq|VMDQ)\>' \ + | sed 's,^,\t,') +[ -z "$bad" ] || printf "Wrong headline capitalization, use 'VMDq':\n$bad\n" + +# check headline length (60 max) +bad=$(echo "$headlines" | + awk 'length>60 {print}' | + sed 's,^,\t,') +[ -z "$bad" ] || printf "Headline too long:\n$bad\n" + +# check body lines length (75 max) +bad=$(echo "$bodylines" | grep -v '^Fixes:' | + awk 'length>75 {print}' | + sed 's,^,\t,') +[ -z "$bad" ] || printf "Line too long:\n$bad\n" + +# check starting commit message with "It" +bad=$(for commit in $commits ; do + firstbodyline=$(git log --format='%b' -1 $commit | head -n1) + echo "$firstbodyline" | grep --color=always -ie '^It ' +done | sed 's,^,\t,') +[ -z "$bad" ] || printf "Wrong beginning of commit message:\n$bad\n" + +# check tags spelling +bad=$(echo "$tags" | + grep -v "^$bytag [^,]* <.*@.*>$" | + grep -v '^Fixes: [0-9a-f]\{7\}[0-9a-f]* (".*")$' | + sed 's,^.,\t&,') +[ -z "$bad" ] || printf "Wrong tag:\n$bad\n" + +# check blank line after last Fixes: tag +bad=$(echo "$bodylines" | + sed -n 'N;/\nFixes:/D;/\n$/D;/^Fixes:/P' | + sed 's,^.,\t&,') +[ -z "$bad" ] || printf "Missing blank line after 'Fixes' tag:\n$bad\n" + +# check missing Fixes: tag +bad=$(for fix in $fixes ; do + git log --format='%b' -1 $fix | grep -q '^Fixes: ' || + git log --format='\t%s' -1 $fix +done) +[ -z "$bad" ] || printf "Missing 'Fixes' tag:\n$bad\n" + +# check Fixes: reference +IFS=' +' +fixtags=$(echo "$tags" | grep '^Fixes: ') +bad=$(for fixtag in $fixtags ; do + hash=$(echo "$fixtag" | sed 's,^Fixes: \([0-9a-f]*\).*,\1,') + if git branch --contains $hash 2>&- | grep -q '^\*' ; then + good="Fixes: $hash "$(git log --format='("%s")' -1 $hash 2>&-) + else + good="reference not in current branch" + fi + printf "$fixtag" | grep -v "^$good$" +done | sed 's,^,\t,') +[ -z "$bad" ] || printf "Wrong 'Fixes' reference:\n$bad\n" + +# check CC:stable for fixes +bad=$(for fix in $stablefixes ; do + git log --format='%b' -1 $fix | grep -qi '^CC: *stable@dpdk.org' || + git log --format='\t%s' -1 $fix +done) +[ -z "$bad" ] || printf "Should CC: stable@dpdk.org\n$bad\n" diff --git a/devtools/check-includes.sh b/devtools/check-includes.sh new file mode 100755 index 0000000000..d65adc6db3 --- /dev/null +++ b/devtools/check-includes.sh @@ -0,0 +1,286 @@ +#!/bin/sh -e +# +# BSD LICENSE +# +# Copyright 2016 6WIND S.A. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND S.A. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# This script checks that header files in a given directory do not miss +# dependencies when included on their own, do not conflict and accept being +# compiled with the strictest possible flags. +# +# Files are looked up in the directory provided as the first argument, +# otherwise build/include by default. +# +# Recognized environment variables: +# +# VERBOSE=1 is the same as -v. +# +# QUIET=1 is the same as -q. +# +# SUMMARY=1 is the same as -s. +# +# CC, CPPFLAGS, CFLAGS, EXTRA_CPPFLAGS, EXTRA_CFLAGS, CXX, CXXFLAGS and +# EXTRA_CXXFLAGS are taken into account. +# +# PEDANTIC_CFLAGS, PEDANTIC_CXXFLAGS and PEDANTIC_CPPFLAGS provide strict +# C/C++ compilation flags. +# +# IGNORE contains a list of shell patterns matching files (relative to the +# include directory) to avoid. It is set by default to known DPDK headers +# which must not be included on their own. +# +# IGNORE_CXX provides additional files for C++. + +while getopts hqvs arg; do + case $arg in + h) + cat < /dev/null + +[ "$VERBOSE" = 1 ] && +output () +{ + local CCV + local CXXV + + shift + CCV=$CC + CXXV=$CXX + CC="echo $CC" CXX="echo $CXX" "$@" + CC=$CCV + CXX=$CXXV + + "$@" +} || +output () +{ + + printf ' %s\n' "$1" + shift + "$@" +} + +trap 'rm -f "$temp_cc" "$temp_cxx"' EXIT + +compile_cc () +{ + ${CC} -I"$include_dir" \ + ${PEDANTIC_CPPFLAGS} ${CPPFLAGS} ${EXTRA_CPPFLAGS} \ + ${PEDANTIC_CFLAGS} ${CFLAGS} ${EXTRA_CFLAGS} \ + -c -o /dev/null "${temp_cc}" +} + +compile_cxx () +{ + ${CXX} -I"$include_dir" \ + ${PEDANTIC_CPPFLAGS} ${CPPFLAGS} ${EXTRA_CPPFLAGS} \ + ${PEDANTIC_CXXFLAGS} ${CXXFLAGS} ${EXTRA_CXXFLAGS} \ + -c -o /dev/null "${temp_cxx}" +} + +ignore () +{ + file="$1" + shift + while [ $# -ne 0 ]; do + case "$file" in + $1) + return 0 + ;; + esac + shift + done + return 1 +} + +# Check C/C++ compilation for each header file. + +while read -r path +do + file=${path#$include_dir} + file=${file##/} + if ignore "$file" $IGNORE; then + output "SKIP $file" : + continue + fi + if printf "\ +#include <%s> + +int main(void) +{ + return 0; +} +" "$file" > "$temp_cc" && + output "CC $file" compile_cc + then + pass_cc="$pass_cc $file" + else + failures_cc=$(($failures_cc + 1)) + fi + if ignore "$file" $IGNORE_CXX; then + output "SKIP CXX $file" : + continue + fi + if printf "\ +#include <%s> + +int main() +{ +} +" "$file" > "$temp_cxx" && + output "CXX $file" compile_cxx + then + pass_cxx="$pass_cxx $file" + else + failures_cxx=$(($failures_cxx + 1)) + fi +done < "$temp_cc" && +for file in $pass_cc; do + printf "\ +#include <%s> +" "$file" >> $temp_cc +done +if printf "\ +int main(void) +{ + return 0; +} +" >> "$temp_cc" && + output "CC (all includes that did not fail)" compile_cc +then + : +else + failures_cc=$(($failures_cc + 1)) +fi + +# Check C++ compilation with all includes. + +: > "$temp_cxx" && +for file in $pass_cxx; do + printf "\ +#include <%s> +" "$file" >> $temp_cxx +done +if printf "\ +int main() +{ +} +" >> "$temp_cxx" && + output "CXX (all includes that did not fail)" compile_cxx +then + : +else + failures_cxx=$(($failures_cxx + 1)) +fi + +# Report results. + +if [ "$SUMMARY" = 1 ]; then + printf "\ +Summary: + %u failure(s) for C using '%s'. + %u failure(s) for C++ using '%s'. +" $failures_cc "$CC" $failures_cxx "$CXX" 1>&2 +fi + +# Exit with nonzero status if there are failures. + +[ $failures_cc -eq 0 ] && +[ $failures_cxx -eq 0 ] diff --git a/devtools/check-maintainers.sh b/devtools/check-maintainers.sh new file mode 100755 index 0000000000..69c879a824 --- /dev/null +++ b/devtools/check-maintainers.sh @@ -0,0 +1,157 @@ +#! /bin/sh + +# BSD LICENSE +# +# Copyright 2015 6WIND S.A. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND S.A. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Do some basic checks in MAINTAINERS file + +cd $(dirname $0)/.. + +# Get files matching paths with wildcards and / meaning recursing +files () # [ ...] +{ + if [ -z "$1" ] ; then + return + fi + if [ -d .git ] ; then + git ls-files "$1" + else + find "$1" -type f | + sed 's,^\./,,' + fi | + # if not ended by / + if ! echo "$1" | grep -q '/[[:space:]]*$' ; then + # filter out deeper directories + sed "/\(\/[^/]*\)\{$(($(echo "$1" | grep -o / | wc -l) + 1))\}/d" + else + cat + fi + # next path + shift + files "$@" +} + +# Get all files matching F: and X: fields +parse_fx () # +{ + IFS=' +' + # parse each line excepted underlining + for line in $( (sed '/^-\+$/d' $1 ; echo) | sed 's,^$,§,') ; do + if echo "$line" | grep -q '^§$' ; then + # empty line delimit end of section + whitelist=$(files $flines) + blacklist=$(files $xlines) + match=$(aminusb "$whitelist" "$blacklist") + if [ -n "$whitelist" ] ; then + printf "# $title " + maintainers=$(echo "$maintainers" | sed -r 's,.*<(.*)>.*,\1,') + maintainers=$(printf "$maintainers" | sed -e 's,^,<,' -e 's,$,>,') + echo $maintainers + fi + if [ -n "$match" ] ; then + echo "$match" + fi + # flush section + unset maintainers + unset flines + unset xlines + elif echo "$line" | grep -q '^[A-Z]: ' ; then + # maintainer + maintainers=$(add_line_to_if "$line" "$maintainers" 'M: ') + # file matching pattern + flines=$(add_line_to_if "$line" "$flines" 'F: ') + # file exclusion pattern + xlines=$(add_line_to_if "$line" "$xlines" 'X: ') + else # assume it is a title + title="$line" + fi + done +} + +# Check patterns in F: and X: +check_fx () # +{ + IFS=' +' + for line in $(sed -n 's,^[FX]: ,,p' $1 | tr '*' '#') ; do + line=$(printf "$line" | tr '#' '*') + match=$(files "$line") + if [ -z "$match" ] ; then + echo "$line" + fi + done +} + +# Add a line to a set of lines if it begins with right pattern +add_line_to_if () # +{ + ( + echo "$2" + echo "$1" | sed -rn "s,^$3(.*),\1,p" + ) | + sed '/^$/d' +} + +# Subtract two sets of lines +aminusb () # +{ + printf "$1\n$2\n$2" | sort | uniq -u | sed '/^$/d' +} + +printf 'sections: ' +parsed=$(parse_fx MAINTAINERS) +echo "$parsed" | grep -c '^#' +printf 'with maintainer: ' +echo "$parsed" | grep -c '^#.*@' +printf 'maintainers: ' +grep '^M:.*<' MAINTAINERS | sort -u | wc -l + +echo +echo '##########' +echo '# orphan areas' +echo '##########' +echo "$parsed" | sed -rn 's,^#([^@]*)$,\1,p' | uniq + +echo +echo '##########' +echo '# files not listed' +echo '##########' +all=$(files ./) +listed=$(echo "$parsed" | sed '/^#/d' | sort -u) +aminusb "$all" "$listed" + +echo +echo '##########' +echo '# wrong patterns' +echo '##########' +check_fx MAINTAINERS + +# TODO: check overlaps diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh new file mode 100755 index 0000000000..cfe262bec4 --- /dev/null +++ b/devtools/checkpatches.sh @@ -0,0 +1,134 @@ +#! /bin/sh + +# BSD LICENSE +# +# Copyright 2015 6WIND S.A. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND S.A. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Load config options: +# - DPDK_CHECKPATCH_PATH +# - DPDK_CHECKPATCH_LINE_LENGTH +. $(dirname $(readlink -e $0))/load-devel-config + +length=${DPDK_CHECKPATCH_LINE_LENGTH:-80} + +# override default Linux options +options="--no-tree" +options="$options --max-line-length=$length" +options="$options --show-types" +options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\ +VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\ +PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\ +SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\ +NEW_TYPEDEFS,COMPARISON_TO_NULL" + +print_usage () { + cat <<- END_OF_HELP + usage: $(basename $0) [-q] [-v] [-nX|patch1 [patch2] ...]] + + Run Linux kernel checkpatch.pl with DPDK options. + The environment variable DPDK_CHECKPATCH_PATH must be set. + + The patches to check can be from stdin, files specified on the command line, + or latest git commits limited with -n option (default limit: origin/master). + END_OF_HELP +} + +number=0 +quiet=false +verbose=false +while getopts hn:qv ARG ; do + case $ARG in + n ) number=$OPTARG ;; + q ) quiet=true ;; + v ) verbose=true ;; + h ) print_usage ; exit 0 ;; + ? ) print_usage ; exit 1 ;; + esac +done +shift $(($OPTIND - 1)) + +if [ ! -x "$DPDK_CHECKPATCH_PATH" ] ; then + print_usage >&2 + echo + echo 'Cannot execute DPDK_CHECKPATCH_PATH' >&2 + exit 1 +fi + +total=0 +status=0 + +check () { # + total=$(($total + 1)) + ! $verbose || printf '\n### %s\n\n' "$3" + if [ -n "$1" ] ; then + report=$($DPDK_CHECKPATCH_PATH $options "$1" 2>/dev/null) + elif [ -n "$2" ] ; then + report=$(git format-patch --no-stat --stdout -1 $commit | + $DPDK_CHECKPATCH_PATH $options - 2>/dev/null) + else + report=$($DPDK_CHECKPATCH_PATH $options - 2>/dev/null) + fi + [ $? -ne 0 ] || return 0 + $verbose || printf '\n### %s\n\n' "$3" + printf '%s\n' "$report" | sed -n '1,/^total:.*lines checked$/p' + status=$(($status + 1)) +} + +if [ -n "$1" ] ; then + for patch in "$@" ; do + # Subject can be on 2 lines + subject=$(sed '/^Subject: */!d;s///;N;s,\n[[:space:]]\+, ,;s,\n.*,,;q' "$patch") + check "$patch" '' "$subject" + done +elif [ ! -t 0 ] ; then # stdin + subject=$(while read header value ; do + if [ "$header" = 'Subject:' ] ; then + IFS= read next + continuation=$(echo "$next" | sed -n 's,^[[:space:]]\+, ,p') + echo $value$continuation + break + fi + done) + check '' '' "$subject" +else + if [ $number -eq 0 ] ; then + commits=$(git rev-list --reverse origin/master..) + else + commits=$(git rev-list --reverse --max-count=$number HEAD) + fi + for commit in $commits ; do + subject=$(git log --format='%s' -1 $commit) + check '' $commit "$subject" + done +fi +pass=$(($total - $status)) +$quiet || printf '\n%d/%d valid patch' $pass $total +$quiet || [ $pass -le 1 ] || printf 'es' +$quiet || printf '\n' +exit $status diff --git a/devtools/cocci.sh b/devtools/cocci.sh new file mode 100755 index 0000000000..4ca5025f78 --- /dev/null +++ b/devtools/cocci.sh @@ -0,0 +1,64 @@ +#! /bin/sh + +# BSD LICENSE +# +# Copyright 2015 EZchip Semiconductor Ltd. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of EZchip Semiconductor nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Apply coccinelle transforms. + +SRCTREE=$(readlink -f $(dirname $0)/..) +COCCI=$SRCTREE/devtools/cocci +[ -n "$SPATCH" ] || SPATCH=$(which spatch) + +PATCH_LIST="$@" +[ -n "$PATCH_LIST" ] || PATCH_LIST=$(echo $COCCI/*.cocci) + +[ -x "$SPATCH" ] || ( + echo "Coccinelle tools not installed." + exit 1 +) + +tmp=$(mktemp) + +for c in $PATCH_LIST; do + while true; do + echo -n "Applying $c..." + $SPATCH --sp-file $c -c --linux-spacing --very-quiet \ + --include-headers --preprocess \ + --in-place --dir $SRCTREE > $tmp + if [ -s $tmp ]; then + echo " changes applied, retrying." + else + echo " no change." + break; + fi + done +done + +rm -f $tmp diff --git a/devtools/cocci/mtod-offset.cocci b/devtools/cocci/mtod-offset.cocci new file mode 100644 index 0000000000..13134e9dff --- /dev/null +++ b/devtools/cocci/mtod-offset.cocci @@ -0,0 +1,76 @@ +// +// Replace explicit packet offset computations with rte_pktmbuf_mtod_offset(). +// +@disable paren@ +typedef uint8_t; +expression M, O; +@@ +( +- rte_pktmbuf_mtod(M, char *) + O ++ rte_pktmbuf_mtod_offset(M, char *, O) +| +- rte_pktmbuf_mtod(M, char *) - O ++ rte_pktmbuf_mtod_offset(M, char *, -O) +| +- rte_pktmbuf_mtod(M, unsigned char *) + O ++ rte_pktmbuf_mtod_offset(M, unsigned char *, O) +| +- rte_pktmbuf_mtod(M, unsigned char *) - O ++ rte_pktmbuf_mtod_offset(M, unsigned char *, -O) +| +- rte_pktmbuf_mtod(M, uint8_t *) + O ++ rte_pktmbuf_mtod_offset(M, uint8_t *, O) +| +- rte_pktmbuf_mtod(M, uint8_t *) - O ++ rte_pktmbuf_mtod_offset(M, uint8_t *, -O) +) + + +// +// Fold subsequent offset terms into pre-existing offset used in +// rte_pktmbuf_mtod_offset(). +// +@disable paren@ +expression M, O1, O2; +@@ +( +- rte_pktmbuf_mtod_offset(M, char *, O1) + O2 ++ rte_pktmbuf_mtod_offset(M, char *, O1 + O2) +| +- rte_pktmbuf_mtod_offset(M, char *, O1) - O2 ++ rte_pktmbuf_mtod_offset(M, char *, O1 - O2) +| +- rte_pktmbuf_mtod_offset(M, unsigned char *, O1) + O2 ++ rte_pktmbuf_mtod_offset(M, unsigned char *, O1 + O2) +| +- rte_pktmbuf_mtod_offset(M, unsigned char *, O1) - O2 ++ rte_pktmbuf_mtod_offset(M, unsigned char *, O1 - O2) +| +- rte_pktmbuf_mtod_offset(M, uint8_t *, O1) + O2 ++ rte_pktmbuf_mtod_offset(M, uint8_t *, O1 + O2) +| +- rte_pktmbuf_mtod_offset(M, uint8_t *, O1) - O2 ++ rte_pktmbuf_mtod_offset(M, uint8_t *, O1 - O2) +) + + +// +// Cleanup rules. Fold in double casts, remove unnecessary paranthesis, etc. +// +@disable paren@ +expression M, O; +type C, T; +@@ +( +- (C)rte_pktmbuf_mtod_offset(M, T, O) ++ rte_pktmbuf_mtod_offset(M, C, O) +| +- (rte_pktmbuf_mtod_offset(M, T, O)) ++ rte_pktmbuf_mtod_offset(M, T, O) +| +- (C)rte_pktmbuf_mtod(M, T) ++ rte_pktmbuf_mtod(M, C) +| +- (rte_pktmbuf_mtod(M, T)) ++ rte_pktmbuf_mtod(M, T) +) diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh new file mode 100755 index 0000000000..4824c7f7ce --- /dev/null +++ b/devtools/git-log-fixes.sh @@ -0,0 +1,120 @@ +#! /bin/sh -e + +# BSD LICENSE +# +# Copyright 2016 6WIND S.A. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND S.A. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +print_usage () +{ + echo "usage: $(basename $0) [-h] <git_range>" +} + +print_help () +{ + print_usage + cat <<- END_OF_HELP + + Find fixes to backport on previous versions. + It looks for the word "fix" in the headline or a tag "Fixes" or "Reverts". + The oldest bug origin is printed as well as partially fixed versions. + END_OF_HELP +} + +usage_error () # <message> +{ + echo "$*" >&2 + print_usage >&2 + exit 1 +} + +while getopts h ARG ; do + case $ARG in + h ) print_help ; exit 0 ;; + ? ) print_usage >&2 ; exit 1 ;; + esac +done +shift $(($OPTIND - 1)) +[ $# -ge 1 ] || usage_error 'range argument required' +range="$*" + +# get major release version of a commit +commit_version () # <hash> +{ + tag=$(git tag -l --contains $1 | head -n1) + if [ -z "$tag" ] ; then + # before -rc1 tag of release in progress + make showversion | cut -d'.' -f-2 + else + echo $tag | sed 's,^v,,' | sed 's,-rc.*,,' + fi +} + +# get bug origin hashes of a fix +origin_filter () # <hash> +{ + git log --format='%b' -1 $1 | + sed -n 's,^ *\([Ff]ixes\|[Rr]everts\): *\([0-9a-f]*\).*,\2,p' +} + +# get oldest major release version of bug origins +origin_version () # <origin_hash> ... +{ + for origin in $* ; do + # check hash is valid + git rev-parse -q --verify $1 >&- || continue + # get version of this bug origin + local origver=$(commit_version $origin) + local roothashes=$(origin_filter $origin) + if [ -n "$roothashes" ] ; then + # look chained fix of fix recursively + local rootver="$(origin_version $roothashes)" + [ -n "$rootver" ] || continue + echo "$rootver (partially fixed in $origver)" + else + echo "$origver" + fi + # filter the oldest origin + done | sort -uV | head -n1 +} + +git log --oneline --reverse $range | +while read id headline ; do + origins=$(origin_filter $id) + [ -n "$origins" ] || echo "$headline" | grep -q fix || continue + version=$(commit_version $id) + if [ -n "$origins" ] ; then + origver="$(origin_version $origins)" + [ -n "$origver" ] || continue + # ignore fix of bug introduced in the same release + ! echo "$origver" | grep -q "^$version" || continue + else + origver='N/A' + fi + printf '%s %7s %s (%s)\n' $version $id "$headline" "$origver" +done diff --git a/devtools/load-devel-config b/devtools/load-devel-config new file mode 100644 index 0000000000..4f43cb3523 --- /dev/null +++ b/devtools/load-devel-config @@ -0,0 +1,12 @@ +# Load DPDK devel config and allow override +# from system file +test ! -r /etc/dpdk/devel.config || + . /etc/dpdk/devel.config +# from user file +test ! -r ~/.config/dpdk/devel.config || + . ~/.config/dpdk/devel.config +# from local file +test ! -r $(dirname $(readlink -m $0))/../.develconfig || + . $(dirname $(readlink -m $0))/../.develconfig + +# The config files must export variables in the shell style diff --git a/devtools/test-build.sh b/devtools/test-build.sh new file mode 100755 index 0000000000..a979309717 --- /dev/null +++ b/devtools/test-build.sh @@ -0,0 +1,253 @@ +#! /bin/sh -e + +# BSD LICENSE +# +# Copyright 2015 6WIND S.A. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND S.A. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +default_path=$PATH + +# Load config options: +# - AESNI_MULTI_BUFFER_LIB_PATH +# - DPDK_BUILD_TEST_CONFIGS (defconfig1+option1+option2 defconfig2) +# - DPDK_DEP_ARCHIVE +# - DPDK_DEP_CFLAGS +# - DPDK_DEP_LDFLAGS +# - DPDK_DEP_MOFED (y/[n]) +# - DPDK_DEP_NUMA (y/[n]) +# - DPDK_DEP_PCAP (y/[n]) +# - DPDK_DEP_SSL (y/[n]) +# - DPDK_DEP_SZE (y/[n]) +# - DPDK_DEP_ZLIB (y/[n]) +# - DPDK_MAKE_JOBS (int) +# - DPDK_NOTIFY (notify-send) +# - LIBSSO_SNOW3G_PATH +# - LIBSSO_KASUMI_PATH +# - LIBSSO_ZUC_PATH +. $(dirname $(readlink -e $0))/load-devel-config + +print_usage () { + echo "usage: $(basename $0) [-h] [-jX] [-s] [config1 [config2] ...]]" +} + +print_help () { + echo 'Test building several targets with different options' + echo + print_usage + cat <<- END_OF_HELP + + options: + -h this help + -jX use X parallel jobs in "make" + -s short test with only first config without examples/doc + -v verbose build + + config: defconfig[[~][+]option1[[~][+]option2...]] + Example: x86_64-native-linuxapp-gcc+debug~RXTX_CALLBACKS + The lowercase options are defined inside $(basename $0). + The uppercase options can be the end of a defconfig option + to enable if prefixed with '+' or to disable if prefixed with '~'. + Default is to automatically enable most of the options. + The external dependencies are setup with DPDK_DEP_* variables. + If no config on command line, DPDK_BUILD_TEST_CONFIGS is used. + END_OF_HELP +} + +J=$DPDK_MAKE_JOBS +short=false +unset verbose +maxerr=-Wfatal-errors +while getopts hj:sv ARG ; do + case $ARG in + j ) J=$OPTARG ;; + s ) short=true ;; + v ) verbose='V=1' ;; + h ) print_help ; exit 0 ;; + ? ) print_usage ; exit 1 ;; + esac +done +shift $(($OPTIND - 1)) +configs=${*:-$DPDK_BUILD_TEST_CONFIGS} + +success=false +on_exit () +{ + if $success ; then + [ "$DPDK_NOTIFY" != notify-send ] || \ + notify-send -u low --icon=dialog-information 'DPDK build' 'finished' + elif [ -z "$signal" ] ; then + [ -z "$dir" ] || echo "failed to build $dir" >&2 + [ "$DPDK_NOTIFY" != notify-send ] || \ + notify-send -u low --icon=dialog-error 'DPDK build' 'failed' + fi +} +# catch manual interrupt to ignore notification +trap "signal=INT ; trap - INT ; kill -INT $$" INT +# notify result on exit +trap on_exit EXIT + +cd $(dirname $(readlink -m $0))/.. + +reset_env () +{ + export PATH=$default_path + unset CROSS + unset DPDK_DEP_ARCHIVE + unset DPDK_DEP_CFLAGS + unset DPDK_DEP_LDFLAGS + unset DPDK_DEP_MOFED + unset DPDK_DEP_NUMA + unset DPDK_DEP_PCAP + unset DPDK_DEP_SSL + unset DPDK_DEP_SZE + unset DPDK_DEP_ZLIB + unset AESNI_MULTI_BUFFER_LIB_PATH + unset LIBSSO_SNOW3G_PATH + unset LIBSSO_KASUMI_PATH + unset LIBSSO_ZUC_PATH + unset PQOS_INSTALL_PATH +} + +config () # <directory> <target> <options> +{ + reconfig=false + if git rev-parse 2>&- && [ -n "$(git diff HEAD~ -- config)" ] ; then + echo 'Default config may have changed' + reconfig=true + fi + if [ ! -e $1/.config ] || $reconfig ; then + echo "================== Configure $1" + make T=$2 O=$1 config + + echo 'Customize configuration' + # Built-in options (lowercase) + ! echo $3 | grep -q '+default' || \ + sed -ri 's,(RTE_MACHINE=")native,\1default,' $1/.config + echo $3 | grep -q '+next' || \ + sed -ri 's,(NEXT_ABI=)y,\1n,' $1/.config + ! echo $3 | grep -q '+shared' || \ + sed -ri 's,(SHARED_LIB=)n,\1y,' $1/.config + ! echo $3 | grep -q '+debug' || ( \ + sed -ri 's,(RTE_LOG_LEVEL=).*,\1RTE_LOG_DEBUG,' $1/.config + sed -ri 's,(_DEBUG.*=)n,\1y,' $1/.config + sed -ri 's,(_STAT.*=)n,\1y,' $1/.config + sed -ri 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config ) + + # Automatic configuration + test "$DPDK_DEP_NUMA" != y || \ + sed -ri 's,(NUMA=)n,\1y,' $1/.config + sed -ri 's,(LIBRTE_IEEE1588=)n,\1y,' $1/.config + sed -ri 's,(BYPASS=)n,\1y,' $1/.config + test "$DPDK_DEP_ARCHIVE" != y || \ + sed -ri 's,(RESOURCE_TAR=)n,\1y,' $1/.config + test "$DPDK_DEP_MOFED" != y || \ + sed -ri 's,(MLX._PMD=)n,\1y,' $1/.config + test "$DPDK_DEP_SZE" != y || \ + sed -ri 's,(PMD_SZEDATA2=)n,\1y,' $1/.config + test "$DPDK_DEP_ZLIB" != y || \ + sed -ri 's,(BNX2X_PMD=)n,\1y,' $1/.config + sed -ri 's,(NFP_PMD=)n,\1y,' $1/.config + test "$DPDK_DEP_PCAP" != y || \ + sed -ri 's,(PCAP=)n,\1y,' $1/.config + test -z "$AESNI_MULTI_BUFFER_LIB_PATH" || \ + sed -ri 's,(PMD_AESNI_MB=)n,\1y,' $1/.config + test -z "$AESNI_MULTI_BUFFER_LIB_PATH" || \ + sed -ri 's,(PMD_AESNI_GCM=)n,\1y,' $1/.config + test -z "$LIBSSO_SNOW3G_PATH" || \ + sed -ri 's,(PMD_SNOW3G=)n,\1y,' $1/.config + test -z "$LIBSSO_KASUMI_PATH" || \ + sed -ri 's,(PMD_KASUMI=)n,\1y,' $1/.config + test -z "$LIBSSO_ZUC_PATH" || \ + sed -ri 's,(PMD_ZUC=)n,\1y,' $1/.config + test "$DPDK_DEP_SSL" != y || \ + sed -ri 's,(PMD_OPENSSL=)n,\1y,' $1/.config + test "$DPDK_DEP_SSL" != y || \ + sed -ri 's,(PMD_QAT=)n,\1y,' $1/.config + sed -ri 's,(KNI_VHOST.*=)n,\1y,' $1/.config + sed -ri 's,(SCHED_.*=)n,\1y,' $1/.config + build_config_hook $1 $2 $3 + + # Explicit enabler/disabler (uppercase) + for option in $(echo $3 | sed 's,[~+], &,g') ; do + pattern=$(echo $option | cut -c2-) + if echo $option | grep -q '^~' ; then + sed -ri "s,($pattern=)y,\1n," $1/.config + elif echo $option | grep -q '^+' ; then + sed -ri "s,($pattern=)n,\1y," $1/.config + fi + done + fi +} + +# default empty hook to override in devel config +build_config_hook () # <directory> <target> <options> +{ + : +} + +for conf in $configs ; do + target=$(echo $conf | sed 's,[~+].*,,') + # reload config with DPDK_TARGET set + DPDK_TARGET=$target + reset_env + . $(dirname $(readlink -e $0))/load-devel-config + + options=$(echo $conf | sed 's,[^~+]*,,') + dir=$conf + config $dir $target $options + + echo "================== Build $dir" + make -j$J EXTRA_CFLAGS="$maxerr $DPDK_DEP_CFLAGS" \ + EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose O=$dir + ! $short || break + echo "================== Build examples for $dir" + export RTE_SDK=$(pwd) + export RTE_TARGET=$dir + make -j$J -sC examples \ + EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose \ + O=$(readlink -m $dir/examples) + ! echo $target | grep -q '^x86_64' || \ + make -j$J -sC examples/performance-thread \ + EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose \ + O=$(readlink -m $dir/examples/performance-thread) + unset RTE_TARGET + echo "################## $dir done." + unset dir +done + +if ! $short ; then + mkdir -p .check + echo "================== Build doxygen HTML API" + make doc-api-html >/dev/null 2>.check/doc.txt + echo "================== Build sphinx HTML guides" + make doc-guides-html >/dev/null 2>>.check/doc.txt + echo "================== Check docs" + diff -u /dev/null .check/doc.txt +fi + +success=true diff --git a/devtools/test-null.sh b/devtools/test-null.sh new file mode 100755 index 0000000000..30cd0b031c --- /dev/null +++ b/devtools/test-null.sh @@ -0,0 +1,45 @@ +#! /bin/sh -e + +# BSD LICENSE +# +# Copyright 2015 6WIND S.A. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND S.A. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Run a quick testpmd forwarding with null PMD without hugepage + +build=${1:-build} +coremask=${2:-3} # default using cores 0 and 1 + +if grep -q SHARED_LIB=y $build/.config; then + pmd='-d librte_pmd_null.so' +fi + +(sleep 1 && echo stop) | +$build/app/testpmd -c $coremask -n 1 --no-huge \ + $pmd --vdev net_null1 --vdev net_null2 -- \ + --total-num-mbufs=2048 -ia diff --git a/devtools/validate-abi.sh b/devtools/validate-abi.sh new file mode 100755 index 0000000000..52e4e7ae73 --- /dev/null +++ b/devtools/validate-abi.sh @@ -0,0 +1,262 @@ +#!/bin/sh +# BSD LICENSE +# +# Copyright(c) 2015 Neil Horman. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +TAG1=$1 +TAG2=$2 +TARGET=$3 +ABI_DIR=`mktemp -d -p /tmp ABI.XXXXXX` + +usage() { + echo "$0 <REV1> <REV2> <TARGET>" +} + +log() { + local level=$1 + shift + echo "$*" +} + +validate_tags() { + + if [ -z "$HASH1" ] + then + echo "invalid revision: $TAG1" + return + fi + if [ -z "$HASH2" ] + then + echo "invalid revision: $TAG2" + return + fi +} + +validate_args() { + if [ -z "$TAG1" ] + then + echo "Must Specify REV1" + return + fi + if [ -z "$TAG2" ] + then + echo "Must Specify REV2" + return + fi + if [ -z "$TARGET" ] + then + echo "Must Specify a build target" + fi +} + + +cleanup_and_exit() { + rm -rf $ABI_DIR + git checkout $CURRENT_BRANCH + exit $1 +} + +# Make sure we configure SHARED libraries +# Also turn off IGB and KNI as those require kernel headers to build +fixup_config() { + sed -i -e"$ a\CONFIG_RTE_BUILD_SHARED_LIB=y" config/defconfig_$TARGET + sed -i -e"$ a\CONFIG_RTE_NEXT_ABI=n" config/defconfig_$TARGET + sed -i -e"$ a\CONFIG_RTE_EAL_IGB_UIO=n" config/defconfig_$TARGET + sed -i -e"$ a\CONFIG_RTE_LIBRTE_KNI=n" config/defconfig_$TARGET + sed -i -e"$ a\CONFIG_RTE_KNI_KMOD=n" config/defconfig_$TARGET +} + +########################################### +#START +############################################ + +#trap on ctrl-c to clean up +trap cleanup_and_exit SIGINT + +if [ -z "$DPDK_MAKE_JOBS" ] +then + # This counts the number of cpus on the system + if [ -e /usr/bin/lscpu ] + then + DPDK_MAKE_JOBS=`lscpu -p=cpu | grep -v "#" | wc -l` + else + DPDK_MAKE_JOBS=1 + fi +fi + +#Save the current branch +CURRENT_BRANCH=`git branch | grep \* | cut -d' ' -f2` + +if [ -z "$CURRENT_BRANCH" ] +then + CURRENT_BRANCH=`git log --pretty=format:%H HEAD~1..HEAD` +fi + +if [ -n "$VERBOSE" ] +then + export VERBOSE=/dev/stdout +else + export VERBOSE=/dev/null +fi + +# Validate that we have all the arguments we need +res=$(validate_args) +if [ -n "$res" ] +then + echo $res + usage + cleanup_and_exit 1 +fi + +HASH1=$(git show -s --format=%H "$TAG1" -- 2> /dev/null | tail -1) +HASH2=$(git show -s --format=%H "$TAG2" -- 2> /dev/null | tail -1) + +# Make sure our tags exist +res=$(validate_tags) +if [ -n "$res" ] +then + echo $res + cleanup_and_exit 1 +fi + +# Make hashes available in output for non-local reference +TAG1="$TAG1 ($HASH1)" +TAG2="$TAG2 ($HASH2)" + +ABICHECK=`which abi-compliance-checker 2>/dev/null` +if [ $? -ne 0 ] +then + log "INFO" "Cant find abi-compliance-checker utility" + cleanup_and_exit 1 +fi + +ABIDUMP=`which abi-dumper 2>/dev/null` +if [ $? -ne 0 ] +then + log "INFO" "Cant find abi-dumper utility" + cleanup_and_exit 1 +fi + +log "INFO" "We're going to check and make sure that applications built" +log "INFO" "against DPDK DSOs from version $TAG1 will still run when executed" +log "INFO" "against DPDK DSOs built from version $TAG2." +log "INFO" "" + +# Check to make sure we have a clean tree +git status | grep -q clean +if [ $? -ne 0 ] +then + log "WARN" "Working directory not clean, aborting" + cleanup_and_exit 1 +fi + +# Move to the root of the git tree +cd $(dirname $0)/.. + +log "INFO" "Checking out version $TAG1 of the dpdk" +# Move to the old version of the tree +git checkout $HASH1 + +fixup_config + +# Checking abi compliance relies on using the dwarf information in +# The shared objects. Thats only included in the DSO's if we build +# with -g +export EXTRA_CFLAGS="$EXTRA_CFLAGS -g -O0" +export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -g" + +# Now configure the build +log "INFO" "Configuring DPDK $TAG1" +make config T=$TARGET O=$TARGET > $VERBOSE 2>&1 + +log "INFO" "Building DPDK $TAG1. This might take a moment" +make -j$DPDK_MAKE_JOBS O=$TARGET > $VERBOSE 2>&1 + +if [ $? -ne 0 ] +then + log "INFO" "THE BUILD FAILED. ABORTING" + cleanup_and_exit 1 +fi + +# Move to the lib directory +cd $TARGET/lib +log "INFO" "COLLECTING ABI INFORMATION FOR $TAG1" +for i in `ls *.so` +do + $ABIDUMP $i -o $ABI_DIR/$i-ABI-0.dump -lver $HASH1 +done +cd ../.. + +# Now clean the tree, checkout the second tag, and rebuild +git clean -f -d +git reset --hard +# Move to the new version of the tree +log "INFO" "Checking out version $TAG2 of the dpdk" +git checkout $HASH2 + +fixup_config + +# Now configure the build +log "INFO" "Configuring DPDK $TAG2" +make config T=$TARGET O=$TARGET > $VERBOSE 2>&1 + +log "INFO" "Building DPDK $TAG2. This might take a moment" +make -j$DPDK_MAKE_JOBS O=$TARGET > $VERBOSE 2>&1 + +if [ $? -ne 0 ] +then + log "INFO" "THE BUILD FAILED. ABORTING" + cleanup_and_exit 1 +fi + +cd $TARGET/lib +log "INFO" "COLLECTING ABI INFORMATION FOR $TAG2" +for i in `ls *.so` +do + $ABIDUMP $i -o $ABI_DIR/$i-ABI-1.dump -lver $HASH2 +done +cd ../.. + +# Start comparison of ABI dumps +for i in `ls $ABI_DIR/*-1.dump` +do + NEWNAME=`basename $i` + OLDNAME=`basename $i | sed -e"s/1.dump/0.dump/"` + LIBNAME=`basename $i | sed -e"s/-ABI-1.dump//"` + + if [ ! -f $ABI_DIR/$OLDNAME ] + then + log "INFO" "$OLDNAME DOES NOT EXIST IN $TAG1. SKIPPING..." + fi + + #compare the abi dumps + $ABICHECK -l $LIBNAME -old $ABI_DIR/$OLDNAME -new $ABI_DIR/$NEWNAME +done + +git reset --hard +log "INFO" "ABI CHECK COMPLETE. REPORTS ARE IN compat_report directory" +cleanup_and_exit 0 diff --git a/doc/guides/contributing/patches.rst b/doc/guides/contributing/patches.rst index c7006c1918..3fd74dbd34 100644 --- a/doc/guides/contributing/patches.rst +++ b/doc/guides/contributing/patches.rst @@ -298,7 +298,7 @@ For example:: Checking the Patches -------------------- -Patches should be checked for formatting and syntax issues using the ``checkpatches.sh`` script in the ``scripts`` +Patches should be checked for formatting and syntax issues using the ``checkpatches.sh`` script in the ``devtools`` directory of the DPDK repo. This uses the Linux kernel development tool ``checkpatch.pl`` which can be obtained by cloning, and periodically, updating the Linux kernel sources. @@ -313,7 +313,7 @@ files, in order of preference:: Once the environment variable the script can be run as follows:: - scripts/checkpatches.sh ~/patch/ + devtools/checkpatches.sh ~/patch/ The script usage is:: @@ -340,10 +340,10 @@ Where the range is a ``git log`` option. Checking Compilation -------------------- -Compilation of patches and changes should be tested using the the ``test-build.sh`` script in the ``scripts`` +Compilation of patches and changes should be tested using the the ``test-build.sh`` script in the ``devtools`` directory of the DPDK repo:: - scripts/test-build.sh x86_64-native-linuxapp-gcc+next+shared + devtools/test-build.sh x86_64-native-linuxapp-gcc+next+shared The script usage is:: diff --git a/doc/guides/contributing/versioning.rst b/doc/guides/contributing/versioning.rst index 08e2e217d9..fbc44a7940 100644 --- a/doc/guides/contributing/versioning.rst +++ b/doc/guides/contributing/versioning.rst @@ -457,7 +457,7 @@ versions of the symbol. Running the ABI Validator ------------------------- -The ``scripts`` directory in the DPDK source tree contains a utility program, +The ``devtools`` directory in the DPDK source tree contains a utility program, ``validate-abi.sh``, for validating the DPDK ABI based on the Linux `ABI Compliance Checker <http://ispras.linuxbase.org/index.php/ABI_compliance_checker>`_. @@ -470,7 +470,7 @@ utilities which can be installed via a package manager. For example:: The syntax of the ``validate-abi.sh`` utility is:: - ./scripts/validate-abi.sh <REV1> <REV2> <TARGET> + ./devtools/validate-abi.sh <REV1> <REV2> <TARGET> Where ``REV1`` and ``REV2`` are valid gitrevisions(7) https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html @@ -479,13 +479,13 @@ on the local repo and target is the usual DPDK compilation target. For example:: # Check between the previous and latest commit: - ./scripts/validate-abi.sh HEAD~1 HEAD x86_64-native-linuxapp-gcc + ./devtools/validate-abi.sh HEAD~1 HEAD x86_64-native-linuxapp-gcc # Check between two tags: - ./scripts/validate-abi.sh v2.0.0 v2.1.0 x86_64-native-linuxapp-gcc + ./devtools/validate-abi.sh v2.0.0 v2.1.0 x86_64-native-linuxapp-gcc # Check between git master and local topic-branch "vhost-hacking": - ./scripts/validate-abi.sh master vhost-hacking x86_64-native-linuxapp-gcc + ./devtools/validate-abi.sh master vhost-hacking x86_64-native-linuxapp-gcc After the validation script completes (it can take a while since it need to compile both tags) it will create compatibility reports in the diff --git a/scripts/check-git-log.sh b/scripts/check-git-log.sh deleted file mode 100755 index f79f0a2dba..0000000000 --- a/scripts/check-git-log.sh +++ /dev/null @@ -1,206 +0,0 @@ -#! /bin/sh - -# BSD LICENSE -# -# Copyright 2016 6WIND S.A. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of 6WIND S.A. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Check commit logs (headlines and references) -# -# If any doubt about the formatting, please check in the most recent history: -# git log --format='%>|(15)%cr %s' --reverse | grep -i <pattern> - -if [ "$1" = '-h' -o "$1" = '--help' ] ; then - cat <<- END_OF_HELP - usage: $(basename $0) [-h] [range] - - Check commit log formatting. - The git range can be specified as a "git log" option, - e.g. -1 to check only the latest commit. - The default range starts from origin/master to HEAD. - END_OF_HELP - exit -fi - -selfdir=$(dirname $(readlink -e $0)) -range=${1:-origin/master..} -# convert -N to HEAD~N.. in order to comply with git-log-fixes.sh getopts -if printf -- $range | grep -q '^-[0-9]\+' ; then - range="HEAD$(printf -- $range | sed 's,^-,~,').." -fi - -commits=$(git log --format='%h' --reverse $range) -headlines=$(git log --format='%s' --reverse $range) -bodylines=$(git log --format='%b' --reverse $range) -fixes=$(git log --format='%h %s' --reverse $range | grep -i ': *fix' | cut -d' ' -f1) -stablefixes=$($selfdir/git-log-fixes.sh $range | sed '/(N\/A)$/d' | cut -d' ' -f2) -tags=$(git log --format='%b' --reverse $range | grep -i -e 'by *:' -e 'fix.*:') -bytag='\(Reported\|Suggested\|Signed-off\|Acked\|Reviewed\|Tested\)-by:' - -# check headline format (spacing, no punctuation, no code) -bad=$(echo "$headlines" | grep --color=always \ - -e ' ' \ - -e '^ ' \ - -e ' $' \ - -e '\.$' \ - -e '[,;!?&|]' \ - -e ':.*_' \ - -e '^[^:]\+$' \ - -e ':[^ ]' \ - -e ' :' \ - | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline format:\n$bad\n" - -# check headline prefix when touching only drivers, e.g. net/<driver name> -bad=$(for commit in $commits ; do - headline=$(git log --format='%s' -1 $commit) - files=$(git diff-tree --no-commit-id --name-only -r $commit) - [ -z "$(echo "$files" | grep -v '^\(drivers\|doc\|config\)/')" ] || - continue - drv=$(echo "$files" | grep '^drivers/' | cut -d "/" -f 2,3 | sort -u) - drvgrp=$(echo "$drv" | cut -d "/" -f 1 | uniq) - if [ $(echo "$drvgrp" | wc -l) -gt 1 ] ; then - echo "$headline" | grep -v '^drivers:' - elif [ $(echo "$drv" | wc -l) -gt 1 ] ; then - echo "$headline" | grep -v "^$drvgrp" - else - echo "$headline" | grep -v "^$drv" - fi -done | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline prefix:\n$bad\n" - -# check headline label for common typos -bad=$(echo "$headlines" | grep --color=always \ - -e '^example[:/]' \ - -e '^apps/' \ - -e '^testpmd' \ - -e 'test-pmd' \ - -e '^bond:' \ - | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline label:\n$bad\n" - -# check headline lowercase for first words -bad=$(echo "$headlines" | grep --color=always \ - -e '^.*[A-Z].*:' \ - -e ': *[A-Z]' \ - | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline uppercase:\n$bad\n" - -# check headline uppercase (Rx/Tx, VF, L2, MAC, Linux, ARM...) -bad=$(echo "$headlines" | grep -E --color=always \ - -e '\<(rx|tx|RX|TX)\>' \ - -e '\<[pv]f\>' \ - -e '\<[hsf]w\>' \ - -e '\<l[234]\>' \ - -e ':.*\<api\>' \ - -e ':.*\<arm\>' \ - -e ':.*\<armv7\>' \ - -e ':.*\<armv8\>' \ - -e ':.*\<dma\>' \ - -e ':.*\<freebsd\>' \ - -e ':.*\<linux\>' \ - -e ':.*\<lro\>' \ - -e ':.*\<mac\>' \ - -e ':.*\<mtu\>' \ - -e ':.*\<nic\>' \ - -e ':.*\<numa\>' \ - -e ':.*\<pci\>' \ - -e ':.*\<pmd\>' \ - -e ':.*\<rss\>' \ - -e ':.*\<tile-gx\>' \ - -e ':.*\<tilegx\>' \ - -e ':.*\<vlan\>' \ - | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline lowercase:\n$bad\n" - -# special case check for VMDq to give good error message -bad=$(echo "$headlines" | grep -E --color=always \ - -e '\<(vmdq|VMDQ)\>' \ - | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline capitalization, use 'VMDq':\n$bad\n" - -# check headline length (60 max) -bad=$(echo "$headlines" | - awk 'length>60 {print}' | - sed 's,^,\t,') -[ -z "$bad" ] || printf "Headline too long:\n$bad\n" - -# check body lines length (75 max) -bad=$(echo "$bodylines" | grep -v '^Fixes:' | - awk 'length>75 {print}' | - sed 's,^,\t,') -[ -z "$bad" ] || printf "Line too long:\n$bad\n" - -# check starting commit message with "It" -bad=$(for commit in $commits ; do - firstbodyline=$(git log --format='%b' -1 $commit | head -n1) - echo "$firstbodyline" | grep --color=always -ie '^It ' -done | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong beginning of commit message:\n$bad\n" - -# check tags spelling -bad=$(echo "$tags" | - grep -v "^$bytag [^,]* <.*@.*>$" | - grep -v '^Fixes: [0-9a-f]\{7\}[0-9a-f]* (".*")$' | - sed 's,^.,\t&,') -[ -z "$bad" ] || printf "Wrong tag:\n$bad\n" - -# check blank line after last Fixes: tag -bad=$(echo "$bodylines" | - sed -n 'N;/\nFixes:/D;/\n$/D;/^Fixes:/P' | - sed 's,^.,\t&,') -[ -z "$bad" ] || printf "Missing blank line after 'Fixes' tag:\n$bad\n" - -# check missing Fixes: tag -bad=$(for fix in $fixes ; do - git log --format='%b' -1 $fix | grep -q '^Fixes: ' || - git log --format='\t%s' -1 $fix -done) -[ -z "$bad" ] || printf "Missing 'Fixes' tag:\n$bad\n" - -# check Fixes: reference -IFS=' -' -fixtags=$(echo "$tags" | grep '^Fixes: ') -bad=$(for fixtag in $fixtags ; do - hash=$(echo "$fixtag" | sed 's,^Fixes: \([0-9a-f]*\).*,\1,') - if git branch --contains $hash 2>&- | grep -q '^\*' ; then - good="Fixes: $hash "$(git log --format='("%s")' -1 $hash 2>&-) - else - good="reference not in current branch" - fi - printf "$fixtag" | grep -v "^$good$" -done | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong 'Fixes' reference:\n$bad\n" - -# check CC:stable for fixes -bad=$(for fix in $stablefixes ; do - git log --format='%b' -1 $fix | grep -qi '^CC: *stable@dpdk.org' || - git log --format='\t%s' -1 $fix -done) -[ -z "$bad" ] || printf "Should CC: stable@dpdk.org\n$bad\n" diff --git a/scripts/check-includes.sh b/scripts/check-includes.sh deleted file mode 100755 index d65adc6db3..0000000000 --- a/scripts/check-includes.sh +++ /dev/null @@ -1,286 +0,0 @@ -#!/bin/sh -e -# -# BSD LICENSE -# -# Copyright 2016 6WIND S.A. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of 6WIND S.A. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# This script checks that header files in a given directory do not miss -# dependencies when included on their own, do not conflict and accept being -# compiled with the strictest possible flags. -# -# Files are looked up in the directory provided as the first argument, -# otherwise build/include by default. -# -# Recognized environment variables: -# -# VERBOSE=1 is the same as -v. -# -# QUIET=1 is the same as -q. -# -# SUMMARY=1 is the same as -s. -# -# CC, CPPFLAGS, CFLAGS, EXTRA_CPPFLAGS, EXTRA_CFLAGS, CXX, CXXFLAGS and -# EXTRA_CXXFLAGS are taken into account. -# -# PEDANTIC_CFLAGS, PEDANTIC_CXXFLAGS and PEDANTIC_CPPFLAGS provide strict -# C/C++ compilation flags. -# -# IGNORE contains a list of shell patterns matching files (relative to the -# include directory) to avoid. It is set by default to known DPDK headers -# which must not be included on their own. -# -# IGNORE_CXX provides additional files for C++. - -while getopts hqvs arg; do - case $arg in - h) - cat <<EOF -usage: $0 [-h] [-q] [-v] [-s] [DIR] - -This script checks that header files in a given directory do not miss -dependencies when included on their own, do not conflict and accept being -compiled with the strictest possible flags. - - -h display this help and exit - -q quiet mode, disable normal output - -v show command lines being executed - -s show summary - -With no DIR, default to build/include. - -Any failed header check yields a nonzero exit status. -EOF - exit - ;; - q) - QUIET=1 - ;; - v) - VERBOSE=1 - ;; - s) - SUMMARY=1 - ;; - *) - exit 1 - ;; - esac -done - -shift $(($OPTIND - 1)) - -include_dir=${1:-build/include} - -: ${PEDANTIC_CFLAGS=-std=c99 -pedantic -Wall -Wextra -Werror} -: ${PEDANTIC_CXXFLAGS=} -: ${PEDANTIC_CPPFLAGS=-D_XOPEN_SOURCE=600} -: ${CC:=cc} -: ${CXX:=c++} -: ${IGNORE= \ - 'rte_atomic_32.h' \ - 'rte_atomic_64.h' \ - 'rte_byteorder_32.h' \ - 'rte_byteorder_64.h' \ - 'generic/*' \ - 'exec-env/*' \ -} -: ${IGNORE_CXX= \ - 'rte_eth_vhost.h' \ - 'rte_virtio_net.h' \ -} - -temp_cc=/tmp/${0##*/}.$$.c -pass_cc= -failures_cc=0 - -temp_cxx=/tmp/${0##*/}.$$.cc -pass_cxx= -failures_cxx=0 - -# Process output parameters. - -[ "$QUIET" = 1 ] && -exec 1> /dev/null - -[ "$VERBOSE" = 1 ] && -output () -{ - local CCV - local CXXV - - shift - CCV=$CC - CXXV=$CXX - CC="echo $CC" CXX="echo $CXX" "$@" - CC=$CCV - CXX=$CXXV - - "$@" -} || -output () -{ - - printf ' %s\n' "$1" - shift - "$@" -} - -trap 'rm -f "$temp_cc" "$temp_cxx"' EXIT - -compile_cc () -{ - ${CC} -I"$include_dir" \ - ${PEDANTIC_CPPFLAGS} ${CPPFLAGS} ${EXTRA_CPPFLAGS} \ - ${PEDANTIC_CFLAGS} ${CFLAGS} ${EXTRA_CFLAGS} \ - -c -o /dev/null "${temp_cc}" -} - -compile_cxx () -{ - ${CXX} -I"$include_dir" \ - ${PEDANTIC_CPPFLAGS} ${CPPFLAGS} ${EXTRA_CPPFLAGS} \ - ${PEDANTIC_CXXFLAGS} ${CXXFLAGS} ${EXTRA_CXXFLAGS} \ - -c -o /dev/null "${temp_cxx}" -} - -ignore () -{ - file="$1" - shift - while [ $# -ne 0 ]; do - case "$file" in - $1) - return 0 - ;; - esac - shift - done - return 1 -} - -# Check C/C++ compilation for each header file. - -while read -r path -do - file=${path#$include_dir} - file=${file##/} - if ignore "$file" $IGNORE; then - output "SKIP $file" : - continue - fi - if printf "\ -#include <%s> - -int main(void) -{ - return 0; -} -" "$file" > "$temp_cc" && - output "CC $file" compile_cc - then - pass_cc="$pass_cc $file" - else - failures_cc=$(($failures_cc + 1)) - fi - if ignore "$file" $IGNORE_CXX; then - output "SKIP CXX $file" : - continue - fi - if printf "\ -#include <%s> - -int main() -{ -} -" "$file" > "$temp_cxx" && - output "CXX $file" compile_cxx - then - pass_cxx="$pass_cxx $file" - else - failures_cxx=$(($failures_cxx + 1)) - fi -done <<EOF -$(find "$include_dir" -name '*.h') -EOF - -# Check C compilation with all includes. - -: > "$temp_cc" && -for file in $pass_cc; do - printf "\ -#include <%s> -" "$file" >> $temp_cc -done -if printf "\ -int main(void) -{ - return 0; -} -" >> "$temp_cc" && - output "CC (all includes that did not fail)" compile_cc -then - : -else - failures_cc=$(($failures_cc + 1)) -fi - -# Check C++ compilation with all includes. - -: > "$temp_cxx" && -for file in $pass_cxx; do - printf "\ -#include <%s> -" "$file" >> $temp_cxx -done -if printf "\ -int main() -{ -} -" >> "$temp_cxx" && - output "CXX (all includes that did not fail)" compile_cxx -then - : -else - failures_cxx=$(($failures_cxx + 1)) -fi - -# Report results. - -if [ "$SUMMARY" = 1 ]; then - printf "\ -Summary: - %u failure(s) for C using '%s'. - %u failure(s) for C++ using '%s'. -" $failures_cc "$CC" $failures_cxx "$CXX" 1>&2 -fi - -# Exit with nonzero status if there are failures. - -[ $failures_cc -eq 0 ] && -[ $failures_cxx -eq 0 ] diff --git a/scripts/check-maintainers.sh b/scripts/check-maintainers.sh deleted file mode 100755 index 69c879a824..0000000000 --- a/scripts/check-maintainers.sh +++ /dev/null @@ -1,157 +0,0 @@ -#! /bin/sh - -# BSD LICENSE -# -# Copyright 2015 6WIND S.A. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of 6WIND S.A. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Do some basic checks in MAINTAINERS file - -cd $(dirname $0)/.. - -# Get files matching paths with wildcards and / meaning recursing -files () # <path> [<path> ...] -{ - if [ -z "$1" ] ; then - return - fi - if [ -d .git ] ; then - git ls-files "$1" - else - find "$1" -type f | - sed 's,^\./,,' - fi | - # if not ended by / - if ! echo "$1" | grep -q '/[[:space:]]*$' ; then - # filter out deeper directories - sed "/\(\/[^/]*\)\{$(($(echo "$1" | grep -o / | wc -l) + 1))\}/d" - else - cat - fi - # next path - shift - files "$@" -} - -# Get all files matching F: and X: fields -parse_fx () # <index file> -{ - IFS=' -' - # parse each line excepted underlining - for line in $( (sed '/^-\+$/d' $1 ; echo) | sed 's,^$,§,') ; do - if echo "$line" | grep -q '^§$' ; then - # empty line delimit end of section - whitelist=$(files $flines) - blacklist=$(files $xlines) - match=$(aminusb "$whitelist" "$blacklist") - if [ -n "$whitelist" ] ; then - printf "# $title " - maintainers=$(echo "$maintainers" | sed -r 's,.*<(.*)>.*,\1,') - maintainers=$(printf "$maintainers" | sed -e 's,^,<,' -e 's,$,>,') - echo $maintainers - fi - if [ -n "$match" ] ; then - echo "$match" - fi - # flush section - unset maintainers - unset flines - unset xlines - elif echo "$line" | grep -q '^[A-Z]: ' ; then - # maintainer - maintainers=$(add_line_to_if "$line" "$maintainers" 'M: ') - # file matching pattern - flines=$(add_line_to_if "$line" "$flines" 'F: ') - # file exclusion pattern - xlines=$(add_line_to_if "$line" "$xlines" 'X: ') - else # assume it is a title - title="$line" - fi - done -} - -# Check patterns in F: and X: -check_fx () # <index file> -{ - IFS=' -' - for line in $(sed -n 's,^[FX]: ,,p' $1 | tr '*' '#') ; do - line=$(printf "$line" | tr '#' '*') - match=$(files "$line") - if [ -z "$match" ] ; then - echo "$line" - fi - done -} - -# Add a line to a set of lines if it begins with right pattern -add_line_to_if () # <new line> <lines> <head pattern> -{ - ( - echo "$2" - echo "$1" | sed -rn "s,^$3(.*),\1,p" - ) | - sed '/^$/d' -} - -# Subtract two sets of lines -aminusb () # <lines a> <lines b> -{ - printf "$1\n$2\n$2" | sort | uniq -u | sed '/^$/d' -} - -printf 'sections: ' -parsed=$(parse_fx MAINTAINERS) -echo "$parsed" | grep -c '^#' -printf 'with maintainer: ' -echo "$parsed" | grep -c '^#.*@' -printf 'maintainers: ' -grep '^M:.*<' MAINTAINERS | sort -u | wc -l - -echo -echo '##########' -echo '# orphan areas' -echo '##########' -echo "$parsed" | sed -rn 's,^#([^@]*)$,\1,p' | uniq - -echo -echo '##########' -echo '# files not listed' -echo '##########' -all=$(files ./) -listed=$(echo "$parsed" | sed '/^#/d' | sort -u) -aminusb "$all" "$listed" - -echo -echo '##########' -echo '# wrong patterns' -echo '##########' -check_fx MAINTAINERS - -# TODO: check overlaps diff --git a/scripts/checkpatches.sh b/scripts/checkpatches.sh deleted file mode 100755 index cfe262bec4..0000000000 --- a/scripts/checkpatches.sh +++ /dev/null @@ -1,134 +0,0 @@ -#! /bin/sh - -# BSD LICENSE -# -# Copyright 2015 6WIND S.A. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of 6WIND S.A. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Load config options: -# - DPDK_CHECKPATCH_PATH -# - DPDK_CHECKPATCH_LINE_LENGTH -. $(dirname $(readlink -e $0))/load-devel-config - -length=${DPDK_CHECKPATCH_LINE_LENGTH:-80} - -# override default Linux options -options="--no-tree" -options="$options --max-line-length=$length" -options="$options --show-types" -options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\ -VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\ -PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\ -SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\ -NEW_TYPEDEFS,COMPARISON_TO_NULL" - -print_usage () { - cat <<- END_OF_HELP - usage: $(basename $0) [-q] [-v] [-nX|patch1 [patch2] ...]] - - Run Linux kernel checkpatch.pl with DPDK options. - The environment variable DPDK_CHECKPATCH_PATH must be set. - - The patches to check can be from stdin, files specified on the command line, - or latest git commits limited with -n option (default limit: origin/master). - END_OF_HELP -} - -number=0 -quiet=false -verbose=false -while getopts hn:qv ARG ; do - case $ARG in - n ) number=$OPTARG ;; - q ) quiet=true ;; - v ) verbose=true ;; - h ) print_usage ; exit 0 ;; - ? ) print_usage ; exit 1 ;; - esac -done -shift $(($OPTIND - 1)) - -if [ ! -x "$DPDK_CHECKPATCH_PATH" ] ; then - print_usage >&2 - echo - echo 'Cannot execute DPDK_CHECKPATCH_PATH' >&2 - exit 1 -fi - -total=0 -status=0 - -check () { # <patch> <commit> <title> - total=$(($total + 1)) - ! $verbose || printf '\n### %s\n\n' "$3" - if [ -n "$1" ] ; then - report=$($DPDK_CHECKPATCH_PATH $options "$1" 2>/dev/null) - elif [ -n "$2" ] ; then - report=$(git format-patch --no-stat --stdout -1 $commit | - $DPDK_CHECKPATCH_PATH $options - 2>/dev/null) - else - report=$($DPDK_CHECKPATCH_PATH $options - 2>/dev/null) - fi - [ $? -ne 0 ] || return 0 - $verbose || printf '\n### %s\n\n' "$3" - printf '%s\n' "$report" | sed -n '1,/^total:.*lines checked$/p' - status=$(($status + 1)) -} - -if [ -n "$1" ] ; then - for patch in "$@" ; do - # Subject can be on 2 lines - subject=$(sed '/^Subject: */!d;s///;N;s,\n[[:space:]]\+, ,;s,\n.*,,;q' "$patch") - check "$patch" '' "$subject" - done -elif [ ! -t 0 ] ; then # stdin - subject=$(while read header value ; do - if [ "$header" = 'Subject:' ] ; then - IFS= read next - continuation=$(echo "$next" | sed -n 's,^[[:space:]]\+, ,p') - echo $value$continuation - break - fi - done) - check '' '' "$subject" -else - if [ $number -eq 0 ] ; then - commits=$(git rev-list --reverse origin/master..) - else - commits=$(git rev-list --reverse --max-count=$number HEAD) - fi - for commit in $commits ; do - subject=$(git log --format='%s' -1 $commit) - check '' $commit "$subject" - done -fi -pass=$(($total - $status)) -$quiet || printf '\n%d/%d valid patch' $pass $total -$quiet || [ $pass -le 1 ] || printf 'es' -$quiet || printf '\n' -exit $status diff --git a/scripts/cocci.sh b/scripts/cocci.sh deleted file mode 100755 index 7acc256f9c..0000000000 --- a/scripts/cocci.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh - -# BSD LICENSE -# -# Copyright 2015 EZchip Semiconductor Ltd. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of EZchip Semiconductor nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Apply coccinelle transforms. - -SRCTREE=$(readlink -f $(dirname $0)/..) -COCCI=$SRCTREE/scripts/cocci -[ -n "$SPATCH" ] || SPATCH=$(which spatch) - -PATCH_LIST="$@" -[ -n "$PATCH_LIST" ] || PATCH_LIST=$(echo $COCCI/*.cocci) - -[ -x "$SPATCH" ] || ( - echo "Coccinelle tools not installed." - exit 1 -) - -tmp=$(mktemp) - -for c in $PATCH_LIST; do - while true; do - echo -n "Applying $c..." - $SPATCH --sp-file $c -c --linux-spacing --very-quiet \ - --include-headers --preprocess \ - --in-place --dir $SRCTREE > $tmp - if [ -s $tmp ]; then - echo " changes applied, retrying." - else - echo " no change." - break; - fi - done -done - -rm -f $tmp diff --git a/scripts/cocci/mtod-offset.cocci b/scripts/cocci/mtod-offset.cocci deleted file mode 100644 index 13134e9dff..0000000000 --- a/scripts/cocci/mtod-offset.cocci +++ /dev/null @@ -1,76 +0,0 @@ -// -// Replace explicit packet offset computations with rte_pktmbuf_mtod_offset(). -// -@disable paren@ -typedef uint8_t; -expression M, O; -@@ -( -- rte_pktmbuf_mtod(M, char *) + O -+ rte_pktmbuf_mtod_offset(M, char *, O) -| -- rte_pktmbuf_mtod(M, char *) - O -+ rte_pktmbuf_mtod_offset(M, char *, -O) -| -- rte_pktmbuf_mtod(M, unsigned char *) + O -+ rte_pktmbuf_mtod_offset(M, unsigned char *, O) -| -- rte_pktmbuf_mtod(M, unsigned char *) - O -+ rte_pktmbuf_mtod_offset(M, unsigned char *, -O) -| -- rte_pktmbuf_mtod(M, uint8_t *) + O -+ rte_pktmbuf_mtod_offset(M, uint8_t *, O) -| -- rte_pktmbuf_mtod(M, uint8_t *) - O -+ rte_pktmbuf_mtod_offset(M, uint8_t *, -O) -) - - -// -// Fold subsequent offset terms into pre-existing offset used in -// rte_pktmbuf_mtod_offset(). -// -@disable paren@ -expression M, O1, O2; -@@ -( -- rte_pktmbuf_mtod_offset(M, char *, O1) + O2 -+ rte_pktmbuf_mtod_offset(M, char *, O1 + O2) -| -- rte_pktmbuf_mtod_offset(M, char *, O1) - O2 -+ rte_pktmbuf_mtod_offset(M, char *, O1 - O2) -| -- rte_pktmbuf_mtod_offset(M, unsigned char *, O1) + O2 -+ rte_pktmbuf_mtod_offset(M, unsigned char *, O1 + O2) -| -- rte_pktmbuf_mtod_offset(M, unsigned char *, O1) - O2 -+ rte_pktmbuf_mtod_offset(M, unsigned char *, O1 - O2) -| -- rte_pktmbuf_mtod_offset(M, uint8_t *, O1) + O2 -+ rte_pktmbuf_mtod_offset(M, uint8_t *, O1 + O2) -| -- rte_pktmbuf_mtod_offset(M, uint8_t *, O1) - O2 -+ rte_pktmbuf_mtod_offset(M, uint8_t *, O1 - O2) -) - - -// -// Cleanup rules. Fold in double casts, remove unnecessary paranthesis, etc. -// -@disable paren@ -expression M, O; -type C, T; -@@ -( -- (C)rte_pktmbuf_mtod_offset(M, T, O) -+ rte_pktmbuf_mtod_offset(M, C, O) -| -- (rte_pktmbuf_mtod_offset(M, T, O)) -+ rte_pktmbuf_mtod_offset(M, T, O) -| -- (C)rte_pktmbuf_mtod(M, T) -+ rte_pktmbuf_mtod(M, C) -| -- (rte_pktmbuf_mtod(M, T)) -+ rte_pktmbuf_mtod(M, T) -) diff --git a/scripts/git-log-fixes.sh b/scripts/git-log-fixes.sh deleted file mode 100755 index 4824c7f7ce..0000000000 --- a/scripts/git-log-fixes.sh +++ /dev/null @@ -1,120 +0,0 @@ -#! /bin/sh -e - -# BSD LICENSE -# -# Copyright 2016 6WIND S.A. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of 6WIND S.A. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -print_usage () -{ - echo "usage: $(basename $0) [-h] <git_range>" -} - -print_help () -{ - print_usage - cat <<- END_OF_HELP - - Find fixes to backport on previous versions. - It looks for the word "fix" in the headline or a tag "Fixes" or "Reverts". - The oldest bug origin is printed as well as partially fixed versions. - END_OF_HELP -} - -usage_error () # <message> -{ - echo "$*" >&2 - print_usage >&2 - exit 1 -} - -while getopts h ARG ; do - case $ARG in - h ) print_help ; exit 0 ;; - ? ) print_usage >&2 ; exit 1 ;; - esac -done -shift $(($OPTIND - 1)) -[ $# -ge 1 ] || usage_error 'range argument required' -range="$*" - -# get major release version of a commit -commit_version () # <hash> -{ - tag=$(git tag -l --contains $1 | head -n1) - if [ -z "$tag" ] ; then - # before -rc1 tag of release in progress - make showversion | cut -d'.' -f-2 - else - echo $tag | sed 's,^v,,' | sed 's,-rc.*,,' - fi -} - -# get bug origin hashes of a fix -origin_filter () # <hash> -{ - git log --format='%b' -1 $1 | - sed -n 's,^ *\([Ff]ixes\|[Rr]everts\): *\([0-9a-f]*\).*,\2,p' -} - -# get oldest major release version of bug origins -origin_version () # <origin_hash> ... -{ - for origin in $* ; do - # check hash is valid - git rev-parse -q --verify $1 >&- || continue - # get version of this bug origin - local origver=$(commit_version $origin) - local roothashes=$(origin_filter $origin) - if [ -n "$roothashes" ] ; then - # look chained fix of fix recursively - local rootver="$(origin_version $roothashes)" - [ -n "$rootver" ] || continue - echo "$rootver (partially fixed in $origver)" - else - echo "$origver" - fi - # filter the oldest origin - done | sort -uV | head -n1 -} - -git log --oneline --reverse $range | -while read id headline ; do - origins=$(origin_filter $id) - [ -n "$origins" ] || echo "$headline" | grep -q fix || continue - version=$(commit_version $id) - if [ -n "$origins" ] ; then - origver="$(origin_version $origins)" - [ -n "$origver" ] || continue - # ignore fix of bug introduced in the same release - ! echo "$origver" | grep -q "^$version" || continue - else - origver='N/A' - fi - printf '%s %7s %s (%s)\n' $version $id "$headline" "$origver" -done diff --git a/scripts/load-devel-config b/scripts/load-devel-config deleted file mode 100644 index 4f43cb3523..0000000000 --- a/scripts/load-devel-config +++ /dev/null @@ -1,12 +0,0 @@ -# Load DPDK devel config and allow override -# from system file -test ! -r /etc/dpdk/devel.config || - . /etc/dpdk/devel.config -# from user file -test ! -r ~/.config/dpdk/devel.config || - . ~/.config/dpdk/devel.config -# from local file -test ! -r $(dirname $(readlink -m $0))/../.develconfig || - . $(dirname $(readlink -m $0))/../.develconfig - -# The config files must export variables in the shell style diff --git a/scripts/test-build.sh b/scripts/test-build.sh deleted file mode 100755 index a979309717..0000000000 --- a/scripts/test-build.sh +++ /dev/null @@ -1,253 +0,0 @@ -#! /bin/sh -e - -# BSD LICENSE -# -# Copyright 2015 6WIND S.A. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of 6WIND S.A. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -default_path=$PATH - -# Load config options: -# - AESNI_MULTI_BUFFER_LIB_PATH -# - DPDK_BUILD_TEST_CONFIGS (defconfig1+option1+option2 defconfig2) -# - DPDK_DEP_ARCHIVE -# - DPDK_DEP_CFLAGS -# - DPDK_DEP_LDFLAGS -# - DPDK_DEP_MOFED (y/[n]) -# - DPDK_DEP_NUMA (y/[n]) -# - DPDK_DEP_PCAP (y/[n]) -# - DPDK_DEP_SSL (y/[n]) -# - DPDK_DEP_SZE (y/[n]) -# - DPDK_DEP_ZLIB (y/[n]) -# - DPDK_MAKE_JOBS (int) -# - DPDK_NOTIFY (notify-send) -# - LIBSSO_SNOW3G_PATH -# - LIBSSO_KASUMI_PATH -# - LIBSSO_ZUC_PATH -. $(dirname $(readlink -e $0))/load-devel-config - -print_usage () { - echo "usage: $(basename $0) [-h] [-jX] [-s] [config1 [config2] ...]]" -} - -print_help () { - echo 'Test building several targets with different options' - echo - print_usage - cat <<- END_OF_HELP - - options: - -h this help - -jX use X parallel jobs in "make" - -s short test with only first config without examples/doc - -v verbose build - - config: defconfig[[~][+]option1[[~][+]option2...]] - Example: x86_64-native-linuxapp-gcc+debug~RXTX_CALLBACKS - The lowercase options are defined inside $(basename $0). - The uppercase options can be the end of a defconfig option - to enable if prefixed with '+' or to disable if prefixed with '~'. - Default is to automatically enable most of the options. - The external dependencies are setup with DPDK_DEP_* variables. - If no config on command line, DPDK_BUILD_TEST_CONFIGS is used. - END_OF_HELP -} - -J=$DPDK_MAKE_JOBS -short=false -unset verbose -maxerr=-Wfatal-errors -while getopts hj:sv ARG ; do - case $ARG in - j ) J=$OPTARG ;; - s ) short=true ;; - v ) verbose='V=1' ;; - h ) print_help ; exit 0 ;; - ? ) print_usage ; exit 1 ;; - esac -done -shift $(($OPTIND - 1)) -configs=${*:-$DPDK_BUILD_TEST_CONFIGS} - -success=false -on_exit () -{ - if $success ; then - [ "$DPDK_NOTIFY" != notify-send ] || \ - notify-send -u low --icon=dialog-information 'DPDK build' 'finished' - elif [ -z "$signal" ] ; then - [ -z "$dir" ] || echo "failed to build $dir" >&2 - [ "$DPDK_NOTIFY" != notify-send ] || \ - notify-send -u low --icon=dialog-error 'DPDK build' 'failed' - fi -} -# catch manual interrupt to ignore notification -trap "signal=INT ; trap - INT ; kill -INT $$" INT -# notify result on exit -trap on_exit EXIT - -cd $(dirname $(readlink -m $0))/.. - -reset_env () -{ - export PATH=$default_path - unset CROSS - unset DPDK_DEP_ARCHIVE - unset DPDK_DEP_CFLAGS - unset DPDK_DEP_LDFLAGS - unset DPDK_DEP_MOFED - unset DPDK_DEP_NUMA - unset DPDK_DEP_PCAP - unset DPDK_DEP_SSL - unset DPDK_DEP_SZE - unset DPDK_DEP_ZLIB - unset AESNI_MULTI_BUFFER_LIB_PATH - unset LIBSSO_SNOW3G_PATH - unset LIBSSO_KASUMI_PATH - unset LIBSSO_ZUC_PATH - unset PQOS_INSTALL_PATH -} - -config () # <directory> <target> <options> -{ - reconfig=false - if git rev-parse 2>&- && [ -n "$(git diff HEAD~ -- config)" ] ; then - echo 'Default config may have changed' - reconfig=true - fi - if [ ! -e $1/.config ] || $reconfig ; then - echo "================== Configure $1" - make T=$2 O=$1 config - - echo 'Customize configuration' - # Built-in options (lowercase) - ! echo $3 | grep -q '+default' || \ - sed -ri 's,(RTE_MACHINE=")native,\1default,' $1/.config - echo $3 | grep -q '+next' || \ - sed -ri 's,(NEXT_ABI=)y,\1n,' $1/.config - ! echo $3 | grep -q '+shared' || \ - sed -ri 's,(SHARED_LIB=)n,\1y,' $1/.config - ! echo $3 | grep -q '+debug' || ( \ - sed -ri 's,(RTE_LOG_LEVEL=).*,\1RTE_LOG_DEBUG,' $1/.config - sed -ri 's,(_DEBUG.*=)n,\1y,' $1/.config - sed -ri 's,(_STAT.*=)n,\1y,' $1/.config - sed -ri 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config ) - - # Automatic configuration - test "$DPDK_DEP_NUMA" != y || \ - sed -ri 's,(NUMA=)n,\1y,' $1/.config - sed -ri 's,(LIBRTE_IEEE1588=)n,\1y,' $1/.config - sed -ri 's,(BYPASS=)n,\1y,' $1/.config - test "$DPDK_DEP_ARCHIVE" != y || \ - sed -ri 's,(RESOURCE_TAR=)n,\1y,' $1/.config - test "$DPDK_DEP_MOFED" != y || \ - sed -ri 's,(MLX._PMD=)n,\1y,' $1/.config - test "$DPDK_DEP_SZE" != y || \ - sed -ri 's,(PMD_SZEDATA2=)n,\1y,' $1/.config - test "$DPDK_DEP_ZLIB" != y || \ - sed -ri 's,(BNX2X_PMD=)n,\1y,' $1/.config - sed -ri 's,(NFP_PMD=)n,\1y,' $1/.config - test "$DPDK_DEP_PCAP" != y || \ - sed -ri 's,(PCAP=)n,\1y,' $1/.config - test -z "$AESNI_MULTI_BUFFER_LIB_PATH" || \ - sed -ri 's,(PMD_AESNI_MB=)n,\1y,' $1/.config - test -z "$AESNI_MULTI_BUFFER_LIB_PATH" || \ - sed -ri 's,(PMD_AESNI_GCM=)n,\1y,' $1/.config - test -z "$LIBSSO_SNOW3G_PATH" || \ - sed -ri 's,(PMD_SNOW3G=)n,\1y,' $1/.config - test -z "$LIBSSO_KASUMI_PATH" || \ - sed -ri 's,(PMD_KASUMI=)n,\1y,' $1/.config - test -z "$LIBSSO_ZUC_PATH" || \ - sed -ri 's,(PMD_ZUC=)n,\1y,' $1/.config - test "$DPDK_DEP_SSL" != y || \ - sed -ri 's,(PMD_OPENSSL=)n,\1y,' $1/.config - test "$DPDK_DEP_SSL" != y || \ - sed -ri 's,(PMD_QAT=)n,\1y,' $1/.config - sed -ri 's,(KNI_VHOST.*=)n,\1y,' $1/.config - sed -ri 's,(SCHED_.*=)n,\1y,' $1/.config - build_config_hook $1 $2 $3 - - # Explicit enabler/disabler (uppercase) - for option in $(echo $3 | sed 's,[~+], &,g') ; do - pattern=$(echo $option | cut -c2-) - if echo $option | grep -q '^~' ; then - sed -ri "s,($pattern=)y,\1n," $1/.config - elif echo $option | grep -q '^+' ; then - sed -ri "s,($pattern=)n,\1y," $1/.config - fi - done - fi -} - -# default empty hook to override in devel config -build_config_hook () # <directory> <target> <options> -{ - : -} - -for conf in $configs ; do - target=$(echo $conf | sed 's,[~+].*,,') - # reload config with DPDK_TARGET set - DPDK_TARGET=$target - reset_env - . $(dirname $(readlink -e $0))/load-devel-config - - options=$(echo $conf | sed 's,[^~+]*,,') - dir=$conf - config $dir $target $options - - echo "================== Build $dir" - make -j$J EXTRA_CFLAGS="$maxerr $DPDK_DEP_CFLAGS" \ - EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose O=$dir - ! $short || break - echo "================== Build examples for $dir" - export RTE_SDK=$(pwd) - export RTE_TARGET=$dir - make -j$J -sC examples \ - EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose \ - O=$(readlink -m $dir/examples) - ! echo $target | grep -q '^x86_64' || \ - make -j$J -sC examples/performance-thread \ - EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose \ - O=$(readlink -m $dir/examples/performance-thread) - unset RTE_TARGET - echo "################## $dir done." - unset dir -done - -if ! $short ; then - mkdir -p .check - echo "================== Build doxygen HTML API" - make doc-api-html >/dev/null 2>.check/doc.txt - echo "================== Build sphinx HTML guides" - make doc-guides-html >/dev/null 2>>.check/doc.txt - echo "================== Check docs" - diff -u /dev/null .check/doc.txt -fi - -success=true diff --git a/scripts/test-null.sh b/scripts/test-null.sh deleted file mode 100755 index 30cd0b031c..0000000000 --- a/scripts/test-null.sh +++ /dev/null @@ -1,45 +0,0 @@ -#! /bin/sh -e - -# BSD LICENSE -# -# Copyright 2015 6WIND S.A. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of 6WIND S.A. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Run a quick testpmd forwarding with null PMD without hugepage - -build=${1:-build} -coremask=${2:-3} # default using cores 0 and 1 - -if grep -q SHARED_LIB=y $build/.config; then - pmd='-d librte_pmd_null.so' -fi - -(sleep 1 && echo stop) | -$build/app/testpmd -c $coremask -n 1 --no-huge \ - $pmd --vdev net_null1 --vdev net_null2 -- \ - --total-num-mbufs=2048 -ia diff --git a/scripts/validate-abi.sh b/scripts/validate-abi.sh deleted file mode 100755 index 52e4e7ae73..0000000000 --- a/scripts/validate-abi.sh +++ /dev/null @@ -1,262 +0,0 @@ -#!/bin/sh -# BSD LICENSE -# -# Copyright(c) 2015 Neil Horman. All rights reserved. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -TAG1=$1 -TAG2=$2 -TARGET=$3 -ABI_DIR=`mktemp -d -p /tmp ABI.XXXXXX` - -usage() { - echo "$0 <REV1> <REV2> <TARGET>" -} - -log() { - local level=$1 - shift - echo "$*" -} - -validate_tags() { - - if [ -z "$HASH1" ] - then - echo "invalid revision: $TAG1" - return - fi - if [ -z "$HASH2" ] - then - echo "invalid revision: $TAG2" - return - fi -} - -validate_args() { - if [ -z "$TAG1" ] - then - echo "Must Specify REV1" - return - fi - if [ -z "$TAG2" ] - then - echo "Must Specify REV2" - return - fi - if [ -z "$TARGET" ] - then - echo "Must Specify a build target" - fi -} - - -cleanup_and_exit() { - rm -rf $ABI_DIR - git checkout $CURRENT_BRANCH - exit $1 -} - -# Make sure we configure SHARED libraries -# Also turn off IGB and KNI as those require kernel headers to build -fixup_config() { - sed -i -e"$ a\CONFIG_RTE_BUILD_SHARED_LIB=y" config/defconfig_$TARGET - sed -i -e"$ a\CONFIG_RTE_NEXT_ABI=n" config/defconfig_$TARGET - sed -i -e"$ a\CONFIG_RTE_EAL_IGB_UIO=n" config/defconfig_$TARGET - sed -i -e"$ a\CONFIG_RTE_LIBRTE_KNI=n" config/defconfig_$TARGET - sed -i -e"$ a\CONFIG_RTE_KNI_KMOD=n" config/defconfig_$TARGET -} - -########################################### -#START -############################################ - -#trap on ctrl-c to clean up -trap cleanup_and_exit SIGINT - -if [ -z "$DPDK_MAKE_JOBS" ] -then - # This counts the number of cpus on the system - if [ -e /usr/bin/lscpu ] - then - DPDK_MAKE_JOBS=`lscpu -p=cpu | grep -v "#" | wc -l` - else - DPDK_MAKE_JOBS=1 - fi -fi - -#Save the current branch -CURRENT_BRANCH=`git branch | grep \* | cut -d' ' -f2` - -if [ -z "$CURRENT_BRANCH" ] -then - CURRENT_BRANCH=`git log --pretty=format:%H HEAD~1..HEAD` -fi - -if [ -n "$VERBOSE" ] -then - export VERBOSE=/dev/stdout -else - export VERBOSE=/dev/null -fi - -# Validate that we have all the arguments we need -res=$(validate_args) -if [ -n "$res" ] -then - echo $res - usage - cleanup_and_exit 1 -fi - -HASH1=$(git show -s --format=%H "$TAG1" -- 2> /dev/null | tail -1) -HASH2=$(git show -s --format=%H "$TAG2" -- 2> /dev/null | tail -1) - -# Make sure our tags exist -res=$(validate_tags) -if [ -n "$res" ] -then - echo $res - cleanup_and_exit 1 -fi - -# Make hashes available in output for non-local reference -TAG1="$TAG1 ($HASH1)" -TAG2="$TAG2 ($HASH2)" - -ABICHECK=`which abi-compliance-checker 2>/dev/null` -if [ $? -ne 0 ] -then - log "INFO" "Cant find abi-compliance-checker utility" - cleanup_and_exit 1 -fi - -ABIDUMP=`which abi-dumper 2>/dev/null` -if [ $? -ne 0 ] -then - log "INFO" "Cant find abi-dumper utility" - cleanup_and_exit 1 -fi - -log "INFO" "We're going to check and make sure that applications built" -log "INFO" "against DPDK DSOs from version $TAG1 will still run when executed" -log "INFO" "against DPDK DSOs built from version $TAG2." -log "INFO" "" - -# Check to make sure we have a clean tree -git status | grep -q clean -if [ $? -ne 0 ] -then - log "WARN" "Working directory not clean, aborting" - cleanup_and_exit 1 -fi - -# Move to the root of the git tree -cd $(dirname $0)/.. - -log "INFO" "Checking out version $TAG1 of the dpdk" -# Move to the old version of the tree -git checkout $HASH1 - -fixup_config - -# Checking abi compliance relies on using the dwarf information in -# The shared objects. Thats only included in the DSO's if we build -# with -g -export EXTRA_CFLAGS="$EXTRA_CFLAGS -g -O0" -export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -g" - -# Now configure the build -log "INFO" "Configuring DPDK $TAG1" -make config T=$TARGET O=$TARGET > $VERBOSE 2>&1 - -log "INFO" "Building DPDK $TAG1. This might take a moment" -make -j$DPDK_MAKE_JOBS O=$TARGET > $VERBOSE 2>&1 - -if [ $? -ne 0 ] -then - log "INFO" "THE BUILD FAILED. ABORTING" - cleanup_and_exit 1 -fi - -# Move to the lib directory -cd $TARGET/lib -log "INFO" "COLLECTING ABI INFORMATION FOR $TAG1" -for i in `ls *.so` -do - $ABIDUMP $i -o $ABI_DIR/$i-ABI-0.dump -lver $HASH1 -done -cd ../.. - -# Now clean the tree, checkout the second tag, and rebuild -git clean -f -d -git reset --hard -# Move to the new version of the tree -log "INFO" "Checking out version $TAG2 of the dpdk" -git checkout $HASH2 - -fixup_config - -# Now configure the build -log "INFO" "Configuring DPDK $TAG2" -make config T=$TARGET O=$TARGET > $VERBOSE 2>&1 - -log "INFO" "Building DPDK $TAG2. This might take a moment" -make -j$DPDK_MAKE_JOBS O=$TARGET > $VERBOSE 2>&1 - -if [ $? -ne 0 ] -then - log "INFO" "THE BUILD FAILED. ABORTING" - cleanup_and_exit 1 -fi - -cd $TARGET/lib -log "INFO" "COLLECTING ABI INFORMATION FOR $TAG2" -for i in `ls *.so` -do - $ABIDUMP $i -o $ABI_DIR/$i-ABI-1.dump -lver $HASH2 -done -cd ../.. - -# Start comparison of ABI dumps -for i in `ls $ABI_DIR/*-1.dump` -do - NEWNAME=`basename $i` - OLDNAME=`basename $i | sed -e"s/1.dump/0.dump/"` - LIBNAME=`basename $i | sed -e"s/-ABI-1.dump//"` - - if [ ! -f $ABI_DIR/$OLDNAME ] - then - log "INFO" "$OLDNAME DOES NOT EXIST IN $TAG1. SKIPPING..." - fi - - #compare the abi dumps - $ABICHECK -l $LIBNAME -old $ABI_DIR/$OLDNAME -new $ABI_DIR/$NEWNAME -done - -git reset --hard -log "INFO" "ABI CHECK COMPLETE. REPORTS ARE IN compat_report directory" -cleanup_and_exit 0