Ryan Brown | 9d8aa9b | 2014-12-11 12:06:48 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Helper script for testing vrun. |
| 4 | |
Jiri Simsa | 3540e3a | 2014-12-26 07:54:09 -0800 | [diff] [blame] | 5 | source "$(go list -f {{.Dir}} v.io/core/shell/lib)/shell_test.sh" |
Ryan Brown | 9d8aa9b | 2014-12-11 12:06:48 -0800 | [diff] [blame] | 6 | |
| 7 | main() { |
| 8 | shell_test::setup_server_test |
Jiri Simsa | 764efb7 | 2014-12-25 20:57:03 -0800 | [diff] [blame] | 9 | local -r PINGPONG="$(shell_test::build_go_binary 'v.io/core/veyron/security/agent/pingpong')" |
| 10 | local -r VRUN="$(shell_test::build_go_binary 'v.io/core/veyron/tools/vrun')" |
| 11 | local -r PRINCIPAL="$(shell_test::build_go_binary 'v.io/core/veyron/tools/principal')" |
Ryan Brown | 9d8aa9b | 2014-12-11 12:06:48 -0800 | [diff] [blame] | 12 | |
| 13 | local blessing=$("${PRINCIPAL}" dump | grep Default|cut -d: -f2) |
| 14 | shell_test::assert_eq "${blessing}" " agent_principal" $LINENO |
| 15 | blessing=$("${VRUN}" "${PRINCIPAL}" dump | grep Default|cut -d: -f2) |
| 16 | shell_test::assert_eq "${blessing}" " agent_principal/principal" $LINENO |
| 17 | blessing=$("${VRUN}" --name=foo "${PRINCIPAL}" dump | grep Default|cut -d: -f2) |
| 18 | shell_test::assert_eq "${blessing}" " agent_principal/foo" $LINENO |
| 19 | |
| 20 | # TODO(ribrdb): test --duration |
| 21 | |
| 22 | shell_test::start_server "${VRUN}" "${PINGPONG}" --server |
| 23 | "${VRUN}" "${PINGPONG}" || shell_test::fail "line ${LINENO}: ping" |
| 24 | shell_test::pass |
| 25 | } |
| 26 | |
| 27 | main "$@" |