|
| 1 | +name: Async Examples |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'master', 'main', 'release/**' ] |
| 6 | + pull_request: |
| 7 | + branches: [ '*' ] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + async_examples: |
| 15 | + if: github.repository_owner == 'wolfssl' |
| 16 | + runs-on: ubuntu-24.04 |
| 17 | + timeout-minutes: 10 |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + extra_cflags: |
| 22 | + - '' |
| 23 | + - '-DWOLFSSL_SMALL_CERT_VERIFY' |
| 24 | + - '-DWOLFSSL_STATIC_MEMORY' |
| 25 | + name: Async Examples (${{ matrix.extra_cflags || 'default' }}) |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + name: Checkout wolfSSL |
| 29 | + |
| 30 | + - name: Build async examples (no configure) |
| 31 | + run: | |
| 32 | + make -C examples/async clean |
| 33 | + make -C examples/async EXTRA_CFLAGS="${{ matrix.extra_cflags }}" |
| 34 | +
|
| 35 | + - name: Run async examples |
| 36 | + run: | |
| 37 | + set -euo pipefail |
| 38 | +
|
| 39 | + MIN_PENDING=100 |
| 40 | +
|
| 41 | + run_pair() { |
| 42 | + local label="$1" |
| 43 | + shift |
| 44 | + local args="$*" |
| 45 | + local ready="/tmp/wolfssl_async_ready_${label}" |
| 46 | + rm -f "$ready" |
| 47 | +
|
| 48 | + WOLFSSL_ASYNC_READYFILE="$ready" \ |
| 49 | + ./examples/async/async_server $args \ |
| 50 | + > "/tmp/async_server_${label}.log" 2>&1 & |
| 51 | + local pid=$! |
| 52 | +
|
| 53 | + WOLFSSL_ASYNC_READYFILE="$ready" \ |
| 54 | + ./examples/async/async_client $args 127.0.0.1 11111 \ |
| 55 | + > "/tmp/async_client_${label}.log" 2>&1 |
| 56 | + local rc=$? |
| 57 | +
|
| 58 | + kill "$pid" >/dev/null 2>&1 || true |
| 59 | + wait "$pid" >/dev/null 2>&1 || true |
| 60 | +
|
| 61 | + if [ "$rc" -ne 0 ]; then |
| 62 | + echo "FAIL: $label (exit=$rc)" |
| 63 | + return 1 |
| 64 | + fi |
| 65 | +
|
| 66 | + # Validate WC_PENDING_E count is a proper value |
| 67 | + local count |
| 68 | + count=$(awk '/WC_PENDING_E count:/ {print $NF}' \ |
| 69 | + "/tmp/async_client_${label}.log") |
| 70 | + if [ -z "$count" ] || [ "$count" -lt "$MIN_PENDING" ]; then |
| 71 | + echo "FAIL: $label - WC_PENDING_E count too low:" \ |
| 72 | + "${count:-missing} (expected >= $MIN_PENDING)" |
| 73 | + return 1 |
| 74 | + fi |
| 75 | + echo "PASS: $label (WC_PENDING_E: $count)" |
| 76 | + return 0 |
| 77 | + } |
| 78 | +
|
| 79 | + # TLS 1.3 |
| 80 | + run_pair ecc_tls13 --ecc |
| 81 | + run_pair x25519_tls13 --x25519 |
| 82 | +
|
| 83 | + # TLS 1.2 |
| 84 | + run_pair ecc_tls12 --tls12 --ecc |
| 85 | + run_pair x25519_tls12 --tls12 --x25519 |
| 86 | +
|
| 87 | + # TLS 1.3 mutual auth |
| 88 | + run_pair ecc_tls13_mutual --mutual --ecc |
| 89 | + run_pair x25519_tls13_mutual --mutual --x25519 |
| 90 | +
|
| 91 | + # TLS 1.2 mutual auth |
| 92 | + run_pair ecc_tls12_mutual --mutual --tls12 --ecc |
| 93 | + run_pair x25519_tls12_mutual --mutual --tls12 --x25519 |
| 94 | +
|
| 95 | +
|
| 96 | + - name: Print async logs |
| 97 | + if: ${{ failure() }} |
| 98 | + run: | |
| 99 | + for f in /tmp/async_server_*.log /tmp/async_client_*.log; do |
| 100 | + if [ -f "$f" ]; then |
| 101 | + echo "==> $f" |
| 102 | + cat "$f" |
| 103 | + fi |
| 104 | + done |
0 commit comments