Skip to content

Commit 2223a1e

Browse files
authored
Merge pull request #5 from NikolSkvarilova/master
Fixed reporting locked mock failure to jtreg logs (Issue #3)
2 parents 9bdf57f + e16efc9 commit 2223a1e

20 files changed

+13
-35
lines changed

testcases/alternativesTests/binaries_test_paths.py

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ def __init__(self, binariesTest):
2121
self.list_of_failed_tests = []
2222
self.installed_binaries = {}
2323
self.installed_slaves = {}
24-
self.failed = 0
25-
self.passed = 0
2624

2725
def remove_binaries_without_slaves(self, args=None):
2826
return

testcases/alternativesTests/permissions_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ def __init__(self):
2929
super().__init__()
3030
self.list_of_failed_tests = []
3131
self.invalid_file_candidates = []
32-
self.failed = 0
33-
self.passed = 0
3432

3533
def _get_target_java_directory(self, name):
3634
"""Returns a directory where jdk is installed (mostly name-version-release-arch)."""

testcases/filesTest/filesTest.py

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ class Default(cs.JdkConfiguration):
1818
def __init__(self, rpms):
1919
super().__init__()
2020
self.rpms = rpms
21-
self.passed = 0
22-
self.failed = 0
2321
self.file_list = []
2422

2523
def _set_file_list(self):

testcases/linkTests/subdirectory_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ def __init__(self):
2121
super().__init__()
2222
self.list_of_failed_tests = []
2323
self.rpms = rc.RuntimeConfig().getRpmList()
24-
self.failed = 0
25-
self.passed = 0
2624

2725
def _get_arch(self):
2826
""" Returns architecture in 32 bit identifier """

testcases/linkTests/symlink_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ def __init__(self):
5353
super().__init__()
5454
self.list_of_failed_tests = []
5555
self.rpms = rc.RuntimeConfig().getRpmList()
56-
self.passed = 0
57-
self.failed = 0
5856

5957
# symlinks -r / have struct: typeOfSymlink: path -> points_at, split[2] = '->'
6058
def _symlink_parser(self, symlink_list):

testcases/manpagesTests/manpage_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ class ManpageTestMethods(JdkConfiguration):
4040
"""
4141
def __init__(self):
4242
super().__init__()
43-
self.passed = 0
44-
self.failed = 0
4543
self.list_of_failed_tests = []
4644
self.missing_manpages = []
4745
self.checked_subpackages = []

testcases/nameTest/initibuild_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
class InitTest(utils.core.base_xtest.BaseTest):
1515
def __init__(self):
1616
super().__init__()
17-
self.failed = 0
18-
self.passed = 0
1917

2018

2119
def test_java(self):

testcases/nameTest/name_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class NameTest(utils.core.base_xtest.BaseTest):
3131
test_* method, so the output would look like: test_1 = 37, test_2 = 37*2, test3=37*3 tests in total"""
3232
def __init__(self):
3333
super().__init__()
34-
self.failed = 0
35-
self.passed = 0
3634

3735
def aMatchesB(self, a, b):
3836
return self.csch.checkRegex(a)

testcases/nameTest/subpackages_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ class MainPackagePresent(JdkConfiguration):
1717

1818
def __init__(self):
1919
super().__init__()
20-
self.failed = 0
21-
self.passed = 0
2220

2321
def _getSubPackages(self):
2422
return set([""])

testcases/packageTest/emptyPackages_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
class EmptyPackageTest(utils.core.base_xtest.BaseTest):
1414
def __init__(self):
1515
super().__init__()
16-
self.passed = 0
17-
self.failed = 0
1816

1917
def test_checkNoPacakgeEmpty(self):
2018
pkgs= config.runtime_config.RuntimeConfig().getRpmList().getAllFiles()

testcases/priorityTest/postinstall_master_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class BasePackages(JdkConfiguration):
2727

2828
def __init__(self):
2929
super().__init__()
30-
self.passed = 0
31-
self.failed = 0
3230

3331
def _get_arch(self):
3432
return PostinstallScriptTest.instance.getCurrentArch()

testcases/priorityTest/priority_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ def __init__(self, length, prefix):
3737
self.length = length
3838
self.prefix = prefix
3939
self.list_of_failed_tests = []
40-
self.passed = 0
41-
self.failed = 0
4240

4341
def _get_priority(self, master):
4442
""" This method calls chroot in mock and gets priority from pre-configured methods. """

testcases/providesTests/ghost_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ def setCSCH(self):
4848
class Default(cs.JdkConfiguration):
4949
def __init__(self):
5050
super().__init__()
51-
self.passed = 0
52-
self. failed = 0
5351
self.expected_ghosts = {}
5452

5553
def _get_hardcoded_ghosts(self, file):

testcases/providesTests/provides_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ def __init__(self, this):
2121
super().__init__()
2222
self.rpms = rc.RuntimeConfig().getRpmList()
2323
self.this=this
24-
self.passed = 0
25-
self.failed = 0
2624

2725
def _get_artificial_provides(self, filename):
2826
output, error, res = pu.executeShell("rpm -q --provides rpms/" + filename)

testcases/scripletTests/scriplet_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
class TestTest(utils.core.base_xtest.BaseTest):
1212
def __init__(self):
1313
super().__init__()
14-
self.passed = 0
15-
self.failed = 0
1614

1715
# this test has no asserts, therefore it is not working properly, must be fixed, now gives 0 passes, 0 fails
1816
def test_allScripletsPresentedAsExpected(self):

testcases/virtualDeps/obsolete_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
class Base(JdkConfiguration):
1616
def __init__(self):
1717
super().__init__()
18-
self.failed = 0
19-
self.passed = 0
2018

2119

2220
class ITW(Base):

utils/core/base_xtest.py

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ def defaultMain(argv, runDocs, runTests):
2222

2323

2424
class BaseTest(BaseTestRunner):
25+
def __init__(self):
26+
super().__init__()
27+
self.failed = 0
28+
self.passed = 0
2529

2630
def getBuild(self):
2731
return config.runtime_config.RuntimeConfig().getRpmList().getBuildWithoutSrpm(self.current_arch)

utils/core/configuration_specific.py

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ class JdkConfiguration():
77

88
def __init__(self):
99
self.documenting = False
10+
self.failed = 0
11+
self.passed = 0
1012

1113
def _document(self, message):
1214
"""Documentation used to generate specification-specific lines"""

utils/mock/mock_executor.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ def _rollbackCommand(self, name):
133133
def _scrubLvmCommand(self):
134134
o, e, r = exxec.processToStringsWithResult(self.mainCommand() + ["--scrub", "all"])
135135
if r != 0:
136-
raise utils.mock.mock_execution_exception.MockExecutionException("Build chroot is locked, please restart "
137-
"the testsuite.")
136+
failed = "Build chroot is locked, please restart the testsuite."
137+
tu.passed_or_failed(self, False, failed)
138+
raise utils.mock.mock_execution_exception.MockExecutionException(failed)
138139
outputControl.logging_access.LoggingAccess().log(e, la.Verbosity.MOCK)
139140
outputControl.logging_access.LoggingAccess().log(o, la.Verbosity.MOCK)
140141
outputControl.logging_access.LoggingAccess().log(str(self.listSnapshots()), la.Verbosity.MOCK)

utils/test_utils.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#must do otherway in case of cyclic dependencies
1111
import utils.mock.mock_executor as mexe
1212

13+
from utils.core.configuration_specific import JdkConfiguration
14+
from utils.core.base_xtest import BaseTest
1315

1416
def closeTestSuite(passed, failed, mtc):
1517
la.LoggingAccess().stdout("Arch-independet mehtods counted: " + str(mtc))
@@ -193,7 +195,8 @@ def passed_or_failed(instance, bool, iffailed, ifpassed=""):
193195
if ifpassed != "":
194196
la.LoggingAccess().log(" " + ifpassed, la.Verbosity.TEST)
195197
else:
196-
instance.failed += 1
198+
if issubclass(instance.__class__, (JdkConfiguration, BaseTest)):
199+
instance.failed += 1
197200
la.LoggingAccess().log(" " + iffailed, la.Verbosity.TEST)
198201
testcase.set_view_file_stub(iffailed)
199202
return bool

0 commit comments

Comments
 (0)