Skip to content

Commit

Permalink
Adjust TLS global test so it can run on an ESP32. (#1989)
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Corry authored Dec 8, 2023
1 parent 1e81584 commit 6d5788b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/tls-global-cert-test-slow.toit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 6d5788b

Please sign in to comment.