blob: ea612615f8694cb0c9a2c0dcf992591f5e43fece [file] [log] [blame]
Ryan Brown9d8aa9b2014-12-11 12:06:48 -08001#!/bin/bash
2
3# Helper script for testing vrun.
4
Jiri Simsa7d1b28d2014-12-12 22:39:37 -08005source "$(go list -f {{.Dir}} veyron.io/veyron/shell/lib)/shell_test.sh"
Ryan Brown9d8aa9b2014-12-11 12:06:48 -08006
7main() {
8 shell_test::setup_server_test
9 local -r PINGPONG="$(shell_test::build_go_binary 'veyron.io/veyron/veyron/security/agent/pingpong')"
10 local -r VRUN="$(shell_test::build_go_binary 'veyron.io/veyron/veyron/tools/vrun')"
11 local -r PRINCIPAL="$(shell_test::build_go_binary 'veyron.io/veyron/veyron/tools/principal')"
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
27main "$@"