Almost a complete rewrite.
[ca] / test / init
diff --git a/test/init b/test/init
new file mode 100755 (executable)
index 0000000..8d89942
--- /dev/null
+++ b/test/init
@@ -0,0 +1,53 @@
+#! /bin/sh
+
+set -ex
+dirs="state archive req cert"
+rm -rf $dirs tmp
+mkdir -m775 tmp
+export CA_FAKE_TIME
+
+donep=t stage=0
+while :; do
+  stage=$(( $stage + 1 ))
+  if [ -e test/stage-$stage.tar.gz ]; then continue; fi
+  case $donep,$stage in
+    t,1) ;;
+    t,*) tar xf test/stage-$(( $stage - 1 )).tar.gz ;;
+  esac
+  donep=nil
+  case $stage in
+    1)
+      CA_FAKE_TIME="2011-08-23 18:32:45"
+      bin/setup
+      for i in $(seq 1 50); do
+       bin/add tls-client fake#$i test/fake-reqs/$i.req
+      done
+      bin/check
+      ;;
+    2)
+      CA_FAKE_TIME="2011-08-24 18:32:45"
+      bin/update
+      bin/check
+      ;;
+    3)
+      CA_FAKE_TIME="2011-08-30 18:32:45"
+      bin/update
+      bin/check
+      ;;
+    4)
+      CA_FAKE_TIME="2011-09-03 18:32:45"
+      bin/update
+      bin/revoke fake#13 key-compromise
+      bin/check
+      ;;
+    5)
+      CA_FAKE_TIME="2011-09-05 18:32:45"
+      bin/update
+      bin/check
+      ;;
+    *)
+      break
+      ;;
+  esac
+  tar cfz test/stage-$stage.tar.gz $dirs
+done