cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#!/usr/bin/env python
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# -*- coding: utf-8 -*-
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# $Id$
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync"""
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncTest Manager / Suite Self Test #3 - Bad XML input and other Failures.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync"""
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync__copyright__ = \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync"""
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncCopyright (C) 2010-2014 Oracle Corporation
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThis file is part of VirtualBox Open Source Edition (OSE), as
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncavailable from http://www.virtualbox.org. This file is free software;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncyou can redistribute it and/or modify it under the terms of the GNU
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncGeneral Public License (GPL) as published by the Free Software
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncFoundation, in version 2 as it comes in the "COPYING" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution. VirtualBox OSE is distributed in the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsynchope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThe contents of this file may alternatively be used under the terms
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncof the Common Development and Distribution License Version 1.0
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync(CDDL) only, as it comes in the "COPYING.CDDL" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution, in which case the provisions of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncCDDL are applicable instead of those of the GPL.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncYou may elect to license modified versions of this file under the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncterms and conditions of either the GPL or the CDDL or both.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync"""
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync__version__ = "$Revision$"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Standard Python imports.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport os;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport sys;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Only the main script needs to modify the path.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsynctry: __file__
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncexcept: __file__ = sys.argv[0];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncg_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncsys.path.append(g_ksValidationKitDir);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Validation Kit imports.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom common import utils;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testdriver import reporter;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testdriver.base import TestDriverBase;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncclass tdSelfTest3(TestDriverBase):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Test Manager / Suite Self Test #3 - Bad XML input and other Failures.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def __init__(self):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync TestDriverBase.__init__(self);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def actionExecute(self):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Testing PushHint/PopHint.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart('Negative XML #1');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSubXmlFile = reporter.FileWrapperTestPipe();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSubXmlFile.write('<Test timestamp="%s" name="foobar3">\n\n\t\n\r\n' % (utils.getIsoTimestamp(),));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSubXmlFile.write('<Test timestamp="%s" name="sub3">' % (utils.getIsoTimestamp(),));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSubXmlFile.write('<Test timestamp="%s" name="subsub1">' % (utils.getIsoTimestamp(),));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSubXmlFile.close();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Missing end, like we had with IRPT at one time.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart('Negative XML #2 (IPRT)');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSubXmlFile = reporter.FileWrapperTestPipe();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSubXmlFile.write("""
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync<?xml version="1.0" encoding="UTF-8" ?>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync<Test timestamp="2013-05-29T08:59:05.930602000Z" name="tstRTGetOpt">
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Test timestamp="2013-05-29T08:59:05.930656000Z" name="Basics">
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Passed timestamp="2013-05-29T08:59:05.930756000Z"/>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync </Test>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Test timestamp="2013-05-29T08:59:05.930995000Z" name="RTGetOpt - IPv4">
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Passed timestamp="2013-05-29T08:59:05.931036000Z"/>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync </Test>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Test timestamp="2013-05-29T08:59:05.931161000Z" name="RTGetOpt - MAC Address">
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Passed timestamp="2013-05-29T08:59:05.931194000Z"/>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync </Test>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Test timestamp="2013-05-29T08:59:05.931313000Z" name="RTGetOpt - Option w/ Index">
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Passed timestamp="2013-05-29T08:59:05.931357000Z"/>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync </Test>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Test timestamp="2013-05-29T08:59:05.931475000Z" name="RTGetOptFetchValue">
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Passed timestamp="2013-05-29T08:59:05.931516000Z"/>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync </Test>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Test timestamp="2013-05-29T08:59:05.931640000Z" name="RTGetOpt - bool on/off">
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Passed timestamp="2013-05-29T08:59:05.931687000Z"/>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync </Test>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Test timestamp="2013-05-29T08:59:05.931807000Z" name="Standard options">
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Passed timestamp="2013-05-29T08:59:05.931843000Z"/>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync </Test>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Test timestamp="2013-05-29T08:59:05.931963000Z" name="Options first">
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync <Passed timestamp="2013-05-29T08:59:05.932035000Z"/>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync </Test>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync""");
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSubXmlFile.close();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSubXmlFile = None;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # The use of testFailure.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart('Using testFailure()');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testValue('value-name3', 12345678, 'times');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testFailure('failure detail message');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testDone();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return True;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncif __name__ == '__main__':
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sys.exit(tdSelfTest3().main(sys.argv));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync