direct-io.hg

changeset 2295:bf56990784b2

bitkeeper revision 1.1159.1.88 (4124b308xrxOcaDBfOP8TGkxArG9Yg)

Checking scripts for the things Xen needs for build and install.
author mjw@wray-m-3.hpl.hp.com
date Thu Aug 19 14:02:48 2004 +0000 (2004-08-19)
parents 709199bb8055
children 97a16adf6fc1 c43281038788
files .rootkeys tools/Makefile tools/check/Makefile tools/check/README tools/check/check_brctl tools/check/check_curl_devel tools/check/check_curl_lib tools/check/check_logging tools/check/check_python tools/check/check_ssl_lib tools/check/check_twisted tools/check/check_zlib_devel tools/check/check_zlib_lib tools/check/chk
line diff
     1.1 --- a/.rootkeys	Thu Aug 19 11:58:48 2004 +0000
     1.2 +++ b/.rootkeys	Thu Aug 19 14:02:48 2004 +0000
     1.3 @@ -246,6 +246,18 @@ 40f56a0ddHCSs3501MY4hRf22tctOw linux-2.6
     1.4  410a94a4KT6I6X0LVc7djB39tRDp4g linux-2.6.7-xen-sparse/mm/page_alloc.c
     1.5  40e1b09db5mN69Ijj0X_Eol-S7dXiw tools/Make.defs
     1.6  3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Makefile
     1.7 +4124b307nRyK3dhn1hAsvrY76NuV3g tools/check/Makefile
     1.8 +4124b307vHLUWbfpemVefmaWDcdfag tools/check/README
     1.9 +4124b307jt7T3CHysgl9LijNHSe1tA tools/check/check_brctl
    1.10 +4124b307HDX972-zihuZWXB7R8Vd0w tools/check/check_curl_devel
    1.11 +4124b307P3bZBkTFm6r-3XTbf0phAA tools/check/check_curl_lib
    1.12 +4124b307u-FeKvFP9kZnh0rLV0XjGg tools/check/check_logging
    1.13 +4124b307tRTjLqzRy60QrUoqN2Fhuw tools/check/check_python
    1.14 +4124b307KcYJMtZ7r48AF-wyhyw-SQ tools/check/check_ssl_lib
    1.15 +4124b307XdznSNCv97lrT3RpOdMM1A tools/check/check_twisted
    1.16 +4124b307lnAATmulpXYa0M-dzxLBDA tools/check/check_zlib_devel
    1.17 +4124b308ly20ptMKQoiztPyP_X68Mw tools/check/check_zlib_lib
    1.18 +4124b308O8yPHMKbj4YPR_grPGZmdA tools/check/chk
    1.19  401d7e160vaxMBAUSLSicuZ7AQjJ3w tools/examples/Makefile
    1.20  401d7e16UgeqroJQTIhwkrDVkoWgZQ tools/examples/README
    1.21  405ff55dawQyCHFEnJ067ChPRoXBBA tools/examples/init.d/xend
     2.1 --- a/tools/Makefile	Thu Aug 19 11:58:48 2004 +0000
     2.2 +++ b/tools/Makefile	Thu Aug 19 14:02:48 2004 +0000
     2.3 @@ -1,5 +1,6 @@
     2.4  
     2.5  all:	
     2.6 +	$(MAKE) -C check
     2.7  	$(MAKE) -C libxutil
     2.8  	$(MAKE) -C libxc
     2.9  	$(MAKE) -C misc
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/check/Makefile	Thu Aug 19 14:02:48 2004 +0000
     3.3 @@ -0,0 +1,16 @@
     3.4 +
     3.5 +all: build
     3.6 +
     3.7 +# Check this machine is OK for building on.
     3.8 +build:
     3.9 +	./chk build
    3.10 +
    3.11 +# Check this machine is OK for installing on.
    3.12 +# DO NOT use this check from 'make install' in the parent
    3.13 +# directory, as that target can be used to make an installable
    3.14 +# copy rather than actually installing.
    3.15 +install:
    3.16 +	./chk install
    3.17 +
    3.18 +clean:
    3.19 +	./chk clean
    3.20 \ No newline at end of file
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/check/README	Thu Aug 19 14:02:48 2004 +0000
     4.3 @@ -0,0 +1,20 @@
     4.4 +Checks for the suitability of a machine for Xen build or install.
     4.5 +To check for build suitability use
     4.6 +
     4.7 +        ./chk build
     4.8 +
     4.9 +To check for install suitability use
    4.10 +
    4.11 +        ./chk install
    4.12 +
    4.13 +The chk script will run checks in this directory and print
    4.14 +the ones that failed. It prints nothing if checks succeed.
    4.15 +The chk script exits with 0 on success and 1 on failure.
    4.16 +
    4.17 +The chk script runs executable files in this directory whose
    4.18 +names begin with 'check_'. Files containing CHECK-BUILD
    4.19 +are run for the build check, and files containing CHECK-INSTALL
    4.20 +are run for the install check.
    4.21 +
    4.22 +Detailed output from the check scripts is in .chkbuild for build
    4.23 +and .chkinstall for install.
    4.24 \ No newline at end of file
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tools/check/check_brctl	Thu Aug 19 14:02:48 2004 +0000
     5.3 @@ -0,0 +1,9 @@
     5.4 +#!/bin/bash
     5.5 +# CHECK-INSTALL
     5.6 +
     5.7 +function error {
     5.8 +   echo 'Check for the bridge control utils (brctl) failed.'
     5.9 +   exit 1
    5.10 +}
    5.11 +
    5.12 +brctl show || error
    5.13 \ No newline at end of file
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/tools/check/check_curl_devel	Thu Aug 19 14:02:48 2004 +0000
     6.3 @@ -0,0 +1,11 @@
     6.4 +#!/bin/bash
     6.5 +# CHECK-BUILD
     6.6 +
     6.7 +function error {
     6.8 +    echo 'Check for libcurl includes failed.'
     6.9 +    exit 1
    6.10 +}
    6.11 +
    6.12 +set -e
    6.13 +[ -e /usr/include/curl ] || error
    6.14 +[ -e /usr/include/curl/curl.h ] || error
    6.15 \ No newline at end of file
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/tools/check/check_curl_lib	Thu Aug 19 14:02:48 2004 +0000
     7.3 @@ -0,0 +1,10 @@
     7.4 +#!/bin/bash
     7.5 +# CHECK-BUILD CHECK-INSTALL
     7.6 +
     7.7 +function error {
     7.8 +        echo 'Check for CURL library failed.'
     7.9 +        exit 1
    7.10 +}
    7.11 +
    7.12 +set -e
    7.13 +ldconfig -p | grep libcurl.so || error
    7.14 \ No newline at end of file
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/tools/check/check_logging	Thu Aug 19 14:02:48 2004 +0000
     8.3 @@ -0,0 +1,31 @@
     8.4 +#!/usr/bin/env python
     8.5 +# CHECK-INSTALL
     8.6 +#  -*- mode: python; -*-
     8.7 +
     8.8 +import os
     8.9 +import sys
    8.10 +
    8.11 +def hline():
    8.12 +    print >>sys.stderr, "*" * 70
    8.13 +
    8.14 +def msg(message):
    8.15 +    print >>sys.stderr, "*" * 3, message
    8.16 +
    8.17 +def check_logging():
    8.18 +    """Check python logging is installed and raise an error if not.
    8.19 +    Logging is standard from Python 2.3 on.
    8.20 +    """
    8.21 +    try:
    8.22 +        import logging
    8.23 +    except ImportError:
    8.24 +        hline()
    8.25 +        msg("Python logging is not installed.")
    8.26 +        msg("Use 'make install-logging' at the xen root to install.")
    8.27 +        msg("")
    8.28 +        msg("Alternatively download and install from")
    8.29 +        msg("http://www.red-dove.com/python_logging.html")
    8.30 +        hline()
    8.31 +        sys.exit(1)
    8.32 +
    8.33 +if __name__ == '__main__':
    8.34 +    check_logging()
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/tools/check/check_python	Thu Aug 19 14:02:48 2004 +0000
     9.3 @@ -0,0 +1,10 @@
     9.4 +#!/bin/bash
     9.5 +# CHECK-BUILD CHECK-INSTALL
     9.6 +
     9.7 +function error {
     9.8 +    echo "Check for Python version 2.2 or higher failed."
     9.9 +    exit 1
    9.10 +}
    9.11 +
    9.12 +python -V
    9.13 +python -V 2>&1 | cut -d ' ' -f 2 | grep -q -E '^2.2|^2.3|^2.4' || error
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/tools/check/check_ssl_lib	Thu Aug 19 14:02:48 2004 +0000
    10.3 @@ -0,0 +1,10 @@
    10.4 +#!/bin/bash
    10.5 +# CHECK-BUILD CHECK-INSTALL
    10.6 +
    10.7 +function error {
    10.8 +    echo "Check for ssl library failed."
    10.9 +    exit 1
   10.10 +}
   10.11 +
   10.12 +set -e
   10.13 +ldconfig -p | grep libssl.so || error
   10.14 \ No newline at end of file
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/tools/check/check_twisted	Thu Aug 19 14:02:48 2004 +0000
    11.3 @@ -0,0 +1,46 @@
    11.4 +#!/usr/bin/env python
    11.5 +# CHECK-INSTALL
    11.6 +#  -*- mode: python; -*-
    11.7 +
    11.8 +import os
    11.9 +import sys
   11.10 +
   11.11 +def hline():
   11.12 +    print >>sys.stderr, "*" * 70
   11.13 +
   11.14 +def msg(message):
   11.15 +    print >>sys.stderr, "*" * 3, message
   11.16 +
   11.17 +def check_twisted_version():
   11.18 +    """Check twisted is installed with a supported version and print a warning if not.
   11.19 +    Raises an error if twisted is not installed.
   11.20 +    """
   11.21 +    # Supported twisted release and major version.
   11.22 +    RELEASE = 1
   11.23 +    MAJOR   = 3
   11.24 +    try:
   11.25 +        from twisted.copyright import version
   11.26 +    except ImportError:
   11.27 +        hline()
   11.28 +        msg("The Twisted framework is not installed.")
   11.29 +        msg("Use 'make install-twisted' at the xen root to install.")
   11.30 +        msg("")
   11.31 +        msg("Alternatively download and install version %d.%d or higher" % (RELEASE, MAJOR))
   11.32 +        msg("from http://www.twistedmatrix.com/products")
   11.33 +        hline()
   11.34 +        sys.exit(1)
   11.35 +        
   11.36 +    (release, major, minor) = version.split('.')
   11.37 +    release = int(release)
   11.38 +    major = int(major)
   11.39 +    if release > RELEASE: return
   11.40 +    if release == RELEASE and major >= MAJOR: return
   11.41 +    hline()
   11.42 +    msg("Warning: Twisted version not supported: %s" % version)
   11.43 +    msg("Use Twisted version %d.%d.0 or higher" % (RELEASE, MAJOR))
   11.44 +    hline()
   11.45 +    sys.exit(1)
   11.46 +
   11.47 +if __name__ == '__main__':
   11.48 +    check_twisted_version()
   11.49 +
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/tools/check/check_zlib_devel	Thu Aug 19 14:02:48 2004 +0000
    12.3 @@ -0,0 +1,10 @@
    12.4 +#!/bin/bash
    12.5 +# CHECK-BUILD
    12.6 +
    12.7 +function error {
    12.8 +    echo 'Check for zlib includes failed.'
    12.9 +    exit 1
   12.10 +}
   12.11 +
   12.12 +set -e
   12.13 +[ -e /usr/include/zlib.h ] || error
   12.14 \ No newline at end of file
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/tools/check/check_zlib_lib	Thu Aug 19 14:02:48 2004 +0000
    13.3 @@ -0,0 +1,10 @@
    13.4 +#!/bin/bash
    13.5 +# CHECK-BUILD CHECK-INSTALL
    13.6 +
    13.7 +function error {
    13.8 +    echo 'Check for zlib library failed.'
    13.9 +    exit 1
   13.10 +}
   13.11 +
   13.12 +set -e
   13.13 +ldconfig -p | grep libz.so || error
   13.14 \ No newline at end of file
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/tools/check/chk	Thu Aug 19 14:02:48 2004 +0000
    14.3 @@ -0,0 +1,70 @@
    14.4 +#!/bin/bash
    14.5 +
    14.6 +function usage {
    14.7 +    echo "Usage:"
    14.8 +    echo "\t$0 [build|install|clean]"
    14.9 +    echo
   14.10 +    echo "Check suitability for Xen build or install."
   14.11 +    echo "Exit with 0 if OK, 1 if not."
   14.12 +    echo "Prints only failed tests."
   14.13 +    echo
   14.14 +    echo "Calling with 'clean' removes generated files."
   14.15 +    exit 1
   14.16 +}
   14.17 +
   14.18 +case $1 in
   14.19 +    build)
   14.20 +        check="CHECK-BUILD"
   14.21 +        info=".chkbuild"
   14.22 +        ;;
   14.23 +    install)
   14.24 +        check="CHECK-INSTALL"
   14.25 +        info=".chkinstall"
   14.26 +        ;;
   14.27 +    clean)
   14.28 +        rm -f .chkbuild .chkinstall
   14.29 +        exit 0
   14.30 +        ;;
   14.31 +    *)
   14.32 +        usage
   14.33 +        ;;
   14.34 +esac
   14.35 +
   14.36 +failed=0
   14.37 +
   14.38 +echo "Xen ${check} " $(date) > ${info}
   14.39 +for f in check_* ; do
   14.40 +    case $f in
   14.41 +        *~)
   14.42 +            continue
   14.43 +            ;;
   14.44 +        *)
   14.45 +            ;;
   14.46 +    esac
   14.47 +    if ! [ -x $f ] ; then
   14.48 +        continue
   14.49 +    fi
   14.50 +    if ! grep -q ${check} $f ; then
   14.51 +        continue
   14.52 +    fi
   14.53 +    echo ' ' >> ${info}
   14.54 +    echo "Checking $f" >> ${info}
   14.55 +    if ./$f 1>>${info} 2>&1 ; then
   14.56 +        echo OK >> ${info}
   14.57 +    else
   14.58 +        failed=1
   14.59 +        echo "FAILED $f"
   14.60 +        echo FAILED >> ${info}
   14.61 +    fi
   14.62 +done
   14.63 +
   14.64 +echo >> ${info}
   14.65 +
   14.66 +if [ "$failed" == "1" ] ; then
   14.67 +    echo "Checks failed. See ${info} for details."
   14.68 +    echo "FAILED" >> ${info}
   14.69 +    exit 1
   14.70 +else
   14.71 +    echo "OK" >> ${info}
   14.72 +    exit 0
   14.73 +fi
   14.74 \ No newline at end of file