changeset 10734:2745baf44012

8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac Reviewed-by: mullan
author vinnie
date Sun, 05 Oct 2014 14:24:44 +0100
parents 87c95759b92b
children 649739000a04
files test/sun/security/tools/keytool/ListKeychainStore.sh
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/test/sun/security/tools/keytool/ListKeychainStore.sh	Wed Feb 11 18:55:05 2015 -0800
+++ b/test/sun/security/tools/keytool/ListKeychainStore.sh	Sun Oct 05 14:24:44 2014 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
 #
 
 # @test
-# @bug 7133495
+# @bug 7133495 8041740
 # @summary [macosx] KeyChain KeyStore implementation retrieves only one private key entry
 
 if [ "${TESTJAVA}" = "" ] ; then
@@ -49,8 +49,10 @@
 KEYTOOL="${TESTJAVA}/bin/keytool -storetype KeychainStore -keystore NONE -storepass $PWD"
 TEMPORARY_P12="$TESTCLASSES/7133495.p12"
 TEMPORARY_KC="$TESTCLASSES/7133495.keychain"
+TEMPORARY_LIST="$TESTCLASSES/7133495.tmp"
 CLEANUP_P12="rm -f $TEMPORARY_P12"
 CLEANUP_KC="security delete-keychain $TEMPORARY_KC"
+CLEANUP_LIST="rm -f $TEMPORARY_LIST"
 
 # Count the number of private key entries in the Keychain keystores
 
@@ -115,6 +117,15 @@
 fi
 echo "Imported keypairs from PKCS12 keystore into the keychain"
 
+# Adjust the keychain search order
+
+echo "\"$TEMPORARY_KC\"" > $TEMPORARY_LIST
+security list-keychains >> $TEMPORARY_LIST
+security list-keychains -s `xargs < ${TEMPORARY_LIST}`
+`$CLEANUP_LIST`
+echo "Temporary keychain search order:"
+security list-keychains
+
 # Recount the number of private key entries in the Keychain keystores
 
 COUNT=`$KEYTOOL -list | grep PrivateKeyEntry | wc -l`