summaryrefslogtreecommitdiff
path: root/test/scripts/light-system-test-prepare.sh
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2016-10-13 15:10:20 +0200
committerMagnus Ahltorp <map@kth.se>2016-10-13 15:16:29 +0200
commitc1dfe32e2ba948e62535102ab6dbafa60c3c6eda (patch)
treef645ce96cb3ec311115f3a4bba410132ca1dc2e9 /test/scripts/light-system-test-prepare.sh
parent4213c3f7987b5f2a01fb12049ae7d5b84645640d (diff)
Make tests run independently from cwdlarge-tests3
Diffstat (limited to 'test/scripts/light-system-test-prepare.sh')
-rwxr-xr-xtest/scripts/light-system-test-prepare.sh71
1 files changed, 34 insertions, 37 deletions
diff --git a/test/scripts/light-system-test-prepare.sh b/test/scripts/light-system-test-prepare.sh
index e5d1f81..79785c1 100755
--- a/test/scripts/light-system-test-prepare.sh
+++ b/test/scripts/light-system-test-prepare.sh
@@ -4,14 +4,14 @@ set -o nounset
set -o errexit
SOFTHSM=/usr/local/bin/softhsm2-util
-INSTDIR=../catlfish
-PREFIX=..
-. ./test.shvars
+top_srcdir=$(cd $(dirname $0)/../..; pwd)
+
+. ${top_srcdir}/test/test.shvars
createca () {
- mkdir ${INSTDIR}/tests/httpsca
- ( cd ${INSTDIR}/tests/httpsca ; \
+ mkdir httpsca
+ ( cd httpsca ; \
mkdir -p demoCA/newcerts ; \
touch demoCA/index.txt ; \
echo 00 > demoCA/serial ; \
@@ -28,46 +28,43 @@ createca () {
}
createcert () {
- mkdir ${INSTDIR}/tests/httpscert
- openssl req -new -newkey rsa:2048 -keyout ${INSTDIR}/tests/httpscert/httpskey-1.pem -out ${INSTDIR}/tests/httpsca/httpscert-1.csr -nodes -subj '/countryName=SE/stateOrProvinceName=Stockholm/organizationName=Test/CN=localhost'
- ( cd ${INSTDIR}/tests/httpsca ; \
+ mkdir httpscert
+ openssl req -new -newkey rsa:2048 -keyout httpscert/httpskey-1.pem -out httpsca/httpscert-1.csr -nodes -subj '/countryName=SE/stateOrProvinceName=Stockholm/organizationName=Test/CN=localhost'
+ ( cd httpsca ; \
openssl ca -in httpscert-1.csr -keyfile key.pem -out httpscert-1.pem -batch \
)
- cp ${INSTDIR}/tests/httpsca/httpscert-1.pem ${INSTDIR}/tests/httpscert/
+ cp httpsca/httpscert-1.pem httpscert/
}
-
-rm -r ${INSTDIR}/tests || true
-mkdir ${INSTDIR}/tests
createca
createcert
-mkdir ${INSTDIR}/tests/keys
-(cd ${INSTDIR}/tests/keys ; ../../../tools/create-key.sh logkey)
-openssl pkcs8 -topk8 -nocrypt -in ${INSTDIR}/tests/keys/logkey-private.pem -out ${INSTDIR}/tests/keys/logkey-private.pkcs8
-mkdir ${INSTDIR}/tests/mergedb
-touch ${INSTDIR}/tests/mergedb/logorder
-mkdir ${INSTDIR}/tests/mergedb-secondary
-touch ${INSTDIR}/tests/mergedb-secondary/logorder
-printf 0 > ${INSTDIR}/tests/mergedb-secondary/verifiedsize
-mkdir ${INSTDIR}/tests/known_roots
-cp ../tools/testcerts/roots/* ${INSTDIR}/tests/known_roots
+mkdir keys
+(cd keys ; ../../../tools/create-key.sh logkey)
+openssl pkcs8 -topk8 -nocrypt -in keys/logkey-private.pem -out keys/logkey-private.pkcs8
+mkdir mergedb
+touch mergedb/logorder
+mkdir mergedb-secondary
+touch mergedb-secondary/logorder
+printf 0 > mergedb-secondary/verifiedsize
+mkdir known_roots
+cp ../../tools/testcerts/roots/* known_roots
for machine in ${MACHINES}; do \
- (cd ${INSTDIR}/tests; ../../tools/compileconfig.py --config ../../test/catlfish-test.cfg --localconfig ../../test/catlfish-test-local-${machine}.cfg) && \
- mkdir -p ${INSTDIR}/tests/machine/machine-${machine}/db && \
- touch ${INSTDIR}/tests/machine/machine-${machine}/db/index && touch ${INSTDIR}/tests/machine/machine-${machine}/db/newentries
+ ../../tools/compileconfig.py --config ../../test/catlfish-test.cfg --localconfig ../../test/catlfish-test-local-${machine}.cfg
+ mkdir -p machine/machine-${machine}/db
+ touch machine/machine-${machine}/db/index && touch machine/machine-${machine}/db/newentries
done
-(cd ${INSTDIR}/tests; ../../tools/compileconfig.py --config ../../test/catlfish-test.cfg --localconfig ../../test/catlfish-test-local-merge-2.cfg)
-(cd ${INSTDIR}/tests; ../../tools/compileconfig.py --config ../../test/catlfish-test.cfg --localconfig ../../test/catlfish-test-local-signing.cfg)
-mkdir ${INSTDIR}/tests/privatekeys
-mkdir ${INSTDIR}/tests/publickeys
+../../tools/compileconfig.py --config ../../test/catlfish-test.cfg --localconfig ../../test/catlfish-test-local-merge-2.cfg
+../../tools/compileconfig.py --config ../../test/catlfish-test.cfg --localconfig ../../test/catlfish-test-local-signing.cfg
+mkdir privatekeys
+mkdir publickeys
for node in ${NODES}; do \
- (cd ${INSTDIR}/tests/privatekeys ; ../../../tools/create-key.sh ${node}) ; \
- mv ${INSTDIR}/tests/privatekeys/${node}.pem ${INSTDIR}/tests/publickeys/ ; \
- mkdir -p ${INSTDIR}/tests/nodes/${node}/log
+ (cd privatekeys ; ../../../tools/create-key.sh ${node}) ; \
+ mv privatekeys/${node}.pem publickeys/ ; \
+ mkdir -p nodes/${node}/log
done
-(cd ${INSTDIR}/tests/privatekeys ; ../../../tools/create-key.sh merge-1)
-mv ${INSTDIR}/tests/privatekeys/merge-1.pem ${INSTDIR}/tests/publickeys/
-(cd ${INSTDIR}/tests/privatekeys ; ../../../tools/create-key.sh merge-2)
-mv ${INSTDIR}/tests/privatekeys/merge-2.pem ${INSTDIR}/tests/publickeys/
+(cd privatekeys ; ../../../tools/create-key.sh merge-1)
+mv privatekeys/merge-1.pem publickeys/
+(cd privatekeys ; ../../../tools/create-key.sh merge-2)
+mv privatekeys/merge-2.pem publickeys/
test -x ${SOFTHSM} && ${SOFTHSM} --init-token --slot=0 --label=mylabel --so-pin=ffff --pin=ffff || true
-test -x ${SOFTHSM} && ${SOFTHSM} --import ${INSTDIR}/tests/keys/logkey-private.pkcs8 --slot 0 --label mylabel --pin ffff --id 00 || true
+test -x ${SOFTHSM} && ${SOFTHSM} --import keys/logkey-private.pkcs8 --slot 0 --label mylabel --pin ffff --id 00 || true