Skip to content

Commit e686189

Browse files
committed
JNI/JCE Testing: reduce threads for CI builds from 100 to 20, reduce load on GH Actions
1 parent 12eadba commit e686189

14 files changed

+18
-17
lines changed

src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestMd5Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public void testMd5Threaded()
302302
throws NoSuchProviderException, NoSuchAlgorithmException,
303303
InterruptedException {
304304

305-
int numThreads = 100;
305+
int numThreads = System.getenv("CI") != null ? 20 : 100;
306306
ExecutorService service = Executors.newFixedThreadPool(numThreads);
307307
final CountDownLatch latch = new CountDownLatch(numThreads);
308308
final LinkedBlockingQueue<byte[]> results = new LinkedBlockingQueue<>();

src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha256Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ public void testSha256Threaded()
291291
throws NoSuchProviderException, NoSuchAlgorithmException,
292292
InterruptedException {
293293

294-
int numThreads = 100;
294+
int numThreads = System.getenv("CI") != null ? 20 : 100;
295295
ExecutorService service = Executors.newFixedThreadPool(numThreads);
296296
final CountDownLatch latch = new CountDownLatch(numThreads);
297297
final LinkedBlockingQueue<byte[]> results = new LinkedBlockingQueue<>();

src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha384Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public void testSha384Threaded()
314314
throws NoSuchProviderException, NoSuchAlgorithmException,
315315
InterruptedException {
316316

317-
int numThreads = 100;
317+
int numThreads = System.getenv("CI") != null ? 20 : 100;
318318
ExecutorService service = Executors.newFixedThreadPool(numThreads);
319319
final CountDownLatch latch = new CountDownLatch(numThreads);
320320
final LinkedBlockingQueue<byte[]> results = new LinkedBlockingQueue<>();

src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha3Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public void testSha3Threaded()
325325
throws NoSuchProviderException, NoSuchAlgorithmException,
326326
InterruptedException {
327327

328-
int numThreads = 100;
328+
int numThreads = System.getenv("CI") != null ? 20 : 100;
329329
ExecutorService service = Executors.newFixedThreadPool(numThreads);
330330
final CountDownLatch latch = new CountDownLatch(numThreads);
331331
final LinkedBlockingQueue<byte[]> results = new LinkedBlockingQueue<>();

src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha512Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public void testSha512Threaded()
334334
throws NoSuchProviderException, NoSuchAlgorithmException,
335335
InterruptedException {
336336

337-
int numThreads = 100;
337+
int numThreads = System.getenv("CI") != null ? 20 : 100;
338338
ExecutorService service = Executors.newFixedThreadPool(numThreads);
339339
final CountDownLatch latch = new CountDownLatch(numThreads);
340340
final LinkedBlockingQueue<byte[]> results = new LinkedBlockingQueue<>();

src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestShaTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ public void testShaThreaded()
310310
throws NoSuchProviderException, NoSuchAlgorithmException,
311311
InterruptedException {
312312

313-
int numThreads = 100;
313+
int numThreads = System.getenv("CI") != null ? 20 : 100;
314314
ExecutorService service = Executors.newFixedThreadPool(numThreads);
315315
final CountDownLatch latch = new CountDownLatch(numThreads);
316316
final LinkedBlockingQueue<byte[]> results = new LinkedBlockingQueue<>();

src/test/java/com/wolfssl/wolfcrypt/test/AesCcmTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ public void testReuseObjectAes256() throws WolfCryptException {
717717
@Test
718718
public void testThreadedAes128() throws InterruptedException {
719719

720-
int numThreads = 100;
720+
int numThreads = System.getenv("CI") != null ? 20 : 100;
721721
ExecutorService service = Executors.newFixedThreadPool(numThreads);
722722
final CountDownLatch latch = new CountDownLatch(numThreads);
723723
final LinkedBlockingQueue<Exception> exceptions =
@@ -781,7 +781,7 @@ public void run() {
781781
@Test
782782
public void testThreadedAes192() throws InterruptedException {
783783

784-
int numThreads = 100;
784+
int numThreads = System.getenv("CI") != null ? 20 : 100;
785785
ExecutorService service = Executors.newFixedThreadPool(numThreads);
786786
final CountDownLatch latch = new CountDownLatch(numThreads);
787787
final LinkedBlockingQueue<Exception> exceptions =
@@ -843,7 +843,7 @@ public void run() {
843843
@Test
844844
public void testThreadedAes256() throws InterruptedException {
845845

846-
int numThreads = 100;
846+
int numThreads = System.getenv("CI") != null ? 20 : 100;
847847
ExecutorService service = Executors.newFixedThreadPool(numThreads);
848848
final CountDownLatch latch = new CountDownLatch(numThreads);
849849
final LinkedBlockingQueue<Exception> exceptions =
@@ -1182,7 +1182,7 @@ public void testStateChecking() {
11821182
@Test
11831183
public void testThreading() throws InterruptedException {
11841184

1185-
int numThreads = 100;
1185+
int numThreads = System.getenv("CI") != null ? 20 : 100;
11861186
ExecutorService service = Executors.newFixedThreadPool(numThreads);
11871187
final CountDownLatch latch = new CountDownLatch(numThreads);
11881188
final LinkedBlockingQueue<Exception> exceptions =

src/test/java/com/wolfssl/wolfcrypt/test/Md5Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public void copyObject() {
226226
@Test
227227
public void threadedHashTest() throws InterruptedException {
228228

229-
int numThreads = 100;
229+
int numThreads = System.getenv("CI") != null ? 20 : 100;
230230
ExecutorService service = Executors.newFixedThreadPool(numThreads);
231231
final CountDownLatch latch = new CountDownLatch(numThreads);
232232
final LinkedBlockingQueue<byte[]> results = new LinkedBlockingQueue<>();

src/test/java/com/wolfssl/wolfcrypt/test/Sha224Test.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ public void copyObject() {
195195
@Test
196196
public void threadedHashTest() throws InterruptedException {
197197

198-
int numThreads = 100;
198+
/* Use fewer threads in CI environments to avoid resource limits */
199+
int numThreads = System.getenv("CI") != null ? 20 : 100;
199200
ExecutorService service = Executors.newFixedThreadPool(numThreads);
200201
final CountDownLatch latch = new CountDownLatch(numThreads);
201202
final LinkedBlockingQueue<byte[]> results = new LinkedBlockingQueue<>();

src/test/java/com/wolfssl/wolfcrypt/test/Sha256Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public void copyObject() {
210210
@Test
211211
public void threadedHashTest() throws InterruptedException {
212212

213-
int numThreads = 100;
213+
int numThreads = System.getenv("CI") != null ? 20 : 100;
214214
ExecutorService service = Executors.newFixedThreadPool(numThreads);
215215
final CountDownLatch latch = new CountDownLatch(numThreads);
216216
final LinkedBlockingQueue<byte[]> results = new LinkedBlockingQueue<>();

0 commit comments

Comments
 (0)