|
| 1 | +#!/bin/sh |
| 2 | +# run.sh |
| 3 | +# |
| 4 | +# Copyright (C) 2006-2026 wolfSSL Inc. |
| 5 | +# |
| 6 | +# This file is part of wolfSSL. |
| 7 | +# |
| 8 | +# wolfSSL is free software; you can redistribute it and/or modify |
| 9 | +# it under the terms of the GNU General Public License as published by |
| 10 | +# the Free Software Foundation; either version 3 of the License, or |
| 11 | +# (at your option) any later version. |
| 12 | +# |
| 13 | +# wolfSSL is distributed in the hope that it will be useful, |
| 14 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | +# GNU General Public License for more details. |
| 17 | +# |
| 18 | +# You should have received a copy of the GNU General Public License |
| 19 | +# along with this program; if not, write to the Free Software |
| 20 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA |
| 21 | + |
| 22 | +# Regression test for the mem_track.h memLock guard misalignment that |
| 23 | +# previously broke multi-threaded FreeRTOS-class builds with |
| 24 | +# WOLFSSL_TRACK_MEMORY + USE_WOLFSSL_MEMORY + !WOLFSSL_STATIC_MEMORY. |
| 25 | +# |
| 26 | +# The bug is preprocessor-only, so the test runs on a stock Linux host: |
| 27 | +# -U__linux__ -U__MACH__ -U__ZEPHYR__ suppresses the host autodefines |
| 28 | +# that would otherwise hide it. Stub FreeRTOS.h / semphr.h satisfy the |
| 29 | +# wc_port.h FREERTOS_TCP mutex typedef without needing a real RTOS. |
| 30 | +# |
| 31 | +# Exit 0 = mem_track.h still compiles in the non-Linux multi-threaded |
| 32 | +# config, i.e. the fix is in place. Exit non-zero = the misalignment is |
| 33 | +# back. Run from the wolfssl repo root. |
| 34 | +set -u |
| 35 | +cc -DWOLFSSL_USER_SETTINGS \ |
| 36 | + -U__linux__ -U__MACH__ -U__ZEPHYR__ \ |
| 37 | + -I tests/freertos-mem-track-repro \ |
| 38 | + -I . \ |
| 39 | + -c tests/freertos-mem-track-repro/repro.c \ |
| 40 | + -o /dev/null |
| 41 | +status=$? |
| 42 | +if [ $status -eq 0 ]; then |
| 43 | + echo "OK: mem_track.h compiles for non-Linux multi-threaded config." |
| 44 | +else |
| 45 | + echo "FAIL: mem_track.h compile broken for non-Linux multi-threaded" >&2 |
| 46 | + echo " config - the memLock guard misalignment may be back." >&2 |
| 47 | +fi |
| 48 | +exit $status |
0 commit comments