From: Gareth S B. <bes...@us...> - 2005-06-02 17:24:05
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27703 Modified Files: Makefile.am wbemcat Added Files: xmltest Removed Files: xmltest.sh Log Message: renamed xmltest.sh to xmltest for convenience --- xmltest.sh DELETED --- Index: wbemcat =================================================================== RCS file: /cvsroot/sblim/sfcb/wbemcat,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- wbemcat 10 May 2005 18:00:37 -0000 1.3 +++ wbemcat 2 Jun 2005 17:23:53 -0000 1.4 @@ -1,5 +1,4 @@ #!/usr/bin/perl -# $Id: # ============================================================================ # wbemcat # @@ -14,7 +13,6 @@ # # Author: Adrian Schuur, <sc...@de...> # Contributors: Dr. Gareth S. Bestor, <bes...@us...> -# Last Updated: April 25, 2005 # Description: # Utility to send CIM-XML request file to a CIMOM and display # the response/results. Default CIMOM is localhost:5988. Index: Makefile.am =================================================================== RCS file: /cvsroot/sblim/sfcb/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Makefile.am 27 May 2005 22:49:54 -0000 1.21 +++ Makefile.am 2 Jun 2005 17:23:52 -0000 1.22 @@ -155,7 +155,7 @@ nodist_bin_SCRIPTS=sfcbrepos sfcbstage sfcbunstage -dist_bin_SCRIPTS=wbemcat xmltest.sh +dist_bin_SCRIPTS=wbemcat xmltest init_SCRIPTS=sfcb --- NEW FILE: xmltest --- #!/bin/sh # ============================================================================ # xmltest # # (C) Copyright IBM Corp. 2005 # # THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE # ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE # CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. # # You can obtain a current copy of the Common Public License from # http://oss.software.ibm.com/developerworks/opensource/license-cpl.html # # Author: Dr. Gareth S. Bestor, <bes...@us...> # Contributors: Adrian Schuur, <sc...@de...> # Description: # Simple test program to send CIM-XML test request files to a CIMOM and # compare the returned results to an expected response file. # If test file is specified then run only that test. If test directory is # specified then run all tests in the directory in sorted order. If no test # file or directory specified then run all tests in the current directory. # ============================================================================ _RC=0 # Check for wbemcat utility if ! which wbemcat > /dev/null; then echo "Cannot find wbemcat. Please check your PATH" exit 1 fi # ------------------------------------------------------------------------------ function _runxmltest { typeset _TESTXML=$1 _TEST=${_TESTXML%.xml} _TESTDIR=$( dirname $_TEST) _TESTOK=$_TEST.OK _TESTRESULT=$_TEST.result echo -n "Running test $_TESTXML ... " # Make sure we will be able to write the result file if [[ ! -w $_TESTDIR ]]; then echo "FAILED"; echo -e "\tCannot write to $_TESTDIR" continue fi # Remove any old test result file rm -f $_TESTRESULT # Send the test CIM-XML to the CIMOM and save the response, stripping off the http header wbemcat $_TESTXML | awk "{i++; if (i>7) print}" > $_TESTRESULT if [[ $? -ne 0 ]]; then echo "FAILED"; echo -e "\twbemcat failed to send CIM-XML request" _RC=1 continue fi # If we dont yet have the expected result file, then save this response as the (new) expected result if [[ ! -f $_TESTOK ]]; then echo "OK"; echo -e "\tSaving response as $_TESTOK" mv $_TESTRESULT $_TESTOK # Compare the response XML against the expected XML for differences elif ! diff --brief $_TESTOK $_TESTRESULT > /dev/null; then echo "FAILED"; echo -e "\tCheck $_TESTRESULT for errors" _RC=1; continue # We got the expected response XML else echo "Passed" rm -f $_TESTRESULT fi } # ------------------------------------------------------------------------------ if [[ -f $1 ]]; then _runxmltest $1 else if [[ -d $1 ]]; then _DIR=$1 else _DIR=$PWD fi # Look for all *.xml test files and run them in sorted order (hence tests should be numbered) find $_DIR -name "*.xml" | sort | while read _TESTXML; do _runxmltest $_TESTXML # Wait for the dust to settle before trying the next test... sleep 1 done fi exit $_RC |