blob: a259b89c6fcafbe815b7a0edeaba123609263b6a [file] [log] [blame]
Ryan Brownfed691e2014-09-15 13:09:40 -07001#!/bin/bash
2
3# Test running an application using the agent.
4
Jiri Simsaf8727f22014-09-24 19:08:49 -07005source "${VEYRON_ROOT}/scripts/lib/shell_test.sh"
Ryan Brownfed691e2014-09-15 13:09:40 -07006
7build() {
Jiri Simsad993b392014-09-29 21:22:00 -07008 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 Brownfed691e2014-09-15 13:09:40 -070010}
11
12main() {
13 local workdir="$(shell::tmp_dir)"
14 cd "${workdir}"
15 build
16
17 shell_test::setup_server_test
Ryan Brown50b473a2014-09-23 14:23:00 -070018
19 # Test running a single app.
Ryan Brownfed691e2014-09-15 13:09:40 -070020 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 Brown50b473a2014-09-23 14:23:00 -070027 shell_test::fail "line ${LINENO}: identity preserved"
Ryan Brownfed691e2014-09-15 13:09:40 -070028 fi
29
Ryan Brown50b473a2014-09-23 14:23:00 -070030 # 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 Brownfed691e2014-09-15 13:09:40 -070032}
33
34main "$@"