From: Panu Matilainen Date: Thu, 3 Dec 2015 14:05:26 +0000 (+0200) Subject: scripts: support any git revisions as ABI validation range X-Git-Tag: spdx-start~7831 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9cbae2aa64eb78b1214dd1aeb15d2b8f4e9d0ef8;p=dpdk.git scripts: support any git revisions as ABI validation range In addition to git tags, support validating abi between any legal gitrevisions(7) syntaxes, such as "validate-abi.sh -1 . " "validate-abi.sh master mybranch " etc in addition to validating between tags. Makes it easier to run the validator for in-development work. Signed-off-by: Panu Matilainen Acked-by: Neil Horman --- diff --git a/doc/guides/contributing/versioning.rst b/doc/guides/contributing/versioning.rst index 366c1945e3..d69a5c3ab3 100644 --- a/doc/guides/contributing/versioning.rst +++ b/doc/guides/contributing/versioning.rst @@ -469,16 +469,22 @@ utilities which can be installed via a package manager. For example:: The syntax of the ``validate-abi.sh`` utility is:: - ./scripts/validate-abi.sh + ./scripts/validate-abi.sh -Where ``TAG1`` and ``TAG2`` are valid git tags on the local repo and target is -the usual DPDK compilation target. +Where ``REV1`` and ``REV2`` are valid gitrevisions(7) +https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html +on the local repo and target is the usual DPDK compilation target. -For example to test the current committed HEAD against a previous release tag -we could add a temporary tag and run the utility as follows:: +For example: - git tag MY_TEMP_TAG - ./scripts/validate-abi.sh v2.0.0 MY_TEMP_TAG x86_64-native-linuxapp-gcc + # Check between the previous and latest commit: + ./scripts/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 + + # Check between git master and local topic-branch "vhost-hacking": + ./scripts/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/validate-abi.sh b/scripts/validate-abi.sh index cbf9d7f11c..8d7be24290 100755 --- a/scripts/validate-abi.sh +++ b/scripts/validate-abi.sh @@ -33,7 +33,7 @@ TARGET=$3 ABI_DIR=`mktemp -d -p /tmp ABI.XXXXXX` usage() { - echo "$0 " + echo "$0 " } log() { @@ -43,16 +43,15 @@ log() { } validate_tags() { - git tag -l | grep -q "$TAG1" - if [ $? -ne 0 ] + + if [ -z "$HASH1" ] then - echo "$TAG1 is invalid" + echo "invalid revision: $TAG1" return fi - git tag -l | grep -q "$TAG2" - if [ $? -ne 0 ] + if [ -z "$HASH2" ] then - echo "$TAG2 is invalid" + echo "invalid revision: $TAG2" return fi } @@ -60,12 +59,12 @@ validate_tags() { validate_args() { if [ -z "$TAG1" ] then - echo "Must Specify TAG1" + echo "Must Specify REV1" return fi if [ -z "$TAG2" ] then - echo "Must Specify TAG2" + echo "Must Specify REV2" return fi if [ -z "$TARGET" ] @@ -122,6 +121,9 @@ then cleanup_and_exit 1 fi +HASH1=$(git show -s --format=%H "$TAG1" -- 2> /dev/null) +HASH2=$(git show -s --format=%H "$TAG2" -- 2> /dev/null) + # Make sure our tags exist res=$(validate_tags) if [ -n "$res" ] @@ -130,6 +132,10 @@ then 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 @@ -145,8 +151,8 @@ then fi log "INFO" "We're going to check and make sure that applications built" -log "INFO" "against DPDK DSOs from tag $TAG1 will still run when executed" -log "INFO" "against DPDK DSOs built from tag $TAG2." +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 @@ -162,7 +168,7 @@ cd $(dirname $0)/.. log "INFO" "Checking out version $TAG1 of the dpdk" # Move to the old version of the tree -git checkout $TAG1 +git checkout $HASH1 fixup_config @@ -190,7 +196,7 @@ 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 $TAG1 + $ABIDUMP $i -o $ABI_DIR/$i-ABI-0.dump -lver $HASH1 done cd ../.. @@ -199,7 +205,7 @@ 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 $TAG2 +git checkout $HASH2 fixup_config @@ -220,7 +226,7 @@ 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 $TAG2 + $ABIDUMP $i -o $ABI_DIR/$i-ABI-1.dump -lver $HASH2 done cd ../..