mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
agent/scenarios/bulk-calls: Setup scenario for CI
Change-Id: I06a7f8da672946b20c353e4b5d3a3aaa499203fb
This commit is contained in:

committed by
Sébastien Blin

parent
15460298ab
commit
fb7d9b4db6
@ -52,8 +52,10 @@ AC_ARG_ENABLE([agent],
|
|||||||
AM_CONDITIONAL([ENABLE_AGENT], [test "x$enable_agent" = "xyes"])
|
AM_CONDITIONAL([ENABLE_AGENT], [test "x$enable_agent" = "xyes"])
|
||||||
AM_COND_IF([ENABLE_AGENT],
|
AM_COND_IF([ENABLE_AGENT],
|
||||||
[AC_CONFIG_FILES([test/agent/Makefile
|
[AC_CONFIG_FILES([test/agent/Makefile
|
||||||
test/agent/pre-inst-env:test/agent/build-aux/pre-inst-env.in],
|
test/agent/pre-inst-env:test/agent/build-aux/pre-inst-env.in
|
||||||
[chmod +x test/agent/pre-inst-env])])
|
test/agent/scenarios/bulk-calls/run-scenario],
|
||||||
|
[chmod +x test/agent/pre-inst-env
|
||||||
|
chmod +x test/agent/scenarios/bulk-calls/run-scenario])])
|
||||||
|
|
||||||
AC_ARG_ENABLE([tracepoints], AS_HELP_STRING([--enable-tracepoints], [Enable tracepoints]))
|
AC_ARG_ENABLE([tracepoints], AS_HELP_STRING([--enable-tracepoints], [Enable tracepoints]))
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
../../agent.scm
|
|
@ -1 +0,0 @@
|
|||||||
../../jami/
|
|
6
test/agent/scenarios/bulk-calls/run-scenario → test/agent/scenarios/bulk-calls/run-scenario.in
Executable file → Normal file
6
test/agent/scenarios/bulk-calls/run-scenario → test/agent/scenarios/bulk-calls/run-scenario.in
Executable file → Normal file
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
agent_dir="@abs_top_srcdir@/test/agent"
|
||||||
|
|
||||||
tmp_alice=$(mktemp --tmpdir --directory "jami-bulk-calls.XXXXXXXXXX")
|
tmp_alice=$(mktemp --tmpdir --directory "jami-bulk-calls.XXXXXXXXXX")
|
||||||
tmp_bob=$(mktemp --tmpdir --directory "jami-bulk-calls.XXXXXXXXXX")
|
tmp_bob=$(mktemp --tmpdir --directory "jami-bulk-calls.XXXXXXXXXX")
|
||||||
|
|
||||||
@ -13,7 +15,7 @@ export XDG_CACHE_HOME="$tmp_bob"
|
|||||||
export XDG_DATA_HOME="$tmp_bob"
|
export XDG_DATA_HOME="$tmp_bob"
|
||||||
|
|
||||||
export JAMI_LOG_FILE="bob.log"
|
export JAMI_LOG_FILE="bob.log"
|
||||||
./scenario.scm "bob" > bob-guile.txt 2>&1 &
|
agent -e main -s $agent_dir/scenarios/bulk-calls/scenario.scm "bob" > bob-guile.txt 2>&1 &
|
||||||
|
|
||||||
bob_pid=$!
|
bob_pid=$!
|
||||||
|
|
||||||
@ -23,7 +25,7 @@ export XDG_CONFIG_HOME="$tmp_alice"
|
|||||||
export XDG_CACHE_HOME="$tmp_alice"
|
export XDG_CACHE_HOME="$tmp_alice"
|
||||||
export XDG_DATA_HOME="$tmp_alice"
|
export XDG_DATA_HOME="$tmp_alice"
|
||||||
export JAMI_LOG_FILE="alice.log"
|
export JAMI_LOG_FILE="alice.log"
|
||||||
./scenario.scm "alice" "$bob_id" > alice-guile.txt 2>&1
|
agent -e main -s $agent_dir/scenarios/bulk-calls/scenario.scm "alice" "$bob_id" > alice-guile.txt 2>&1
|
||||||
|
|
||||||
wait $bob_pid
|
wait $bob_pid
|
||||||
|
|
59
test/agent/scenarios/bulk-calls/scenario.scm
Executable file → Normal file
59
test/agent/scenarios/bulk-calls/scenario.scm
Executable file → Normal file
@ -1,6 +1,3 @@
|
|||||||
#!/usr/bin/env -S ./agent.exe --no-auto-compile -e main -s
|
|
||||||
!#
|
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;;
|
;;;
|
||||||
;;; This scenario tests calling a peer in a single registration.
|
;;; This scenario tests calling a peer in a single registration.
|
||||||
@ -54,26 +51,30 @@
|
|||||||
(make-exception
|
(make-exception
|
||||||
(make-exception-with-message "Can't make friend with bob"))))
|
(make-exception-with-message "Can't make friend with bob"))))
|
||||||
|
|
||||||
;; Wait for Bob to install call handlers.
|
(define (call-bob timeout)
|
||||||
(sleep (* 2 GRACE-PERIOD))
|
(let ((this-call-id ""))
|
||||||
|
(jami:with-signal-sync
|
||||||
|
'state-changed
|
||||||
|
(lambda (account-id call-id state code)
|
||||||
|
(and (string= account-id (agent:account-id me))
|
||||||
|
(string= call-id this-call-id)
|
||||||
|
(string= state "CURRENT")))
|
||||||
|
timeout
|
||||||
|
(set! this-call-id (agent:call-friend me bob-id)))
|
||||||
|
this-call-id))
|
||||||
|
|
||||||
(let loop ([cnt 1])
|
;; Synchronize with bob a first time.
|
||||||
|
(jami:info "Alice sending call #~a" 1)
|
||||||
|
(call:hang-up (agent:account-id me)
|
||||||
|
(call-bob #f))
|
||||||
|
|
||||||
|
(let loop ((cnt 2))
|
||||||
(when (<= cnt CALL-COUNT)
|
(when (<= cnt CALL-COUNT)
|
||||||
(jami:info "Alice sending call #~a" cnt)
|
(jami:info "Alice sending call #~a" cnt)
|
||||||
(let ([this-call-id ""])
|
(let ((call-id (call-bob GRACE-PERIOD)))
|
||||||
(jami:with-signal-sync
|
|
||||||
'state-changed
|
|
||||||
(lambda (account-id call-id state code)
|
|
||||||
(and (string= account-id (agent:account-id me))
|
|
||||||
(string= call-id this-call-id)
|
|
||||||
(string= state "CURRENT")))
|
|
||||||
GRACE-PERIOD
|
|
||||||
(set! this-call-id (agent:call-friend me bob-id)))
|
|
||||||
|
|
||||||
(sleep GRACE-PERIOD)
|
(sleep GRACE-PERIOD)
|
||||||
(call:hang-up (agent:account-id me) this-call-id)
|
(call:hang-up (agent:account-id me) call-id)
|
||||||
(sleep GRACE-PERIOD))
|
(sleep GRACE-PERIOD))
|
||||||
|
|
||||||
(loop (1+ cnt)))))
|
(loop (1+ cnt)))))
|
||||||
|
|
||||||
(define (bob)
|
(define (bob)
|
||||||
@ -88,7 +89,7 @@
|
|||||||
(jami:with-signal-sync
|
(jami:with-signal-sync
|
||||||
'incoming-trust-request
|
'incoming-trust-request
|
||||||
(lambda (account-id conversation-id peer-id payload received)
|
(lambda (account-id conversation-id peer-id payload received)
|
||||||
(let ([sync? (string= account-id (agent:account-id me))])
|
(let ((sync? (string= account-id (agent:account-id me))))
|
||||||
(when sync?
|
(when sync?
|
||||||
(jami:info "accepting trust request: ~a ~a" account-id peer-id)
|
(jami:info "accepting trust request: ~a ~a" account-id peer-id)
|
||||||
(account:accept-trust-request account-id peer-id))
|
(account:accept-trust-request account-id peer-id))
|
||||||
@ -96,9 +97,9 @@
|
|||||||
|
|
||||||
|
|
||||||
;; Accept all incoming calls with media.
|
;; Accept all incoming calls with media.
|
||||||
(let ([mtx (make-recursive-mutex)]
|
(let ((mtx (make-recursive-mutex))
|
||||||
[cnd (make-condition-variable)]
|
(cnd (make-condition-variable))
|
||||||
[received 0])
|
(received 0))
|
||||||
(with-mutex mtx
|
(with-mutex mtx
|
||||||
(jami:with-signal
|
(jami:with-signal
|
||||||
'incoming-call/media
|
'incoming-call/media
|
||||||
@ -110,21 +111,21 @@
|
|||||||
(jami:info "Bob has received: ~a calls" received)
|
(jami:info "Bob has received: ~a calls" received)
|
||||||
(when (= received CALL-COUNT)
|
(when (= received CALL-COUNT)
|
||||||
(signal-condition-variable cnd)))))
|
(signal-condition-variable cnd)))))
|
||||||
(let ([success?
|
(let ((success?
|
||||||
(wait-condition-variable
|
(wait-condition-variable
|
||||||
cnd mtx (+ (current-time) (* 4 GRACE-PERIOD CALL-COUNT)))])
|
cnd mtx (+ (current-time) (* 4 GRACE-PERIOD CALL-COUNT)))))
|
||||||
(jami:info "Summary: ~a%" (* 100 (/ received CALL-COUNT)))
|
(jami:info "Summary: ~a%" (* 100 (/ received CALL-COUNT)))
|
||||||
(exit success?))))))
|
(exit success?))))))
|
||||||
|
|
||||||
(define (main args)
|
(define (main args)
|
||||||
|
|
||||||
(match (cdr args)
|
(match (cdr args)
|
||||||
[("alice" bob-id) (alice bob-id)]
|
(("alice" bob-id) (alice bob-id))
|
||||||
[("bob") (bob)]
|
(("bob") (bob))
|
||||||
[_
|
(_
|
||||||
(jami:error "Invalid arguments: ~a" args)
|
(jami:error "Invalid arguments: ~a" args)
|
||||||
(jami:error "Usage: ~a alice|bob [ARG]\n" (car args))
|
(jami:error "Usage: ~a alice|bob (ARG)\n" (car args))
|
||||||
(exit EXIT_FAILURE)])
|
(exit EXIT_FAILURE)))
|
||||||
|
|
||||||
(jami:info "bye bye")
|
(jami:info "bye bye")
|
||||||
|
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
tmp=$(mktemp --tmpdir --directory "jami-peer-monitor.XXXXXXXXXX")
|
|
||||||
|
|
||||||
export XDG_CONFIG_HOME="$tmp"
|
|
||||||
export XDG_CACHE_HOME="$tmp"
|
|
||||||
export XDG_DATA_HOME="$tmp"
|
|
||||||
export GUILE_AUTO_COMPILE=0
|
|
||||||
export JAMI_LOG_FILE="$1.log"
|
|
||||||
|
|
||||||
./scenario.scm $@
|
|
||||||
|
|
||||||
rm -rf "$tmp"
|
|
||||||
|
|
Reference in New Issue
Block a user