Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: chrome/tools/build/mac/keystone_install_test.sh

Issue 285002: Make the auto-update script really smart. It no longer replaces the versione... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/tools/build/mac/keystone_install.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Test of the Mac Chrome installer. 7 # Test of the Mac Chrome installer.
8 8
9 9
10 # Where I am 10 # Where I am
11 DIR=$(dirname "${0}") 11 DIR=$(dirname "${0}")
12 12
13 # My installer to test 13 # My installer to test
14 INSTALLER="${DIR}"/keystone_install.sh 14 INSTALLER="${DIR}"/keystone_install.sh
15 if [ ! -f "${INSTALLER}" ]; then 15 if [ ! -f "${INSTALLER}" ]; then
16 echo "Can't find scripts." >& 2 16 echo "Can't find scripts." >& 2
17 exit 1 17 exit 1
18 fi 18 fi
19 19
20 # What I test 20 # What I test
21 PRODNAME="Google Chrome" 21 PRODNAME="Google Chrome"
22 APPNAME="${PRODNAME}.app" 22 APPNAME="${PRODNAME}.app"
23 FWKNAME="${PRODNAME} Framework.framework" 23 FWKNAME="${PRODNAME} Framework.framework"
24 24
25 # Temp directory to be used as the disk image (source) 25 # Temp directory to be used as the disk image (source)
26 TEMPDIR=$(mktemp -d ${TMPDIR}/$(basename ${0}).XXXXXX) 26 TEMPDIR=$(mktemp -d -t $(basename ${0}))
27 PATH=$PATH:"${TEMPDIR}" 27 PATH=$PATH:"${TEMPDIR}"
28 28
29 # Clean up the temp directory 29 # Clean up the temp directory
30 function cleanup_tempdir() { 30 function cleanup_tempdir() {
31 chmod u+w "${TEMPDIR}" 31 chmod u+w "${TEMPDIR}"
32 rm -rf "${TEMPDIR}" 32 rm -rf "${TEMPDIR}"
33 } 33 }
34 34
35 # Run the installer and make sure it fails. 35 # Run the installer and make sure it fails.
36 # If it succeeds, we fail. 36 # If it succeeds, we fail.
37 # Arg0: string to print 37 # Arg0: string to print
38 function fail_installer() { 38 function fail_installer() {
39 echo $1 39 echo $1
40 "${INSTALLER}" "${TEMPDIR}" >/dev/null 2>&1 40 "${INSTALLER}" "${TEMPDIR}" >& /dev/null
41 RETURN=$? 41 RETURN=$?
42 if [ $RETURN -eq 0 ]; then 42 if [ $RETURN -eq 0 ]; then
43 echo "Did not fail (which is a failure)" >& 2 43 echo "Did not fail (which is a failure)" >& 2
44 cleanup_tempdir 44 cleanup_tempdir
45 exit 1 45 exit 1
46 else 46 else
47 echo "Returns $RETURN" 47 echo "Returns $RETURN"
48 fi 48 fi
49 } 49 }
50 50
51 # Make sure installer works! 51 # Make sure installer works!
52 # Arg0: string to print 52 # Arg0: string to print
53 function pass_installer() { 53 function pass_installer() {
54 echo $1 54 echo $1
55 "${INSTALLER}" "${TEMPDIR}" >/dev/null 2>&1 55 "${INSTALLER}" "${TEMPDIR}" >& /dev/null
56 RETURN=$? 56 RETURN=$?
57 if [ $RETURN -ne 0 ]; then 57 if [ $RETURN -ne 0 ]; then
58 echo "FAILED; returned $RETURN but should have worked" >& 2 58 echo "FAILED; returned $RETURN but should have worked" >& 2
59 cleanup_tempdir 59 cleanup_tempdir
60 exit 1 60 exit 1
61 else 61 else
62 echo "worked" 62 echo "worked"
63 fi 63 fi
64 } 64 }
65 65
66 # Make an old-style destination directory, to test updating from old-style 66 # Make an old-style destination directory, to test updating from old-style
67 # versions to new-style versions. 67 # versions to new-style versions.
68 function make_old_dest() { 68 function make_old_dest() {
69 DEST="${TEMPDIR}"/Dest.app 69 DEST="${TEMPDIR}"/Dest.app
70 rm -rf "${DEST}" 70 rm -rf "${DEST}"
71 mkdir -p "${DEST}"/Contents 71 mkdir -p "${DEST}"/Contents
72 defaults write "${DEST}/Contents/Info" KSVersion 0 72 defaults write "${DEST}/Contents/Info" KSVersion 0
73 cat >"${TEMPDIR}"/ksadmin <<EOF 73 cat >"${TEMPDIR}"/ksadmin <<EOF
74 #!/bin/sh 74 #!/bin/sh
75 echo "echo xc=<blah path=$DEST>" 75 echo " xc=<KSPathExistenceChecker:0x45 path=${DEST}>"
76 exit 0 76 exit 0
77 EOF 77 EOF
78 chmod u+x "${TEMPDIR}"/ksadmin 78 chmod u+x "${TEMPDIR}"/ksadmin
79 } 79 }
80 80
81 # Make a new-style destination directory, to test updating between new-style 81 # Make a new-style destination directory, to test updating between new-style
82 # versions. 82 # versions.
83 function make_new_dest() { 83 function make_new_dest() {
84 DEST="${TEMPDIR}"/Dest.app 84 DEST="${TEMPDIR}"/Dest.app
85 rm -rf "${DEST}" 85 rm -rf "${DEST}"
86 RSRCDIR="${DEST}/Contents/Versions/0/${FWKNAME}/Resources" 86 RSRCDIR="${DEST}/Contents/Versions/0/${FWKNAME}/Resources"
87 mkdir -p "${RSRCDIR}" 87 mkdir -p "${RSRCDIR}"
88 defaults write "${DEST}/Contents/Info" CFBundleShortVersionString 0 88 defaults write "${DEST}/Contents/Info" CFBundleShortVersionString 0
89 defaults write "${RSRCDIR}/Info" KSVersion 0 89 defaults write "${RSRCDIR}/Info" KSVersion 0
90 cat >"${TEMPDIR}"/ksadmin <<EOF 90 cat >"${TEMPDIR}"/ksadmin <<EOF
91 #!/bin/sh 91 #!/bin/sh
92 echo "echo xc=<blah path=$DEST>" 92 echo " xc=<KSPathExistenceChecker:0x45 path=${DEST}>"
93 exit 0 93 exit 0
94 EOF 94 EOF
95 chmod u+x "${TEMPDIR}"/ksadmin 95 chmod u+x "${TEMPDIR}"/ksadmin
96 } 96 }
97 97
98 # Make a simple source directory - the update that is to be applied 98 # Make a simple source directory - the update that is to be applied
99 function make_src() { 99 function make_src() {
100 chmod ugo+w "${TEMPDIR}" 100 chmod ugo+w "${TEMPDIR}"
101 rm -rf "${TEMPDIR}/${APPNAME}" 101 rm -rf "${TEMPDIR}/${APPNAME}"
102 RSRCDIR="${TEMPDIR}/${APPNAME}/Contents/Versions/1/${FWKNAME}/Resources" 102 RSRCDIR="${TEMPDIR}/${APPNAME}/Contents/Versions/1/${FWKNAME}/Resources"
(...skipping 30 matching lines...) Expand all
133 KSUpdateURL "http://foo.bar" 133 KSUpdateURL "http://foo.bar"
134 pass_installer "Old-style update" 134 pass_installer "Old-style update"
135 135
136 make_basic_src_and_dest 136 make_basic_src_and_dest
137 defaults write \ 137 defaults write \
138 "${TEMPDIR}/${APPNAME}/Contents/Versions/1/${FWKNAME}/Resources/Info" \ 138 "${TEMPDIR}/${APPNAME}/Contents/Versions/1/${FWKNAME}/Resources/Info" \
139 KSUpdateURL "http://foo.bar" 139 KSUpdateURL "http://foo.bar"
140 pass_installer "ALL" 140 pass_installer "ALL"
141 141
142 cleanup_tempdir 142 cleanup_tempdir
OLDNEW
« no previous file with comments | « chrome/tools/build/mac/keystone_install.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698