Skip to content
Snippets Groups Projects
Commit fb7d9b4d authored by Olivier Dion's avatar Olivier Dion Committed by Sébastien Blin
Browse files

agent/scenarios/bulk-calls: Setup scenario for CI

Change-Id: I06a7f8da672946b20c353e4b5d3a3aaa499203fb
parent 15460298
No related branches found
No related tags found
No related merge requests found
...@@ -52,8 +52,10 @@ AC_ARG_ENABLE([agent], ...@@ -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]))
......
../../agent.scm
\ No newline at end of file
../../jami/
\ No newline at end of file
#!/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" ...@@ -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" ...@@ -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
......
#!/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 @@ ...@@ -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 ""))
(let loop ([cnt 1])
(when (<= cnt CALL-COUNT)
(jami:info "Alice sending call #~a" cnt)
(let ([this-call-id ""])
(jami:with-signal-sync (jami:with-signal-sync
'state-changed 'state-changed
(lambda (account-id call-id state code) (lambda (account-id call-id state code)
(and (string= account-id (agent:account-id me)) (and (string= account-id (agent:account-id me))
(string= call-id this-call-id) (string= call-id this-call-id)
(string= state "CURRENT"))) (string= state "CURRENT")))
GRACE-PERIOD timeout
(set! this-call-id (agent:call-friend me bob-id))) (set! this-call-id (agent:call-friend me bob-id)))
this-call-id))
;; 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)
(jami:info "Alice sending call #~a" cnt)
(let ((call-id (call-bob GRACE-PERIOD)))
(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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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")
......
#!/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"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment