[ssl_mgmt] Add automated testsuite

master
Thomas Preud'homme 10 years ago
parent 7c3cb1e960
commit 107a5327f4

@ -0,0 +1,16 @@
RSTCLR := $$(tput sgr0)
REDCLR := $$(tput setaf 1)
GRNCLR := $$(tput setaf 2)
DISPRES := echo "$(GRNCLR)DONE$(RSTCLR)" || echo "$(REDCLR)FAILED$(RSTCLR)"
RUNTEST = ./$(1)/driver | . ./$(1)/cmdline >/dev/null 2>&1
TESTS := $(wildcard *)
TESTS := $(filter 0 1 2 3 4 5 6 7 8 9, $(TESTS))
TESTS := $(sort $(TESTS))
check: $(patsubst %,test%,$(TESTS))
test%: %/init %/cmdline %/fini
@echo -n "Preparing test $*... " ; ./$*/init && $(DISPRES)
@echo -n "Running test $*... " ; $(call RUNTEST,$*) && $(DISPRES)
@echo -n "Cleaning test $*... " ; ./$*/fini && $(DISPRES)

@ -0,0 +1,18 @@
#!/bin/sh
for file in index.txt serial
do
mv ./workdir/${file}.backup ./workdir/$file
done
mv ./destdir/certs/foo-cert.pem.backup ./destdir/certs/foo-cert.pem
rm ./workdir/csr/*
rm ./workdir/newcerts/*
rm ./workdir/*.old
rm ./workdir/openssl.cnf
for file in foo-key.pem foo-keycert.pem
do
mv ./destdir/private/${file}.backup ./destdir/private/$file
done

@ -0,0 +1,13 @@
#!/bin/sh
for file in index.txt serial
do
cp -a ./workdir/$file ./workdir/${file}.backup
done
cp -a ./destdir/certs/foo-cert.pem ./destdir/certs/foo-cert.pem.backup
for file in foo-key.pem foo-keycert.pem
do
cp -a ./destdir/private/$file ./destdir/private/${file}.backup
done

@ -1,12 +1,24 @@
testDir=${0%/*}/tests
workDir=$testDir/workdir
csrSubdir=$workDir/csr
certSubdir=$workDir/newcerts
keySubdir=$workDir/newkeys
destDir=$testDir/destdir
csrSubdir=csr
certSubdir=newcerts
keySubdir=newkeys
# relative to workdir
destDir=../destdir
certDestDir=$destDir/certs
keyDestDir=$destDir/private
opensslCnfFile=openssl.cnf
rootCAPwdPath=$workDir/root_ca
managedCerts=$workDir/managed_certs
rootCAPwdPath=./root_ca
managedCerts=./managed_certs
notifiedUsers=robotux

Loading…
Cancel
Save