blob: dae88af7152608fd629642bd13667e231295f267 [file] [log] [blame]
Ryan Brown9d8aa9b2014-12-11 12:06:48 -08001#!/bin/bash
2
3# Helper script for testing vrun.
4
Jiri Simsa3540e3a2014-12-26 07:54:09 -08005source "$(go list -f {{.Dir}} v.io/core/shell/lib)/shell_test.sh"
Ryan Brown9d8aa9b2014-12-11 12:06:48 -08006
7main() {
8 shell_test::setup_server_test
Jiri Simsa764efb72014-12-25 20:57:03 -08009 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 Brown9d8aa9b2014-12-11 12:06:48 -080012
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
27main "$@"