From 6ca14c7a025933935d80e55635587be6f6d4fc00 Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Wed, 30 May 2012 12:31:19 +0200 Subject: handling of multiple testing certificates in bulk --- Makefile.am | 87 +++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 28 deletions(-) (limited to 'Makefile.am') diff --git a/Makefile.am b/Makefile.am index a77e860..641f4a3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,7 +24,8 @@ JNLP_TESTS_SERVER_DEPLOYDIR=$(TESTS_DIR)/jnlp_test_server JNLP_TESTS_DIR=$(TESTS_DIR)/jnlp_tests PRIVATE_KEYSTORE_NAME=teststore.ks PRIVATE_KEYSTORE_PASS=123456789 -EXPORTED_TEST_CERT=icedteatests.crt +EXPORTED_TEST_CERT_PREFIX=icedteatests +EXPORTED_TEST_CERT_SUFIX=crt TEST_CERT_ALIAS=icedteaweb PUBLIC_KEYSTORE=${HOME}/.icedtea/security/trusted.certs PUBLIC_KEYSTORE_PASS=changeit @@ -35,6 +36,10 @@ REPRODUCERS_CLASS_NAMES = $(abs_top_builddir)/reproducers_class_names REPRODUCERS_CLASS_WHITELIST = $(abs_top_srcdir)/netx-dist-tests-whitelist EMMA_JAVA_ARGS=-Xmx2G META_MANIFEST = META-INF/MANIFEST.MF +SIGNED_REPRODUCERS=signed +SIMPLE_REPRODUCERS=simple +ALL_REPRODUCERS=$(SIMPLE_REPRODUCERS) $(SIGNED_REPRODUCERS) + # linking variables PLUGIN_LINK_NAME=libjavaplugin.so @@ -487,7 +492,7 @@ $(JUNIT_RUNNER_JAR): junit-runner-source-files.txt stamps/netx-dist-tests-compil @junit-runner-source-files.txt && \ $(BOOT_DIR)/bin/jar cf $@ -C $(JUNIT_RUNNER_DIR) . -stamps/junit-jnlp-dist-dirs: junit-jnlp-dist-simple.txt junit-jnlp-dist-signed.txt +stamps/junit-jnlp-dist-dirs: junit-jnlp-dist-simple.txt stamps/junit-jnlp-dist-signed.stamp mkdir -p $(JNLP_TESTS_SERVER_DEPLOYDIR) mkdir -p $(JNLP_TESTS_DIR) touch $@ @@ -496,12 +501,18 @@ junit-jnlp-dist-simple.txt: cd $(JNLP_TESTS_SRCDIR)/simple/ ; \ find . -maxdepth 1 -mindepth 1 | sed "s/.\/*//" > $(abs_top_builddir)/$@ -junit-jnlp-dist-signed.txt: - cd $(JNLP_TESTS_SRCDIR)/signed/ ; \ - find . -maxdepth 1 -mindepth 1 | sed "s/.\/*//" > $(abs_top_builddir)/$@ +stamps/junit-jnlp-dist-signed.stamp: + types=($(SIGNED_REPRODUCERS)) ; \ + for which in "$${types[@]}" ; do \ + pushd $(JNLP_TESTS_SRCDIR)/$$which/ ; \ + find . -maxdepth 1 -mindepth 1 | sed "s/.\/*//" > $(abs_top_builddir)/junit-jnlp-dist-$$which.txt ; \ + popd ; \ + done ; \ + mkdir -p stamps && \ + touch $@ stamps/netx-dist-tests-prepare-reproducers.stamp: stamps/junit-jnlp-dist-dirs - types=(simple signed); \ + types=($(ALL_REPRODUCERS)); \ for which in "$${types[@]}" ; do \ . $(abs_top_srcdir)/NEW_LINE_IFS ; \ simpleReproducers=(`cat $(abs_top_builddir)/junit-jnlp-dist-$$which.txt `); \ @@ -535,19 +546,23 @@ stamps/netx-dist-tests-prepare-reproducers.stamp: stamps/junit-jnlp-dist-dirs stamps/netx-dist-tests-sign-some-reproducers.stamp: stamps/netx-dist-tests-prepare-reproducers.stamp keystore=$(abs_top_builddir)/$(PRIVATE_KEYSTORE_NAME); \ - $(BOOT_DIR)/bin/keytool -genkey -alias $(TEST_CERT_ALIAS) -keystore $$keystore -keypass $(PRIVATE_KEYSTORE_PASS) -storepass $(PRIVATE_KEYSTORE_PASS) -dname "cn=$(TEST_CERT_ALIAS), ou=$(TEST_CERT_ALIAS), o=$(TEST_CERT_ALIAS), c=$(TEST_CERT_ALIAS)" ; \ - . $(abs_top_srcdir)/NEW_LINE_IFS ; \ - signedReproducers=(`cat $(abs_top_builddir)/junit-jnlp-dist-signed.txt `); \ - IFS="$$IFS_BACKUP" ; \ - for dir in "$${signedReproducers[@]}" ; do \ - $(BOOT_DIR)/bin/jarsigner -keystore $$keystore -storepass $(PRIVATE_KEYSTORE_PASS) -keypass $(PRIVATE_KEYSTORE_PASS) "$(JNLP_TESTS_SERVER_DEPLOYDIR)/$$dir.jar" $(TEST_CERT_ALIAS) ; \ - done ; \ - mkdir -p stamps && \ - touch $@ + types=($(SIGNED_REPRODUCERS)) ; \ + for which in "$${types[@]}" ; do \ + tcaw=$(TEST_CERT_ALIAS)_$$which ; \ + $(BOOT_DIR)/bin/keytool -genkey -alias $$tcaw -keystore $$keystore -keypass $(PRIVATE_KEYSTORE_PASS) -storepass $(PRIVATE_KEYSTORE_PASS) -dname "cn=$$tcaw, ou=$$tcaw, o=$$tcaw, c=$$tcaw" ; \ + . $(abs_top_srcdir)/NEW_LINE_IFS ; \ + signedReproducers=(`cat $(abs_top_builddir)/junit-jnlp-dist-$$which.txt `); \ + IFS="$$IFS_BACKUP" ; \ + for dir in "$${signedReproducers[@]}" ; do \ + $(BOOT_DIR)/bin/jarsigner -keystore $$keystore -storepass $(PRIVATE_KEYSTORE_PASS) -keypass $(PRIVATE_KEYSTORE_PASS) "$(JNLP_TESTS_SERVER_DEPLOYDIR)/$$dir.jar" $$tcaw ; \ + done ; \ + done ; \ + mkdir -p stamps && \ + touch $@ stamps/change-dots-to-paths.stamp: stamps/netx-dist-tests-sign-some-reproducers.stamp pushd $(JNLP_TESTS_SERVER_DEPLOYDIR); \ - types=(simple signed); \ + types=($(ALL_REPRODUCERS)); \ for which in "$${types[@]}" ; do \ . $(abs_top_srcdir)/NEW_LINE_IFS ; \ simpleReproducers=(`cat $(abs_top_builddir)/junit-jnlp-dist-$$which.txt `); \ @@ -578,16 +593,27 @@ stamps/change-dots-to-paths.stamp: stamps/netx-dist-tests-sign-some-reproducers. touch $@ #this always tries to remove previous testcert -$(EXPORTED_TEST_CERT): stamps/change-dots-to-paths.stamp netx-dist-tests-remove-cert-from-public - keytool -export -alias $(TEST_CERT_ALIAS) -file $(EXPORTED_TEST_CERT) -storepass $(PRIVATE_KEYSTORE_PASS) -keystore $(PRIVATE_KEYSTORE_NAME) +stamps/exported-test-certs.stamp: stamps/change-dots-to-paths.stamp netx-dist-tests-remove-cert-from-public + types=($(SIGNED_REPRODUCERS)) ; \ + for which in "$${types[@]}" ; do \ + keytool -export -alias $(TEST_CERT_ALIAS)_$$which -file $(EXPORTED_TEST_CERT_PREFIX)_$$which.$(EXPORTED_TEST_CERT_SUFIX) -storepass $(PRIVATE_KEYSTORE_PASS) -keystore $(PRIVATE_KEYSTORE_NAME) ; \ + done ; + mkdir -p stamps && \ + touch $@ -stamps/netx-dist-tests-import-cert-to-public: $(EXPORTED_TEST_CERT) - yes | $(BOOT_DIR)/bin/keytool -import -alias $(TEST_CERT_ALIAS) -keystore $(PUBLIC_KEYSTORE) -storepass $(PUBLIC_KEYSTORE_PASS) -file $(EXPORTED_TEST_CERT); \ - mkdir -p stamps && \ - touch $@ +stamps/netx-dist-tests-import-cert-to-public: stamps/exported-test-certs.stamp + types=($(SIGNED_REPRODUCERS)) ; \ + for which in "$${types[@]}" ; do \ + yes | $(BOOT_DIR)/bin/keytool -import -alias $(TEST_CERT_ALIAS)_$$which -keystore $(PUBLIC_KEYSTORE) -storepass $(PUBLIC_KEYSTORE_PASS) -file $(EXPORTED_TEST_CERT_PREFIX)_$$which.$(EXPORTED_TEST_CERT_SUFIX) ;\ + done ; + mkdir -p stamps && \ + touch $@ netx-dist-tests-remove-cert-from-public: - -$(BOOT_DIR)/bin/keytool -delete -alias $(TEST_CERT_ALIAS) -keystore $(PUBLIC_KEYSTORE) -storepass $(PUBLIC_KEYSTORE_PASS) + -types=($(SIGNED_REPRODUCERS)) ; \ + for which in "$${types[@]}" ; do \ + $(BOOT_DIR)/bin/keytool -delete -alias $(TEST_CERT_ALIAS)_$$which -keystore $(PUBLIC_KEYSTORE) -storepass $(PUBLIC_KEYSTORE_PASS) ; \ + done ; -rm -rf stamps/netx-dist-tests-import-cert-to-public netx-dist-tests-source-files.txt: @@ -605,7 +631,7 @@ stamps/netx-dist-tests-compile.stamp: stamps/netx.stamp \ stamps/netx-dist-tests-compile-testcases.stamp: stamps/netx.stamp stamps/junit-jnlp-dist-dirs \ netx-dist-tests-source-files.txt stamps/netx-dist-tests-compile.stamp - types=(simple signed); \ + types=($(ALL_REPRODUCERS)); \ for which in "$${types[@]}" ; do \ . $(abs_top_srcdir)/NEW_LINE_IFS ; \ simpleReproducers=(`cat $(abs_top_builddir)/junit-jnlp-dist-$$which.txt `); \ @@ -876,7 +902,7 @@ if WITH_EMMA chmod 777 $(DESTDIR)$(bindir)/$(javaws) ; \ testcases_srcs=( ) ; \ k=0 ; \ - types=(simple signed); \ + types=($(ALL_REPRODUCERS)); \ for which in "$${types[@]}" ; do \ . $(abs_top_srcdir)/NEW_LINE_IFS ; \ simpleReproducers=(`cat $(abs_top_builddir)/junit-jnlp-dist-$$which.txt `); \ @@ -940,7 +966,7 @@ run-test-code-coverage: run-unit-test-code-coverage run-reproducers-test-code-co if WITH_EMMA cd $(TESTS_DIR) ; \ k=0 ; \ - types=(simple signed); \ + types=($(ALL_REPRODUCERS)); \ for which in "$${types[@]}" ; do \ . $(abs_top_srcdir)/NEW_LINE_IFS ; \ simpleReproducers=(`cat $(abs_top_builddir)/junit-jnlp-dist-$$which.txt `); \ @@ -1004,10 +1030,15 @@ clean-netx-dist-tests: clean_tests_reports netx-dist-tests-remove-cert-from-publ rm -f stamps/netx-dist-tests-sign-some-reproducers.stamp rm -f stamps/change-dots-to-paths.stamp rm -f junit-jnlp-dist-simple.txt - rm -f junit-jnlp-dist-signed.txt + types=($(SIGNED_REPRODUCERS)) ; \ + for which in "$${types[@]}" ; do \ + rm -f junit-jnlp-dist-$$which.txt ; \ + rm -f $(EXPORTED_TEST_CERT_PREFIX)_$$which.$(EXPORTED_TEST_CERT_SUFIX) ; \ + done ; + rm -f stamps/exported-test-certs.stamp + rm -f stamps/junit-jnlp-dist-signed.stamp rm -f $(REPRODUCERS_CLASS_NAMES) rm -f $(abs_top_builddir)/$(PRIVATE_KEYSTORE_NAME) - rm -f $(EXPORTED_TEST_CERT) rm -f stamps/run-netx-dist-tests.stamp clean-unit-test-code-coverage: -- cgit v1.2.3