Index: src/scripts/mod_image_for_test.sh |
diff --git a/src/scripts/mod_image_for_test.sh b/src/scripts/mod_image_for_test.sh |
index fb35572443736b9bcda4a0f7219c3d1d40e927bb..261cc9eae8a5b05b9ba38c8229bdc1459f5f0fa2 100755 |
--- a/src/scripts/mod_image_for_test.sh |
+++ b/src/scripts/mod_image_for_test.sh |
@@ -13,7 +13,10 @@ |
get_default_board |
DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built" |
+DEFINE_string qualdb "/tmp/run_remote_tests.*" \ |
+ "Location of qualified component file" |
DEFINE_string image "" "Location of the rootfs raw image file" |
+DEFINE_boolean manuf $FLAGS_FALSE "Modify the image for manufacturing testing" |
DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" "y" |
# Parse command line |
@@ -100,6 +103,33 @@ MOD_SCRIPTS_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" |
sudo GCLIENT_ROOT=${GCLIENT_ROOT} ROOT_FS_DIR=${ROOT_FS_DIR} \ |
"${MOD_SCRIPTS_ROOT}/test_setup.sh" |
+# Run manufacturing test setup |
+if [ ${FLAGS_manuf} -eq ${FLAGS_TRUE} ]; then |
+ echo "Modifying image ${FLAGS_image} for manufacturing test..." |
+ |
+ # Try to use the sytem component file in the most recent autotest result |
+ FLAGS_qualdb=$(ls -dt ${FLAGS_qualdb} 2>&-| head -1) |
+ |
+ # Try to append the full path to the file if FLAGS_qualdb is a directory |
+ if [ ! -z ${FLAGS_qualdb} ] && [ -d ${FLAGS_qualdb} ]; then |
+ # TODO(waihong): Handle multiple results to deliver to multiple images |
+ FLAGS_qualdb="${FLAGS_qualdb}/platform_Components,*" |
+ FLAGS_qualdb=$(ls -dt ${FLAGS_qualdb} 2>&-| head -1) |
+ FLAGS_qualdb="${FLAGS_qualdb}/platform_Components/results/system_components" |
+ fi |
+ |
+ if [ ! -z ${FLAGS_qualdb} ] && [ -f ${FLAGS_qualdb} ]; then |
+ # Copy the qualified component file to the image |
+ echo "Copying ${FLAGS_qualdb} to the image." |
+ sudo mkdir -p ${ROOT_FS_DIR}/usr/local/manufacturing |
+ sudo cp -f ${FLAGS_qualdb} \ |
+ ${ROOT_FS_DIR}/usr/local/manufacturing/qualified_components |
+ else |
+ echo "No qualified component file found at: ${FLAGS_qualdb}" |
+ exit 1 |
+ fi |
+fi |
+ |
cleanup |
trap - EXIT |