summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2015-08-19 09:55:02 +0200
committerLinus Nordberg <linus@nordu.net>2015-08-19 16:48:15 +0200
commit0d7c8181f07e1c34ef3a9a8740c8ce2d7b982f74 (patch)
treef66fa48fab1200bde7500c56ac7dc994154f50a3 /Makefile
parentaa703d32d55717b4934c91cf187f0ed165196fd0 (diff)
Script for converting database to new format
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile57
1 files changed, 57 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index a8c81bc..fc922d7 100644
--- a/Makefile
+++ b/Makefile
@@ -117,6 +117,49 @@ tests-wait:
tests-makemk:
tools/compileconfig.py --config=test/catlfish-test.cfg --testmakefile=test/test.mk --machines 1
+tests-formatupgrade-prepare:
+ rm -r $(INSTDIR)/tests/mergedb
+ rm -r $(INSTDIR)/tests/machine/machine-1
+ mkdir $(INSTDIR)/tests/machine/machine-1
+ cp -r test/oldformat/db $(INSTDIR)/tests/machine/machine-1
+ cp -r test/oldformat/mergedb $(INSTDIR)/tests
+ @(cd $(INSTDIR) && python ../tools/convertdb.py tests/machine/machine-1/db/certentries)
+
+tests-formatupgrade-run:
+ @(cd $(INSTDIR) && rm -r fetchcertstore-old || true)
+ @(cd $(INSTDIR) && mkdir fetchcertstore-old)
+ @(cd $(INSTDIR) && python ../tools/fetchallcerts.py $(BASEURL) --no-check-signature --store fetchcertstore-old --publickey=tests/keys/logkey.pem --cafile tests/httpsca/demoCA/cacert.pem) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR)/fetchcertstore-old && unzip 0000.zip)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/cert1.txt fetchcertstore-old/00000000) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/cert2.txt fetchcertstore-old/00000001) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/cert3.txt fetchcertstore-old/00000002) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/cert4.txt fetchcertstore-old/00000003) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/cert5.txt fetchcertstore-old/00000004) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/pre1.txt:../tools/testcerts/pre2.txt fetchcertstore-old/00000005:fetchcertstore-old/00000006) || (echo "Verification failed" ; false)
+
+tests-formatupgrade-prepare2:
+ -rm $(INSTDIR)/tests/machine/machine-1/db/sth
+ @(cd $(INSTDIR) && python ../tools/convertdb.py tests/mergedb/chains)
+ rm -r $(INSTDIR)/tests/mergedb-secondary
+ mkdir $(INSTDIR)/tests/mergedb-secondary
+ mkdir $(INSTDIR)/tests/mergedb-secondary/chains
+ touch $(INSTDIR)/tests/mergedb-secondary/logorder
+ printf 0 > $(INSTDIR)/tests/mergedb-secondary/verifiedsize
+
+tests-formatupgrade-run2:
+ @(cd $(INSTDIR) && python ../tools/merge.py --config ../test/catlfish-test.cfg --localconfig ../test/catlfish-test-local-merge.cfg) || (echo "Merge failed" ; false)
+ @diff -r -x nursery -x verifiedsize catlfish/tests/mergedb catlfish/tests/mergedb-secondary || (echo "Merge databases not matching" ; false)
+ @(cd $(INSTDIR) && rm -r fetchcertstore-old || true)
+ @(cd $(INSTDIR) && mkdir fetchcertstore-old)
+ @(cd $(INSTDIR) && python ../tools/fetchallcerts.py $(BASEURL) --no-check-signature --store fetchcertstore-old --publickey=tests/keys/logkey.pem --cafile tests/httpsca/demoCA/cacert.pem) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR)/fetchcertstore-old && unzip 0000.zip)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/cert1.txt fetchcertstore-old/00000000) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/cert2.txt fetchcertstore-old/00000001) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/cert3.txt fetchcertstore-old/00000002) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/cert4.txt fetchcertstore-old/00000003) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/cert5.txt fetchcertstore-old/00000004) || (echo "Verification failed" ; false)
+ @(cd $(INSTDIR) && python ../tools/comparecert.py ../tools/testcerts/pre1.txt:../tools/testcerts/pre2.txt fetchcertstore-old/00000005:fetchcertstore-old/00000006) || (echo "Verification failed" ; false)
+
tests:
@make tests-makemk
@make tests-prepare
@@ -130,6 +173,20 @@ tests:
@make tests-wait
@make tests-stop
+tests-formatupgrade:
+ @make tests-makemk
+ @make tests-prepare
+ @make tests-formatupgrade-prepare
+ @make tests-start
+ @make tests-formatupgrade-run || (make tests-stop ; false)
+ @make tests-wait
+ @make tests-stop
+ @make tests-formatupgrade-prepare2
+ @make tests-start
+ @make tests-formatupgrade-run2 || (make tests-stop ; false)
+ @make tests-wait
+ @make tests-stop
+
tests-createca:
mkdir $(INSTDIR)/tests/httpsca
( cd $(INSTDIR)/tests/httpsca ; \