curl_put /profile "{ \"nickname\": \"$player\" }" "-c ${!player_cookie}"
empathy_get $player events >/dev/null 2>&1 &
eval ${player_pid}=$!
+ empathy_players+=($player)
}
# Usage: empathy_player_deactivate <player_name>
{
player="$1"
player_pid=${player}_pid
- pkill -P ${!player_pid}
+ if [ "${!player_pid}" != "" ]; then
+ pkill -P ${!player_pid}
+ fi
+ eval ${player_pid}=""
}
# Pulls a single named event out of the empathy event stream
test "$result" = '"alice" 1 "bob" 1 "charlie" 0'
TEST_END
-empathy_player_deactivate alice
-empathy_player_deactivate bob
-empathy_player_deactivate charlie
+empathy_deactivate_all()
+{
+ for player in ${empathy_players[*]}; do
+ empathy_player_deactivate $player
+ done
+}
+
+empathy_deactivate_all
TEST_REPORT