VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/tests/selftests/tdSelfTest3.py@ 78351

Last change on this file since 78351 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: tdSelfTest3.py 76553 2019-01-01 01:45:53Z vboxsync $
4
5"""
6Test Manager / Suite Self Test #3 - Bad XML input and other Failures.
7"""
8
9__copyright__ = \
10"""
11Copyright (C) 2010-2019 Oracle Corporation
12
13This file is part of VirtualBox Open Source Edition (OSE), as
14available from http://www.virtualbox.org. This file is free software;
15you can redistribute it and/or modify it under the terms of the GNU
16General Public License (GPL) as published by the Free Software
17Foundation, in version 2 as it comes in the "COPYING" file of the
18VirtualBox OSE distribution. VirtualBox OSE is distributed in the
19hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
20
21The contents of this file may alternatively be used under the terms
22of the Common Development and Distribution License Version 1.0
23(CDDL) only, as it comes in the "COPYING.CDDL" file of the
24VirtualBox OSE distribution, in which case the provisions of the
25CDDL are applicable instead of those of the GPL.
26
27You may elect to license modified versions of this file under the
28terms and conditions of either the GPL or the CDDL or both.
29"""
30__version__ = "$Revision: 76553 $"
31
32
33# Standard Python imports.
34import os;
35import sys;
36
37# Only the main script needs to modify the path.
38try: __file__
39except: __file__ = sys.argv[0];
40g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
41sys.path.append(g_ksValidationKitDir);
42
43# Validation Kit imports.
44from common import utils;
45from testdriver import reporter;
46from testdriver.base import TestDriverBase;
47
48
49class tdSelfTest3(TestDriverBase):
50 """
51 Test Manager / Suite Self Test #3 - Bad XML input and other Failures.
52 """
53
54 def __init__(self):
55 TestDriverBase.__init__(self);
56
57
58 def actionExecute(self):
59
60 # Testing PushHint/PopHint.
61 reporter.testStart('Negative XML #1');
62 oSubXmlFile = reporter.FileWrapperTestPipe();
63 oSubXmlFile.write('<Test timestamp="%s" name="foobar3">\n\n\t\n\r\n' % (utils.getIsoTimestamp(),));
64 oSubXmlFile.write('<Test timestamp="%s" name="sub3">' % (utils.getIsoTimestamp(),));
65 oSubXmlFile.write('<Test timestamp="%s" name="subsub1">' % (utils.getIsoTimestamp(),));
66 oSubXmlFile.close();
67 reporter.testDone();
68
69 # Missing end, like we had with IRPT at one time.
70 reporter.testStart('Negative XML #2 (IPRT)');
71 oSubXmlFile = reporter.FileWrapperTestPipe();
72 oSubXmlFile.write("""
73<?xml version="1.0" encoding="UTF-8" ?>
74<Test timestamp="2013-05-29T08:59:05.930602000Z" name="tstRTGetOpt">
75 <Test timestamp="2013-05-29T08:59:05.930656000Z" name="Basics">
76 <Passed timestamp="2013-05-29T08:59:05.930756000Z"/>
77 </Test>
78 <Test timestamp="2013-05-29T08:59:05.930995000Z" name="RTGetOpt - IPv4">
79 <Passed timestamp="2013-05-29T08:59:05.931036000Z"/>
80 </Test>
81 <Test timestamp="2013-05-29T08:59:05.931161000Z" name="RTGetOpt - MAC Address">
82 <Passed timestamp="2013-05-29T08:59:05.931194000Z"/>
83 </Test>
84 <Test timestamp="2013-05-29T08:59:05.931313000Z" name="RTGetOpt - Option w/ Index">
85 <Passed timestamp="2013-05-29T08:59:05.931357000Z"/>
86 </Test>
87 <Test timestamp="2013-05-29T08:59:05.931475000Z" name="RTGetOptFetchValue">
88 <Passed timestamp="2013-05-29T08:59:05.931516000Z"/>
89 </Test>
90 <Test timestamp="2013-05-29T08:59:05.931640000Z" name="RTGetOpt - bool on/off">
91 <Passed timestamp="2013-05-29T08:59:05.931687000Z"/>
92 </Test>
93 <Test timestamp="2013-05-29T08:59:05.931807000Z" name="Standard options">
94 <Passed timestamp="2013-05-29T08:59:05.931843000Z"/>
95 </Test>
96 <Test timestamp="2013-05-29T08:59:05.931963000Z" name="Options first">
97 <Passed timestamp="2013-05-29T08:59:05.932035000Z"/>
98 </Test>
99""");
100 oSubXmlFile.close();
101 oSubXmlFile = None;
102 reporter.testDone();
103
104 # The use of testFailure.
105 reporter.testStart('Using testFailure()');
106 reporter.testValue('value-name3', 12345678, 'times');
107 reporter.testFailure('failure detail message');
108 reporter.testDone();
109
110 return True;
111
112
113if __name__ == '__main__':
114 sys.exit(tdSelfTest3().main(sys.argv));
115
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette