VirtualBox

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

Last change on this file since 103914 was 98651, checked in by vboxsync, 22 months ago

ValKit: pylint 2.16.2: checks for file

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