[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] tools/tests: Add syntax check for different versions of python



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1248795488 -3600
# Node ID 298a35c11ad16a3f8a33c215aa3553d03db9437d
# Parent  49ea12238cf9a71a8783064f61bd9c23982081c0
tools/tests: Add syntax check for different versions of python

From: Andreas Florath <xen@xxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 .hgignore                                             |    3 
 tools/tests/regression/Makefile                       |   83 ++++++++++++++++++
 tools/tests/regression/README                         |   39 ++++++++
 tools/tests/regression/scripts/build_python.sh        |   24 +++++
 tools/tests/regression/scripts/check_python_syntax.sh |   19 ++++
 tools/tests/regression/scripts/download_python.sh     |   12 ++
 6 files changed, 180 insertions(+)

diff -r 49ea12238cf9 -r 298a35c11ad1 .hgignore
--- a/.hgignore Tue Jul 28 16:34:16 2009 +0100
+++ b/.hgignore Tue Jul 28 16:38:08 2009 +0100
@@ -209,6 +209,9 @@
 ^tools/tests/blowfish\.h$
 ^tools/tests/test_x86_emulator$
 ^tools/tests/x86_emulate$
+^tools/tests/regression/installed/.*$
+^tools/tests/regression/build/.*$
+^tools/tests/regression/downloads/.*$
 ^tools/vnet/Make.local$
 ^tools/vnet/build/.*$
 ^tools/vnet/gc$
diff -r 49ea12238cf9 -r 298a35c11ad1 tools/tests/regression/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/tests/regression/Makefile   Tue Jul 28 16:38:08 2009 +0100
@@ -0,0 +1,83 @@
+#
+# Sets up some regression applications
+# Runs regression tests
+#
+# To run this, at least the basic build / development environment must
+# be installed (gcc, ...)
+#
+XEN_ROOT=${PWD}/..
+
+PYTHON_VERSIONS=python-2.3 python-2.4 python-2.5 python-2.6 python-3.1
+
+.PHONY: all
+all: check-python-syntax
+
+.PHONY: check-python-syntax
+check-python-syntax: runtime-environment
+       @(set -e && for p in ${PYTHON_VERSIONS}; do \
+         ${XEN_ROOT}/tests/scripts/check_python_syntax.sh ${XEN_ROOT} $$p; 
done)
+
+.PHONY: runtime-environment
+runtime-environment: ${PYTHON_VERSIONS}
+
+.PHONY: dist-clean
+dist-clean:
+       rm -fr ${XEN_ROOT}/tests/installed ${XEN_ROOT}/tests/downloads \
+               ${XEN_ROOT}/tests/build
+
+### Python 2.3
+
+.PHONY: python-2.3
+python-2.3: ${XEN_ROOT}/tests/installed/python-2.3/bin/python2.3
+
+${XEN_ROOT}/tests/installed/python-2.3/bin/python2.3: \
+       ${XEN_ROOT}/tests/downloads/Python-2.3.7.tgz
+       @${XEN_ROOT}/tests/scripts/build_python.sh ${XEN_ROOT} 2.3 2.3.7
+${XEN_ROOT}/tests/downloads/Python-2.3.7.tgz:
+       @${XEN_ROOT}/tests/scripts/download_python.sh ${XEN_ROOT} 2.3.7
+
+### Python 2.4
+
+.PHONY: python-2.4
+python-2.4: ${XEN_ROOT}/tests/installed/python-2.4/bin/python2.4
+
+${XEN_ROOT}/tests/installed/python-2.4/bin/python2.4: \
+       ${XEN_ROOT}/tests/downloads/Python-2.4.6.tgz
+       @${XEN_ROOT}/tests/scripts/build_python.sh ${XEN_ROOT} 2.4 2.4.6
+${XEN_ROOT}/tests/downloads/Python-2.4.6.tgz:
+       @${XEN_ROOT}/tests/scripts/download_python.sh ${XEN_ROOT} 2.4.6
+
+### Python 2.5
+
+.PHONY: python-2.5
+python-2.5: ${XEN_ROOT}/tests/installed/python-2.5/bin/python2.5
+
+${XEN_ROOT}/tests/installed/python-2.5/bin/python2.5: \
+       ${XEN_ROOT}/tests/downloads/Python-2.5.4.tgz
+       @${XEN_ROOT}/tests/scripts/build_python.sh ${XEN_ROOT} 2.5 2.5.4
+${XEN_ROOT}/tests/downloads/Python-2.5.4.tgz:
+       @${XEN_ROOT}/tests/scripts/download_python.sh ${XEN_ROOT} 2.5.4
+
+### Python 2.6
+
+.PHONY: python-2.6
+python-2.6: ${XEN_ROOT}/tests/installed/python-2.6/bin/python2.6
+
+${XEN_ROOT}/tests/installed/python-2.6/bin/python2.6: \
+       ${XEN_ROOT}/tests/downloads/Python-2.6.2.tgz
+       @${XEN_ROOT}/tests/scripts/build_python.sh ${XEN_ROOT} 2.6 2.6.2
+${XEN_ROOT}/tests/downloads/Python-2.6.2.tgz:
+       @${XEN_ROOT}/tests/scripts/download_python.sh ${XEN_ROOT} 2.6.2
+
+### Python 3.0.1 has reached end of life and is not (longer) supported
+
+### Python 3.1
+
+.PHONY: python-3.1
+python-3.1: ${XEN_ROOT}/tests/installed/python-3.1/bin/python3.1
+
+${XEN_ROOT}/tests/installed/python-3.1/bin/python3.1: \
+       ${XEN_ROOT}/tests/downloads/Python-3.1.tgz
+       @${XEN_ROOT}/tests/scripts/build_python.sh ${XEN_ROOT} 3.1 3.1
+${XEN_ROOT}/tests/downloads/Python-3.1.tgz:
+       @${XEN_ROOT}/tests/scripts/download_python.sh ${XEN_ROOT} 3.1
diff -r 49ea12238cf9 -r 298a35c11ad1 tools/tests/regression/README
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/tests/regression/README     Tue Jul 28 16:38:08 2009 +0100
@@ -0,0 +1,39 @@
+
+Regression Test Environment for Xen
+-------------------------------------
+
+This is an initial regression tool environment for Xen.
+
+With the help of the Makefile, it is possible to compile a couple of
+different python versions and check all .py files against all verions
+for syntax errors.  Note that due to the dynmic of python not all
+syntax errors might be detected.
+
+Currently the following versions of python are supported:
+2.3.7 2.4.6 2.5.4 2.6.2 3.1
+
+
+Usage
+-----
+
+To download all supported versions of python, compile them, install
+them and run a basic syntax check, run
+
+$ make
+
+(The download and compilation of python is only done if not already
+available.)
+
+To delete all automatically build files:
+
+$ make dist-clean
+
+
+
+Runing unittests with a specific version
+----------------------------------------
+
+This does not work at the moment, because a lot of additional python
+packages are needed for this (which are currently not automatically
+build).
+
diff -r 49ea12238cf9 -r 298a35c11ad1 
tools/tests/regression/scripts/build_python.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/tests/regression/scripts/build_python.sh    Tue Jul 28 16:38:08 
2009 +0100
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# This script builds python in the dir 
+# installed/python-${DEST} from package downloads/Python-{PKG_VERS}.tgz
+#
+
+set -e
+
+XEN_ROOT=$1
+DEST=$2
+PKG_VERS=$3
+
+SUB_MAKES_MINUS_J=-j4
+
+BUILD_DIR=${XEN_ROOT}/tests/build
+
+mkdir -p ${BUILD_DIR}
+(cd ${BUILD_DIR} && tar -xf ${XEN_ROOT}/tests/downloads/Python-$PKG_VERS.tgz)
+(cd ${BUILD_DIR}/Python-$PKG_VERS &&
+ ./configure --enable-shared --enable-ipv6 --without-cxx \
+       --with-threads --prefix=${XEN_ROOT}/tests/installed/python-$DEST &&
+make ${SUB_MAKES_MINUS_J} &&
+make install)
+rm -fr ${BUILD_DIR}/Python-$PKG_VERS
diff -r 49ea12238cf9 -r 298a35c11ad1 
tools/tests/regression/scripts/check_python_syntax.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/tests/regression/scripts/check_python_syntax.sh     Tue Jul 28 
16:38:08 2009 +0100
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Checks the syntax of all .py files
+# (compiles them into .pyc files)
+#
+
+XEN_ROOT=$1
+p=$2
+
+echo "Syntax check for $p"
+PYTHON_EXECUTABLE=`echo $p | tr -d "-"`
+export LD_LIBRARY_PATH=${XEN_ROOT}/tests/installed/$p/lib
+export PATH=${XEN_ROOT}/tests/installed/$p/bin:$PATH
+# -m is available starting with python 2.4
+# When support for 2.3 (and earlier) is dropped,
+# the following line will do.
+# ${PYTHON_EXECUTABLE} -m compileall -f -q -x 
".*\.hg.*|^\.\./tests/installed.*" ..
+${PYTHON_EXECUTABLE} 
${XEN_ROOT}/tests/installed/$p/lib/${PYTHON_EXECUTABLE}/compileall.py -f -q -x 
".*\.hg.*|.*/tests/installed.*" ..
+exit $?
diff -r 49ea12238cf9 -r 298a35c11ad1 
tools/tests/regression/scripts/download_python.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/tests/regression/scripts/download_python.sh Tue Jul 28 16:38:08 
2009 +0100
@@ -0,0 +1,12 @@
+#!/bin/bash
+#
+# Downloads python with version $1 and stores in into the downloads dir.
+#
+
+set -e
+
+XEN_ROOT=$1
+VERSION=$2
+
+mkdir -p ${XEN_ROOT}/tests/downloads
+wget -q -O ${XEN_ROOT}/tests/downloads/Python-${VERSION}.tgz 
http://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.