VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/tests/selftests/tdSelfTest2.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: 5.2 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: tdSelfTest2.py 98651 2023-02-20 13:10:54Z vboxsync $
4
5"""
6Test Manager / Suite Self Test #2 - Everything should succeed.
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 tdSelfTest2(TestDriverBase):
60 """
61 Test Manager / Suite Self Test #2 - Everything should succeed.
62 """
63
64 def __init__(self):
65 TestDriverBase.__init__(self);
66
67
68 def actionExecute(self):
69 reporter.testStart('reporter.testXXXX API');
70 reporter.testValue('value-name1', 123456789, 'ms');
71
72 reporter.testStart('subtest');
73 reporter.testValue('value-name2', 11223344, 'times');
74 reporter.testDone();
75
76 reporter.testStart('subtest2');
77 reporter.testValue('value-name3', 39, 'sec');
78 reporter.testValue('value-name4', 42, 'ns');
79 reporter.testDone();
80
81 reporter.testStart('subtest3');
82 reporter.testDone(fSkipped = True);
83
84 # No spaces in XML.
85 reporter.testStart('subtest4');
86 oSubXmlFile = reporter.FileWrapperTestPipe();
87 oSubXmlFile.write('<?xml version="1.0" encoding="UTF-8" ?>');
88 oSubXmlFile.write('<Test timestamp="%s" name="foobar1">' % (utils.getIsoTimestamp(),));
89 oSubXmlFile.write('<Test timestamp="%s" name="sub1">' % (utils.getIsoTimestamp(),));
90 oSubXmlFile.write('<Passed timestamp="%s"/>' % (utils.getIsoTimestamp(),));
91 oSubXmlFile.write('</Test>');
92 oSubXmlFile.write('<End timestamp="%s" errors="0"/>' % (utils.getIsoTimestamp(),));
93 oSubXmlFile.write('</Test>');
94 oSubXmlFile.close();
95 oSubXmlFile = None;
96 reporter.testDone();
97
98 # Spaces + funny line endings.
99 reporter.testStart('subtest5');
100 oSubXmlFile = reporter.FileWrapperTestPipe();
101 oSubXmlFile.write('<?xml version="1.0" encoding="UTF-8" ?>\r\n');
102 oSubXmlFile.write('<Test timestamp="%s" name="foobar2">\n\n\t\n\r\n' % (utils.getIsoTimestamp(),));
103 oSubXmlFile.write('<Test timestamp="%s" name="sub2">' % (utils.getIsoTimestamp(),));
104 oSubXmlFile.write(' <Passed timestamp="%s"/>\n' % (utils.getIsoTimestamp(),));
105 oSubXmlFile.write(' </Test>\n');
106 oSubXmlFile.write(' <End timestamp="%s" errors="0"/>\r' % (utils.getIsoTimestamp(),));
107 oSubXmlFile.write('</Test>');
108 oSubXmlFile.close();
109 reporter.testDone();
110
111 # A few long log times for WUI log testing.
112 reporter.log('long line: asdfasdfljkasdlfkjasldkfjlaksdfjl asdlfkjasdlkfjalskdfjlaksdjfa falkjaldkjfalskdjflaksdjf ' \
113 'lajksdflkjasdlfkjalsdfj asldfkjlaskdjflaksdjflaksdjflkj asdlfkjalsdkfjalsdkjflaksdj fasdlfkj ' \
114 'asdlkfj aljkasdflkj alkjdsf lakjsdf');
115 reporter.log('long line: asdfasdfljkasdlfkjasldkfjlaksdfjl asdlfkjasdlkfjalskdfjlaksdjfa falkjaldkjfalskdjflaksdjf ' \
116 'lajksdflkjasdlfkjalsdfj asldfkjlaskdjflaksdjflaksdjflkj asdlfkjalsdkfjalsdkjflaksdj fasdlfkj ' \
117 'asdlkfj aljkasdflkj alkjdsf lakjsdf');
118 reporter.log('long line: asdfasdfljkasdlfkjasldkfjlaksdfjl asdlfkjasdlkfjalskdfjlaksdjfa falkjaldkjfalskdjflaksdjf ' \
119 'lajksdflkjasdlfkjalsdfj asldfkjlaskdjflaksdjflaksdjflkj asdlfkjalsdkfjalsdkjflaksdj fasdlfkj ' \
120 'asdlkfj aljkasdflkj alkjdsf lakjsdf');
121
122 # Upload a file.
123 reporter.addLogFile(__file__, sKind = 'log/release/vm');
124
125 reporter.testDone();
126 return True;
127
128
129if __name__ == '__main__':
130 sys.exit(tdSelfTest2().main(sys.argv));
131
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