• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# Read command flags
8. /usr/share/misc/shflags
9DEFINE_string "remote" "" "remote machine IP address" "r"
10
11PROG=$0
12FLAGS_HELP=\
13"USAGE: $PROG [flags]
14
15Examples:
16  # Generate the version info and scp it to the IP address.
17  $ $PROG -r 100.20.300.123
18"
19
20FLAGS "$@" || exit 1
21eval set -- "${FLAGS_ARGV}"
22set -e
23
24
25PROJ="firmware_TouchMTB"
26TEST_DIR="/usr/local/autotest/tests/${PROJ}"
27VERSION_FILE="/tmp/.version"
28
29# Print an error message and exit.
30die() {
31  echo "$@" > /dev/stderr
32  exit 1
33}
34
35if [ -z ${FLAGS_remote} ]; then
36  die "Error: you need to provide the IP address of the test machine."
37fi
38
39create_version="`dirname $PROG`"/tools/create_version.py
40if ! $create_version "$VERSION_FILE"; then
41  die "Error: failed to create version info"
42fi
43
44expect_scp="`dirname $PROG`"/tools/expect_scp
45if ! $expect_scp "root@${FLAGS_remote}:${TEST_DIR}" "$VERSION_FILE"; then
46  die "Error: scp version file $VERSION_FILE to ${FLAGS_remote}:${TEST_DIR}"
47fi
48
49rm -fr "$VERSION_FILE"
50