]> git.wh0rd.org - home.git/blobdiff - .bin/cros-board
test.cc: new C++ test
[home.git] / .bin / cros-board
index 99c221e40de19c30de1241c76ccf09eceec1b68e..b8c8e5973f0cc8257a7e09784609152b3443bfe6 100755 (executable)
@@ -5,15 +5,38 @@ set -e
 
 cd "${HOME}/trunk/src/scripts/"
 
-: ${BOARD:=`cat .default_board 2>/dev/null`}
+: "${BOARD:="$(cat .default_board 2>/dev/null)"}"
 if [[ -z ${BOARD} ]] ; then
        die "missing BOARD"
 fi
 IMAGES="${HOME}/trunk/src/build/images/${BOARD}"
 BUILD="/build/${BOARD}"
 
+usage() {
+       exec cat <<EOF
+Usage: cros-board [options]
+
+Build for the board listed in \${BOARD} (current: ${BOARD}).
+Normally only builds a dev image.
+
+Options:
+  -t          Build test packages & image
+  --autotest  Build & install autotest packages.
+  --factory   Build factory packages & image.
+  --nousepkg  Force build from source.
+
+  --clean     ?
+
+  -Y          Write image to ${ARG_DEV} w/out prompting.
+  -y <dev>    Write image to <dev> w/out prompting.
+
+  -p          Pretend -- show commands that would be run.
+  -v          Verbose -- send command output to stdout.
+EOF
+}
+
 ARG_CLEAN=false
-ARG_DEV="/dev/sdc"
+ARG_DEV="/dev/sdd"
 ARG_DEV_USER=false
 ARG_PRETEND=false
 ARG_NOPKG=false
@@ -32,7 +55,7 @@ while [[ $# -ne 0 ]] ; do
        --nousepkg) ARG_NOPKG=true;;
        --autotest) ARG_AUTOTEST=true;;
        --factory) ARG_FACTORY=true;;
-       -h) exec sed -n '/^while/,/^done/p' "$0";;
+       -h) usage;;
        *) echo "unknown opt: $*"; exit 1;;
        esac
        shift
@@ -52,7 +75,7 @@ run() {
                piperet
                eend $? || exit $?
        else
-               einfo "$*"
+               echo "$*"
        fi
        set -e
 }
@@ -78,6 +101,7 @@ fi
 run ./build_packages \
        --board=${BOARD} \
        --nowithdebug \
+       --nowithrevdeps \
        --skip_chroot_upgrade \
        $(tfe ${ARG_AUTOTEST} --{,no}withautotest) \
        $(tfe ${ARG_FACTORY} --{,no}withfactory) \
@@ -105,12 +129,20 @@ ${IMG_TO_USB}
 ### KVM
 ${d}/image_to_vm.sh --board=${BOARD} --from=../build/images/${BOARD}/latest
 ${d}/image_to_vm.sh --board=${BOARD} --from=../build/images/${BOARD}/latest --test_image
-${d}/bin/cros_start_vm --no_graphics --image_path=../build/images/${BOARD}/latest/chromiumos_qemu_image.bin
-kvm -m 1024 -vga std -net nic,model=virtio -net user,hostfwd=tcp::9222-:22 -hda ~/chromiumos/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin
+~/chromiumos/src/scripts/bin/cros_start_vm --no_graphics --image_path=\${HOME}/chromiumos/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin --kvm_cpu "max,vmx=on"
+qemu-system-x86_64 -enable-kvm -cpu max,vmx=on -m 1024 -vga std -net nic,model=virtio -net user,hostfwd=tcp::9222-:22 -hda ~/chromiumos/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin
+
+https://dev.chromium.org/chromium-os/testing/running-smoke-suite-on-a-vm-image
+
+/usr/local/autotest/bin/autologin.py
+
+export CROS_USER_ID_HASH=$(ls /home/user/)
+sudo -u chronos CROS_USER_ID_HASH="${CROS_USER_ID_HASH}" crosh
+  vmc start termina  # might run twice
 
 ### RECOVERY
 ${d}/mod_image_for_recovery.sh --board=${BOARD}
-${IMG_TO_USB} --image_name=recovery_image.bin
+${IMG_TO_USB%/dev}/recovery
 
 ### FACTORY
 ${BUILD_IMG} --factory_install