Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build-and-bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ jobs:
# Benchmark with everything enabled
- name: Benchmark All
run: cd benchmark && make clean && make WOLFSSL_DIR=../wolfssl DMA=1 && make run

# Benchmark with DEBUG_VERBOSE=1 (includes DEBUG)
- name: Benchmark with DEBUG_VERBOSE
run: cd benchmark && make clean && make -j DEBUG_VERBOSE=1 WOLFSSL_DIR=../wolfssl && make run
9 changes: 5 additions & 4 deletions .github/workflows/build-and-run-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
matrix:
transport: [ 'tcp', 'shm', 'dma' ]
asan: [ 'ASAN=1', 'ASAN=0' ]
debug: [ '', 'DEBUG_VERBOSE=1' ]
runs-on: ubuntu-latest
timeout-minutes: 5

Expand All @@ -29,16 +30,16 @@ jobs:
- name: Build POSIX server
run: |
if [ "${{ matrix.transport }}" = "dma" ]; then
cd examples/posix/wh_posix_server && ${{ matrix.asan }} DMA=1 make -j WOLFSSL_DIR=../../../wolfssl
cd examples/posix/wh_posix_server && ${{ matrix.asan }} ${{ matrix.debug }} DMA=1 make -j WOLFSSL_DIR=../../../wolfssl
else
cd examples/posix/wh_posix_server && ${{ matrix.asan }} make -j WOLFSSL_DIR=../../../wolfssl
cd examples/posix/wh_posix_server && ${{ matrix.asan }} ${{ matrix.debug }} make -j WOLFSSL_DIR=../../../wolfssl
fi
- name: Build POSIX client
run: |
if [ "${{ matrix.transport }}" = "dma" ]; then
cd examples/posix/wh_posix_client && ${{ matrix.asan }} DMA=1 make -j WOLFSSL_DIR=../../../wolfssl
cd examples/posix/wh_posix_client && ${{ matrix.asan }} ${{ matrix.debug }} DMA=1 make -j WOLFSSL_DIR=../../../wolfssl
else
cd examples/posix/wh_posix_client && ${{ matrix.asan }} make -j WOLFSSL_DIR=../../../wolfssl
cd examples/posix/wh_posix_client && ${{ matrix.asan }} ${{ matrix.debug }} make -j WOLFSSL_DIR=../../../wolfssl
fi

# Start the server in the background
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/build-and-test-clientonly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,25 @@ jobs:
make clean
make -j CLIENT_ONLY_TCP=1 SHE=1 ASAN=1 WOLFSSL_DIR=../wolfssl && make run

# Optional: Kill the server process if it doesn't exit on its own
# Restart server with fresh state for second test run
- name: Restart POSIX server
run: |
kill $TCP_SERVER_PID || true
cd examples/posix/wh_posix_server
rm -f *.bin || true
./Build/wh_posix_server.elf &
TCP_SERVER_PID=$!
echo "TCP_SERVER_PID=$TCP_SERVER_PID" >> $GITHUB_ENV
sleep 2

# Build and test client-only with DEBUG_VERBOSE=1 (includes DEBUG)
- name: Build client-only unit tests with DEBUG_VERBOSE
run: |
cd test
make clean
make -j CLIENT_ONLY_TCP=1 SHE=1 DEBUG_VERBOSE=1 WOLFSSL_DIR=../wolfssl && make run

# Optional: Kill the server process if it doesn't exit on its own
- name: Cleanup POSIX TCP server
if: always()
run: kill $TCP_SERVER_PID || true
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build-and-test-whnvmtool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ jobs:
- name: Build and test NVM tool with ASAN
run: cd tools/whnvmtool && make clean && make check WOLFSSL_DIR=../../wolfssl ASAN=1

# Build and test with DEBUG=1
- name: Build and test NVM tool with DEBUG
run: cd tools/whnvmtool && make clean && make check WOLFSSL_DIR=../../wolfssl DEBUG=1

# Build and test with DEBUG_VERBOSE=1 (includes DEBUG)
- name: Build and test NVM tool with DEBUG_VERBOSE
run: cd tools/whnvmtool && make clean && make check WOLFSSL_DIR=../../wolfssl DEBUG_VERBOSE=1

8 changes: 8 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,11 @@ jobs:
# Build and test with SHE and ASAN
- name: Build and test ASAN SHE
run: cd test && make clean && make -j SHE=1 ASAN=1 WOLFSSL_DIR=../wolfssl && make run

