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

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

Issue 1081002: Modify image for mfg test, e.g. copying qualified component file to the image. (Closed)
Patch Set: fix style mistakes Created 10 years, 9 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 | « no previous file | 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 get_default_board 13 get_default_board
14 14
15 DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built" 15 DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built"
16 DEFINE_string qualdb "/tmp/run_remote_tests.*" \
17 "Location of qualified component file"
16 DEFINE_string image "" "Location of the rootfs raw image file" 18 DEFINE_string image "" "Location of the rootfs raw image file"
19 DEFINE_boolean manuf $FLAGS_FALSE "Modify the image for manufacturing testing"
17 DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" "y" 20 DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" "y"
18 21
19 # Parse command line 22 # Parse command line
20 FLAGS "$@" || exit 1 23 FLAGS "$@" || exit 1
21 eval set -- "${FLAGS_ARGV}" 24 eval set -- "${FLAGS_ARGV}"
22 25
23 # No board, no default and no image set then we can't find the image 26 # No board, no default and no image set then we can't find the image
24 if [ -z $FLAGS_IMAGE ] && [ -z $FLAGS_board ] ; then 27 if [ -z $FLAGS_IMAGE ] && [ -z $FLAGS_board ] ; then
25 setup_board_warning 28 setup_board_warning
26 echo "*** mod_image_for_test failed. No board set and no image set" 29 echo "*** mod_image_for_test failed. No board set and no image set"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 fi 96 fi
94 else 97 else
95 echo "Modifying image ${FLAGS_image} for test..." 98 echo "Modifying image ${FLAGS_image} for test..."
96 fi 99 fi
97 100
98 MOD_SCRIPTS_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" 101 MOD_SCRIPTS_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts"
99 # Run test setup script inside chroot jail to modify the image 102 # Run test setup script inside chroot jail to modify the image
100 sudo GCLIENT_ROOT=${GCLIENT_ROOT} ROOT_FS_DIR=${ROOT_FS_DIR} \ 103 sudo GCLIENT_ROOT=${GCLIENT_ROOT} ROOT_FS_DIR=${ROOT_FS_DIR} \
101 "${MOD_SCRIPTS_ROOT}/test_setup.sh" 104 "${MOD_SCRIPTS_ROOT}/test_setup.sh"
102 105
106 # Run manufacturing test setup
107 if [ ${FLAGS_manuf} -eq ${FLAGS_TRUE} ]; then
108 echo "Modifying image ${FLAGS_image} for manufacturing test..."
109
110 # Try to use the sytem component file in the most recent autotest result
111 FLAGS_qualdb=$(ls -dt ${FLAGS_qualdb} 2>&-| head -1)
112
113 # Try to append the full path to the file if FLAGS_qualdb is a directory
114 if [ ! -z ${FLAGS_qualdb} ] && [ -d ${FLAGS_qualdb} ]; then
115 # TODO(waihong): Handle multiple results to deliver to multiple images
116 FLAGS_qualdb="${FLAGS_qualdb}/platform_Components,*"
117 FLAGS_qualdb=$(ls -dt ${FLAGS_qualdb} 2>&-| head -1)
118 FLAGS_qualdb="${FLAGS_qualdb}/platform_Components/results/system_components"
119 fi
120
121 if [ ! -z ${FLAGS_qualdb} ] && [ -f ${FLAGS_qualdb} ]; then
122 # Copy the qualified component file to the image
123 echo "Copying ${FLAGS_qualdb} to the image."
124 sudo mkdir -p ${ROOT_FS_DIR}/usr/local/manufacturing
125 sudo cp -f ${FLAGS_qualdb} \
126 ${ROOT_FS_DIR}/usr/local/manufacturing/qualified_components
127 else
128 echo "No qualified component file found at: ${FLAGS_qualdb}"
129 exit 1
130 fi
131 fi
132
103 cleanup 133 cleanup
104 trap - EXIT 134 trap - EXIT
105 135
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698