Skip to content

Commit 0cb857e

Browse files
committedNov 7, 2022
Added test result printer and failing return code to all test related main methods.
Added module test script for ext prov and normal prov.
1 parent a891210 commit 0cb857e

File tree

79 files changed

+649
-172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+649
-172
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package org.bouncycastle;
2+
3+
4+
import java.util.Enumeration;
5+
6+
import junit.framework.TestFailure;
7+
import junit.framework.TestResult;
8+
9+
public class PrintTestResult
10+
{
11+
public static void printResult(TestResult result)
12+
{
13+
Enumeration e = result.failures();
14+
if (e != null)
15+
{
16+
while (e.hasMoreElements())
17+
{
18+
System.out.println(e.nextElement());
19+
}
20+
}
21+
22+
e = result.errors();
23+
if (e != null)
24+
{
25+
while (e.hasMoreElements())
26+
{
27+
System.out.println(e.nextElement());
28+
}
29+
}
30+
31+
if (!result.wasSuccessful())
32+
{
33+
System.exit(1);
34+
}
35+
}
36+
}
37+

‎core/src/test/java/org/bouncycastle/asn1/test/AllTests.java

+11-10
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,40 @@
44
import junit.framework.Test;
55
import junit.framework.TestCase;
66
import junit.framework.TestSuite;
7+
import org.bouncycastle.PrintTestResult;
78
import org.bouncycastle.util.test.SimpleTestResult;
89

910
public class AllTests
1011
extends TestCase
1112
{
1213
public void testASN1()
13-
{
14+
{
1415
org.bouncycastle.util.test.Test[] tests = RegressionTest.tests;
15-
16+
1617
for (int i = 0; i != tests.length; i++)
1718
{
18-
SimpleTestResult result = (SimpleTestResult)tests[i].perform();
19-
19+
SimpleTestResult result = (SimpleTestResult)tests[i].perform();
20+
2021
if (!result.isSuccessful())
2122
{
2223
fail(result.toString());
2324
}
2425
}
2526
}
26-
27-
public static void main (String[] args)
27+
28+
public static void main(String[] args)
2829
{
29-
junit.textui.TestRunner.run(suite());
30+
PrintTestResult.printResult(junit.textui.TestRunner.run(suite()));
3031
}
31-
32+
3233
public static Test suite()
3334
{
3435
TestSuite suite = new TestSuite("ASN.1 Tests");
35-
36+
3637
suite.addTestSuite(AllTests.class);
3738
suite.addTestSuite(GetInstanceTest.class);
3839
suite.addTestSuite(ASN1SequenceParserTest.class);
39-
40+
4041
return new BCTestSetup(suite);
4142
}
4243

0 commit comments

Comments
 (0)
Please sign in to comment.