# Build and test with DEBUG=1
- name: Build and test with DEBUG
run: cd test && make clean && make -j DEBUG=1 WOLFSSL_DIR=../wolfssl && make run

# Build and test with DEBUG_VERBOSE=1 (includes DEBUG)
- name: Build and test with DEBUG_VERBOSE
run: cd test && make clean && make -j DEBUG_VERBOSE=1 WOLFSSL_DIR=../wolfssl && make run
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

.PHONY: all test benchmark tools examples clean

export DEBUG
export DEBUG_VERBOSE

all: test benchmark tools examples

test:
Expand Down
19 changes: 10 additions & 9 deletions benchmark/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ ifeq ($(DEBUG),1)
DBGFLAGS = -ggdb -g3
CFLAGS += $(DBGFLAGS)
LDFLAGS += $(DBGFLAGS)
DEF += -DWOLFHSM_CFG_DEBUG
endif

# Check if DEBUG_VERBOSE is set to 1 and enable verbose WOLFHSM debug output
# Note: DEBUG_VERBOSE implies DEBUG
ifeq ($(DEBUG_VERBOSE),1)
DBGFLAGS = -ggdb -g3
CFLAGS += $(DBGFLAGS)
LDFLAGS += $(DBGFLAGS)
DEF += -DWOLFHSM_CFG_DEBUG -DWOLFHSM_CFG_DEBUG_VERBOSE
endif

ifneq ($(DEBUG),1)
Expand All @@ -89,15 +99,6 @@ ifeq ($(DEBUG_WOLFSSL),1)
DEF += -DDEBUG_WOLFSSL
endif

ifeq ($(DEBUG_CRYPTOCB),1)
DEF += -DDEBUG_CRYPTOCB
endif

ifeq ($(DEBUG_CRYPTOCB_VERBOSE),1)
DEF += -DDEBUG_CRYPTOCB -DDEBUG_CRYPTOCB_VERBOSE
endif


## wolfHSM defines
ifeq ($(NOCRYPTO),1)
DEF += -DWOLFHSM_CFG_NO_CRYPTO
Expand Down
4 changes: 2 additions & 2 deletions benchmark/config/user_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ extern "C" {
/* #define WC_NO_ASYNC_THREADING */

/*
#define DEBUG_CRYPTOCB
#define DEBUG_CRYPTOCB_VERBOSE
#define WOLFHSM_CFG_DEBUG
#define WOLFHSM_CFG_DEBUG_VERBOSE
*/

/** wolfHSM required settings for wolfCrypt */
Expand Down
2 changes: 1 addition & 1 deletion benchmark/wh_bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ static int _whBench_ClientCfg_PosixDmaHeap(posixTransportShmContext* shmCtx)

ret = posixTransportShm_GetDma(shmCtx, &dma, &dmaSz);
if (ret != 0) {
printf("Failed to get DMA\n");
WOLFHSM_CFG_PRINTF("Failed to get DMA\n");
return ret;
}

Expand Down
12 changes: 6 additions & 6 deletions benchmark/wh_bench_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@

void Usage(const char* exeName)
{
printf("Usage: %s --type <type> --module <module> --list\n", exeName);
printf("Type: mem, shm, tcp, dma\n");
printf("Module: index of the module to run\n");
printf("List: list all modules\n");
WOLFHSM_CFG_PRINTF("Usage: %s --type <type> --module <module> --list\n", exeName);
WOLFHSM_CFG_PRINTF("Type: mem, shm, tcp, dma\n");
WOLFHSM_CFG_PRINTF("Module: index of the module to run\n");
WOLFHSM_CFG_PRINTF("List: list all modules\n");
exit(1);
}

Expand Down Expand Up @@ -62,7 +62,7 @@ int main(int argc, char** argv)
transport = WH_BENCH_TRANSPORT_POSIX_DMA;
}
else {
printf("Invalid transport type: %s\n", type);
WOLFHSM_CFG_PRINTF("Invalid transport type: %s\n", type);
Usage(argv[0]);
return -1;
}
Expand All @@ -75,7 +75,7 @@ int main(int argc, char** argv)
return 0;
}
else {
printf("Invalid argument: %s\n", argv[i]);
WOLFHSM_CFG_PRINTF("Invalid argument: %s\n", argv[i]);
Usage(argv[0]);
return -1;
}
Expand Down
Loading