From 48c1dcc79bd256cf323e469c6498b3713b4c8c02 Mon Sep 17 00:00:00 2001 From: Slawomir Koszewski Date: Wed, 4 Mar 2026 06:02:17 +0100 Subject: [PATCH] Added a test suite. --- run-tests.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 run-tests.sh diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 0000000..b38b8b3 --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# This script runs all the test required to verify the functionality of the simple CA implementation. +set -e + +# Load the certificate functions +source "$(dirname "$BASH_SOURCE[0]")/cert-functions.sh" + +# Create a temporary directory for the test certificates +TEMP_CERT_DIR=$(mktemp -d) +# Ensure the temporary directory is cleaned up on exit or interruption +trap "rm -rf $TEMP_CERT_DIR" EXIT KILL HUP INT QUIT + +# Create a standalone CA for testing purposes +if ! make_ca "$TEMP_CERT_DIR" "Test CA"; then + echo "ERROR: Failed to create CA." >&2 + exit 1 +fi