[Spice-commits] server/Makefile.am server/tests

Alon Levy alon at kemper.freedesktop.org
Mon Sep 3 03:55:23 PDT 2012


 server/Makefile.am                 |    3 ++
 server/tests/test_spice_version.sh |   42 +++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

New commits:
commit 078742b0ee05120c5f7a6f06d117ce10c68afe7a
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Sep 3 10:31:02 2012 +0300

    server: add dist-hook to prevent spice version configure/spice.h difference

diff --git a/server/Makefile.am b/server/Makefile.am
index 16c8b6d..18a9d8a 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -127,3 +127,6 @@ EXTRA_DIST =					\
 	$(NULL)
 
 BUILT_SOURCES = $(spice_built_sources)
+
+dist-hook:
+	if ! ./tests/test_spice_version.sh ; then exit 1; fi
diff --git a/server/tests/test_spice_version.sh b/server/tests/test_spice_version.sh
new file mode 100755
index 0000000..5e5b173
--- /dev/null
+++ b/server/tests/test_spice_version.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+ROOT=$(dirname $0)/../../
+INCLUDE="-I$ROOT -I$ROOT/spice-common/spice-protocol/"
+TEMP=`mktemp -d`
+
+cat > $TEMP/check_version.c <<EOF
+#include <stdio.h>
+#include "server/spice.h"
+
+int main(void)
+{
+        printf("%d.%d.%d\n", SPICE_SERVER_VERSION >> 16,
+               (SPICE_SERVER_VERSION >> 8) & 0xff,
+               SPICE_SERVER_VERSION & 0xff);
+        return 0;
+}
+EOF
+
+if ! gcc -o $TEMP/check_version $INCLUDE $TEMP/check_version.c ; then
+    echo "failed to compile tester"
+    exit -1
+fi
+
+INCLUDE_VERSION=`$TEMP/check_version`
+rm -Rf $TEMP
+
+CONF_MAJOR=`cat $ROOT/configure.ac | grep 'm4_define(\[SPICE_MAJOR\]' | sed -e 's/m4_define(\[SPICE_MAJOR\],\(.*\))/\1/'`
+CONF_MINOR=`cat $ROOT/configure.ac | grep 'm4_define(\[SPICE_MINOR\]' | sed -e 's/m4_define(\[SPICE_MINOR\],\(.*\))/\1/'`
+CONF_MICRO=`cat $ROOT/configure.ac | grep 'm4_define(\[SPICE_MICRO\]' | sed -e 's/m4_define(\[SPICE_MICRO\],\(.*\))/\1/'`
+CONF_VERSION=`printf %d.%d.%d $CONF_MAJOR $CONF_MINOR $CONF_MICRO`
+if [ $CONF_VERSION != $INCLUDE_VERSION ] ; then
+    echo "BAD: version in server/spice.h"
+    echo $INCLUDE_VERSION
+    echo "doesn't match version in configure.ac"
+    echo $CONF_VERSION
+    echo "please fix before doing a release"
+    exit 1
+else
+    echo "OK: both versions are $CONF_VERSION"
+fi
+exit 0


More information about the Spice-commits mailing list