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

Side by Side Diff: src/scripts/mod_image_for_test.sh

Issue 2132008: Update factory installer, factory test (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: integrate autupdate server changes Created 10 years, 7 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
« no previous file with comments | « src/scripts/mod_for_factory_scripts/500copyQualDb ('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 OS Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium OS 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 # Script to modify a keyfob-based chromeos system image for testability. 7 # Script to modify a keyfob-based chromeos system image for testability.
8 8
9 # Load common constants. This should be the first executable line. 9 # Load common constants. This should be the first executable line.
10 # The path to common.sh should be relative to your script's location. 10 # The path to common.sh should be relative to your script's location.
11 . "$(dirname "$0")/common.sh" 11 . "$(dirname "$0")/common.sh"
12 12
13 # Load functions and constants for chromeos-install 13 # Load functions and constants for chromeos-install
14 . "$(dirname "$0")/chromeos-common.sh" 14 . "$(dirname "$0")/chromeos-common.sh"
15 15
16 # We need to be in the chroot to emerge test packages. 16 # We need to be in the chroot to emerge test packages.
17 assert_inside_chroot 17 assert_inside_chroot
18 18
19 get_default_board 19 get_default_board
20 20
21 DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built" b 21 DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built" b
22 DEFINE_boolean factory $FLAGS_FALSE \ 22 DEFINE_boolean factory $FLAGS_FALSE \
23 "Modify the image for manufacturing testing" f 23 "Modify the image for manufacturing testing" f
24 DEFINE_boolean factory_install $FLAGS_FALSE \ 24 DEFINE_boolean factory_install $FLAGS_FALSE \
25 "Modify the image for factory install shim" 25 "Modify the image for factory install shim"
26 DEFINE_string image "" "Location of the rootfs raw image file" i 26 DEFINE_string image "" "Location of the rootfs raw image file" i
27 DEFINE_boolean installmask $FLAGS_TRUE \ 27 DEFINE_boolean installmask $FLAGS_TRUE \
28 "Use INSTALL_MASK to shrink the resulting image." m 28 "Use INSTALL_MASK to shrink the resulting image." m
29 DEFINE_integer jobs -1 \ 29 DEFINE_integer jobs -1 \
30 "How many packages to build in parallel at maximum." j 30 "How many packages to build in parallel at maximum." j
31 DEFINE_string qualdb "/tmp/run_remote_tests.*" \ 31 DEFINE_string qualdb "/tmp/run_remote_tests.*" \
32 "Location of qualified component file" d 32 "Location of qualified component file" d
33 DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" y 33 DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" y
34 DEFINE_string build_root "/build" \
35 "The root location for board sysroots."
36
34 37
35 # Parse command line 38 # Parse command line
36 FLAGS "$@" || exit 1 39 FLAGS "$@" || exit 1
37 eval set -- "${FLAGS_ARGV}" 40 eval set -- "${FLAGS_ARGV}"
38 41
39 # No board, no default and no image set then we can't find the image 42 # No board, no default and no image set then we can't find the image
40 if [ -z $FLAGS_image ] && [ -z $FLAGS_board ] ; then 43 if [ -z $FLAGS_image ] && [ -z $FLAGS_board ] ; then
41 setup_board_warning 44 setup_board_warning
42 die "mod_image_for_test failed. No board set and no image set" 45 die "mod_image_for_test failed. No board set and no image set"
43 fi 46 fi
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 fi 87 fi
85 88
86 # Determine the root dir for test packages. 89 # Determine the root dir for test packages.
87 ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local" 90 ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local"
88 91
89 INSTALL_MASK="$INSTALL_MASK" emerge-${FLAGS_board} \ 92 INSTALL_MASK="$INSTALL_MASK" emerge-${FLAGS_board} \
90 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ 93 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
91 --usepkgonly chromeos-test $EMERGE_JOBS 94 --usepkgonly chromeos-test $EMERGE_JOBS
92 } 95 }
93 96
97
98 install_autotest() {
99 SYSROOT="${FLAGS_build_root}/${FLAGS_board}"
100 AUTOTEST_SRC="${SYSROOT}/usr/local/autotest"
101 stateful_root="${ROOT_FS_DIR}/usr/local"
102 autotest_client="/autotest"
103
104 echo "Install autotest into stateful partition from $AUTOTEST_SRC"
105
106 sudo mkdir -p "${stateful_root}${autotest_client}"
107 sudo mkdir -p "/tmp/autotest"
108 sudo rm -rf /tmp/autotest/*
109
110 sudo cp -fpru ${AUTOTEST_SRC}/client/* \
111 "/tmp/autotest"
112 # Remove outrageously large tests.
113 # TODO(nsanders): is there a better way to do this?
114 sudo rm -rf /tmp/autotest/deps/realtimecomm_playground
115 sudo rm -rf /tmp/autotest/tests/ltp
116 sudo rm -rf /tmp/autotest/site_tests/graphics_O3DSelenium
117 sudo rm -rf /tmp/autotest/realtimecomm_GTalk*
118 sudo rm -rf /tmp/autotest/site_tests/platform_StackProtector
119
120 sudo cp -fpru /tmp/autotest/* \
121 "${stateful_root}/${autotest_client}"
122 sudo chmod 755 "${stateful_root}/${autotest_client}"
123 sudo chown -R 1000:1000 "${stateful_root}/${autotest_client}"
124 }
125
94 # main process begins here. 126 # main process begins here.
95 127
96 # Make sure this is really what the user wants, before nuking the device 128 # Make sure this is really what the user wants, before nuking the device
97 if [ $FLAGS_yes -ne $FLAGS_TRUE ]; then 129 if [ $FLAGS_yes -ne $FLAGS_TRUE ]; then
98 read -p "Modifying image ${FLAGS_image} for test; are you sure (y/N)? " SURE 130 read -p "Modifying image ${FLAGS_image} for test; are you sure (y/N)? " SURE
99 SURE="${SURE:0:1}" # Get just the first character 131 SURE="${SURE:0:1}" # Get just the first character
100 if [ "$SURE" != "y" ]; then 132 if [ "$SURE" != "y" ]; then
101 echo "Ok, better safe than sorry." 133 echo "Ok, better safe than sorry."
102 exit 1 134 exit 1
103 fi 135 fi
(...skipping 14 matching lines...) Expand all
118 # Mounts gpt image and sets up var, /usr/local and symlinks. 150 # Mounts gpt image and sets up var, /usr/local and symlinks.
119 "$SCRIPTS_DIR/mount_gpt_image.sh" -i "$IMAGE_NAME" -f "$IMAGE_DIR" \ 151 "$SCRIPTS_DIR/mount_gpt_image.sh" -i "$IMAGE_NAME" -f "$IMAGE_DIR" \
120 -r "$ROOT_FS_DIR" -s "$STATEFUL_DIR" 152 -r "$ROOT_FS_DIR" -s "$STATEFUL_DIR"
121 153
122 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then 154 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
123 # We don't want to emerge test packages on factory install, otherwise we run 155 # We don't want to emerge test packages on factory install, otherwise we run
124 # out of space. 156 # out of space.
125 157
126 # Run factory setup script to modify the image. 158 # Run factory setup script to modify the image.
127 sudo emerge-${FLAGS_board} --root=$ROOT_FS_DIR --usepkgonly \ 159 sudo emerge-${FLAGS_board} --root=$ROOT_FS_DIR --usepkgonly \
128 --root-deps=rdeps chromeos-factoryinstall 160 --root-deps=rdeps --nodeps chromeos-factoryinstall
129 161
130 # Set factory server if necessary. 162 # Set factory server if necessary.
131 if [ "${FACTORY_SERVER}" != "" ]; then 163 if [ "${FACTORY_SERVER}" != "" ]; then
132 sudo sed -i \ 164 sudo sed -i \
133 "s/CHROMEOS_AUSERVER=.*$/CHROMEOS_AUSERVER=\ 165 "s/CHROMEOS_AUSERVER=.*$/CHROMEOS_AUSERVER=\
134 http:\/\/${FACTORY_SERVER}:8080\/update/" \ 166 http:\/\/${FACTORY_SERVER}:8080\/update/" \
135 ${ROOT_FS_DIR}/etc/lsb-release 167 ${ROOT_FS_DIR}/etc/lsb-release
136 fi 168 fi
137 else 169 else
138 emerge_chromeos_test 170 emerge_chromeos_test
139 171
140 MOD_TEST_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" 172 MOD_TEST_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts"
141 # Run test setup script to modify the image 173 # Run test setup script to modify the image
142 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \ 174 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \
143 "${MOD_TEST_ROOT}/test_setup.sh" 175 "${MOD_TEST_ROOT}/test_setup.sh"
144 176
145 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then 177 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
178 install_autotest
179
146 MOD_FACTORY_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_factory_scripts" 180 MOD_FACTORY_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_factory_scripts"
147 # Run factory setup script to modify the image 181 # Run factory setup script to modify the image
148 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \ 182 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \
149 STATEFUL_DIR="${STATEFUL_DIR}/dev_image" QUALDB="${FLAGS_qualdb}" \ 183 QUALDB="${FLAGS_qualdb}" \
150 "${MOD_FACTORY_ROOT}/factory_setup.sh" 184 "${MOD_FACTORY_ROOT}/factory_setup.sh"
151 fi 185 fi
152 fi 186 fi
153 187
188 # Let's have a look at the image just in case..
189 if [ "${VERIFY}" = "true" ]; then
190 pushd "${ROOT_FS_DIR}"
191 bash
192 popd
193 fi
194
154 cleanup 195 cleanup
155 trap - EXIT 196 trap - EXIT
156 197
OLDNEW
« no previous file with comments | « src/scripts/mod_for_factory_scripts/500copyQualDb ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698