Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Test running an application using the agent. |
| 4 | |
Jiri Simsa | f8727f2 | 2014-09-24 19:08:49 -0700 | [diff] [blame] | 5 | source "${VEYRON_ROOT}/scripts/lib/shell_test.sh" |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 6 | |
| 7 | build() { |
Jiri Simsa | d993b39 | 2014-09-29 21:22:00 -0700 | [diff] [blame] | 8 | veyron go build veyron.io/veyron/veyron/security/agent/agentd || shell_test::fail "line ${LINENO}: failed to build agentd" |
| 9 | veyron go build -o pingpong veyron.io/veyron/veyron/security/agent/test || shell_test::fail "line ${LINENO}: failed to build pingpong" |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 10 | } |
| 11 | |
| 12 | main() { |
| 13 | local workdir="$(shell::tmp_dir)" |
| 14 | cd "${workdir}" |
| 15 | build |
| 16 | |
| 17 | shell_test::setup_server_test |
Ryan Brown | 50b473a | 2014-09-23 14:23:00 -0700 | [diff] [blame] | 18 | |
| 19 | # Test running a single app. |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 20 | shell_test::start_server ./pingpong --server |
| 21 | export VEYRON_PUBLICID_STORE="$(shell::tmp_dir)" |
| 22 | echo VEYRON_PUBLICID_STORE=$VEYRON_PUBLICID_STORE |
| 23 | ls $VEYRON_PUBLICID_STORE |
| 24 | ./agentd --v=4 ./pingpong || shell_test::fail "line ${LINENO}: ping" |
| 25 | local identity=$(./agentd bash -c 'echo $VEYRON_IDENTITY') |
| 26 | if [[ -n "${identity}" ]]; then |
Ryan Brown | 50b473a | 2014-09-23 14:23:00 -0700 | [diff] [blame] | 27 | shell_test::fail "line ${LINENO}: identity preserved" |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 28 | fi |
| 29 | |
Ryan Brown | 50b473a | 2014-09-23 14:23:00 -0700 | [diff] [blame] | 30 | # Test running multiple apps connecting to the same agent. |
| 31 | exec ./agentd bash ${VEYRON_ROOT}/veyron/go/src/veyron.io/veyron/veyron/security/agent/testchild.sh |
Ryan Brown | fed691e | 2014-09-15 13:09:40 -0700 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | main "$@" |