diff --git a/core/actor.lisp b/core/actor.lisp index 6ce553a..1bc58bb 100644 --- a/core/actor.lisp +++ b/core/actor.lisp @@ -61,9 +61,9 @@ (let ((*self* tsk)) (handler-case (funcall bhv msg) (error (err) - ;(util:lg :error "behavior" msg err) - (invoke-debugger err)) - ))) + (invoke-debugger err) + (util:lg :error "behavior" msg err) + )))) ;;;; the core (classical, i.e. Hewitt) actor API diff --git a/test/etc/config-csys.lisp b/test/etc/config-csys.lisp index 429520f..db0b307 100644 --- a/test/etc/config-csys.lisp +++ b/test/etc/config-csys.lisp @@ -4,7 +4,10 @@ (config:root) -(config:add-action '(:csys :sensor :log) (csys:neuron #'csys:logger :testing)) +(config:add-action '(:csys :sensor :log) + (csys:neuron #'csys:logger :testing + (list (csys:synapse *probe*)) + )) (config:add :logger :class 'logging:config :loglevel (config:from-env :loglevel :info) diff --git a/test/test-csys.lisp b/test/test-csys.lisp index 4869855..5cd2da3 100644 --- a/test/test-csys.lisp +++ b/test/test-csys.lisp @@ -18,24 +18,39 @@ (in-package :scopes/test-csys) +;;;; testing environment + +(defclass test-env (csys:environment) + ((test-suite :reader test-suite :initarg :test-suite))) + +(defun probe (msg state syns env) + (let ((t:*test-suite* (test-suite env))) + (== (shape:data msg) (pop state)) + (actor:become (csys:neuron #'probe state syns env)))) + +(defvar *probe* nil) + ;;;; test runner (defun run () (async:init) (let* ((t:*test-suite* (make-instance 't:test-suite :name "csys")) - (csys:*sensors* (make-hash-table :test #'equal))) + (csys:*sensors* (make-hash-table :test #'equal)) + (csys:*environment* (make-instance 'test-env :test-suite t:*test-suite*)) + (*probe* (actor:create + (csys:neuron #'probe '(1 3 4 5) nil csys:*environment*)))) (load (t:test-path "config-csys" "etc")) + (core:setup-services) (unwind-protect (progn - (test-nodispatch)) + (test-basic)) + (sleep 0.1) (async:finish) (t:show-result)))) -(deftest test-nodispatch () - (core:setup-services) +(deftest test-basic () (csys:send-message '(:csys :add :log :s1) 1) (csys:send-message '(:csys :add :log :s1) 3) (csys:send-message '(:csys :sub :log :s2) 4) (csys:send-message '(:csys :add :log :s2) 5) - (sleep 0.1) )