Commit 0c6f3662 authored by emellor@ewan's avatar emellor@ewan
Browse files

Added Zope's test.py, and a unit test to sxp. This test itself isn't very

exciting, but it's there to encourage the creation of more interesting ones.  A
test target has been added to the main Makefile, and the one in tools/python.
Signed-off-by: default avatarEwan Mellor <ewan@xensource.com>
parent 705f8697
......@@ -36,6 +36,12 @@ build: kernels
$(MAKE) -C tools build
$(MAKE) -C docs build
# The test target is for unit tests that can run without an installation. Of
# course, many tests require a machine running Xen itself, and these are
# handled elsewhere.
test:
$(MAKE) -C tools/python test
# build and install everything into local dist directory
dist: DESTDIR=$(DISTDIR)/install
dist: dist-xen dist-kernels dist-tools dist-docs
......
......@@ -15,5 +15,8 @@ install: all
CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)"
endif
test:
export LD_LIBRARY_PATH=$$(readlink -f ../libxc):$$(readlink -f ../xenstore); python test.py -b -u
clean:
rm -rf build *.pyc *.pyo *.o *.a *~
The file test.py here is from the Zope project, and is Copyright (c) 2001,
2002 Zope Corporation and Contributors. This file is released under the Zope
Public License, version 2.0, a copy of which is in the file ZPL-2.0.
Zope Public License (ZPL) Version 2.0
-----------------------------------------------
This software is Copyright (c) Zope Corporation (tm) and
Contributors. All rights reserved.
This license has been certified as open source. It has also
been designated as GPL compatible by the Free Software
Foundation (FSF).
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
1. Redistributions in source code must retain the above
copyright notice, this list of conditions, and the following
disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions, and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
3. The name Zope Corporation (tm) must not be used to
endorse or promote products derived from this software
without prior written permission from Zope Corporation.
4. The right to distribute this software or to use it for
any purpose does not give you the right to use Servicemarks
(sm) or Trademarks (tm) of Zope Corporation. Use of them is
covered in a separate agreement (see
http://www.zope.com/Marks).
5. If any files are modified, you must cause the modified
files to carry prominent notices stating that you changed
the files and the date of any change.
Disclaimer
THIS SOFTWARE IS PROVIDED BY ZOPE CORPORATION ``AS IS''
AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
NO EVENT SHALL ZOPE CORPORATION OR ITS CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
This software consists of contributions made by Zope
Corporation and many individuals on behalf of Zope
Corporation. Specific attributions are listed in the
accompanying credits file.
\ No newline at end of file
......@@ -42,7 +42,9 @@ setup(name = 'xen',
'xen.xend.xenstore',
'xen.xm',
'xen.web',
'xen.sv'
'xen.sv',
'xen.xend.tests'
],
ext_package = "xen.lowlevel",
ext_modules = [ xc, xs ]
......
This diff is collapsed.
import unittest
import xen.xend.sxp
class test_sxp(unittest.TestCase):
def testAllFromString(self):
def t(input, expected):
self.assertEqual(xen.xend.sxp.all_from_string(input), expected)
t('String', ['String'])
t('(String Thing)', [['String', 'Thing']])
t('(String) (Thing)', [['String'], ['Thing']])
def test_suite():
return unittest.makeSuite(test_sxp)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment