From 6d5788b3319247f22614de80ca7e013054cc78ad Mon Sep 17 00:00:00 2001 From: Erik Corry Date: Fri, 8 Dec 2023 07:31:42 +0100 Subject: [PATCH] Adjust TLS global test so it can run on an ESP32. (#1989) --- tests/tls-global-cert-test-slow.toit | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/tls-global-cert-test-slow.toit b/tests/tls-global-cert-test-slow.toit index 2164fa670..5b22b592b 100644 --- a/tests/tls-global-cert-test-slow.toit +++ b/tests/tls-global-cert-test-slow.toit @@ -15,11 +15,13 @@ expect-error name [code]: error := catch code expect: error.contains name +is-embedded ::= platform == system.PLATFORM-FREERTOS + monitor LimitLoad: current := 0 has-test-failure := null // FreeRTOS does not have enough memory to run 10 in parallel. - concurrent-processes ::= platform == system.PLATFORM-FREERTOS ? 1 : 2 + concurrent-processes ::= is-embedded ? 1 : 2 inc: await: current < concurrent-processes @@ -189,12 +191,13 @@ add-global-certs -> none: expect-error "WRONG_OBJECT_TYPE": tls.add-global-root-certificate_ parsed // Test that unparseable cert gives an immediate error. - expect-error "OID is not found": - DIGICERT-GLOBAL-ROOT-CA-BYTES[42] ^= 42 - tls.add-global-root-certificate_ DIGICERT-GLOBAL-ROOT-CA-BYTES + if not is-embedded: + expect-error "OID is not found": + DIGICERT-GLOBAL-ROOT-CA-BYTES[42] ^= 42 + tls.add-global-root-certificate_ DIGICERT-GLOBAL-ROOT-CA-BYTES // Test that it's not too costly to add the same cert multiple times. - 1_000_000.repeat: + (is-embedded ? 1000 : 1_000_000).repeat: tls.add-global-root-certificate_ DIGICERT-GLOBAL-ROOT-G2-BYTES 0x025449c2 // Ebay.de sometimes uses this trusted root certificate.