Skip to content

Commit

Permalink
Merge pull request #522 from k-okada/fix_travis
Browse files Browse the repository at this point in the history
add test with compiled lisp
  • Loading branch information
k-okada authored Sep 11, 2018
2 parents 0bc5594 + 6cf3625 commit 59b0356
Show file tree
Hide file tree
Showing 22 changed files with 47 additions and 963 deletions.
37 changes: 30 additions & 7 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@
set -e

function travis_time_start {
set +x
TRAVIS_START_TIME=$(date +%s%N)
TRAVIS_TIME_ID=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)
TRAVIS_FOLD_NAME=$1
echo -e "\e[0Ktraivs_fold:start:$TRAVIS_FOLD_NAME"
echo -e "\e[0Ktraivs_time:start:$TRAVIS_TIME_ID"
set -x
set -x # enable debug information
}
function travis_time_end {
set +x
set +x # disable debug information
_COLOR=${1:-32}
TRAVIS_END_TIME=$(date +%s%N)
TIME_ELAPSED_SECONDS=$(( ($TRAVIS_END_TIME - $TRAVIS_START_TIME)/1000000000 ))
echo -e "traivs_time:end:$TRAVIS_TIME_ID:start=$TRAVIS_START_TIME,finish=$TRAVIS_END_TIME,duration=$(($TRAVIS_END_TIME - $TRAVIS_START_TIME))\n\e[0K"
echo -e "traivs_fold:end:$TRAVIS_FOLD_NAME"
echo -e "\e[0K\e[${_COLOR}mFunction $TRAVIS_FOLD_NAME takes $(( $TIME_ELAPSED_SECONDS / 60 )) min $(( $TIME_ELAPSED_SECONDS % 60 )) sec\e[0m"
set -x
}

travis_time_start setup.apt-get_update
Expand All @@ -41,7 +39,32 @@ cd jskeus
make
travis_time_end

travis_time_start script.test
source bashrc.eus
export EXIT_STATUS=0; for test_l in irteus/test/*.l; do irteusgl $test_l; export EXIT_STATUS=`expr $? + $EXIT_STATUS`; done;echo "Exit status : $EXIT_STATUS"; [ $EXIT_STATUS == 0 ] || exit 1
travis_time_end
export EXIT_STATUS=0;
set +e

for test_l in irteus/test/*.l; do

travis_time_start jskeus.source.${test_l##*/}.test

irteusgl $test_l;
export TMP_EXIT_STATUS=$?

travis_time_end `expr 32 - $TMP_EXIT_STATUS`

export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`;


travis_time_start jskeus.compiled.${test_l##*/}.test

irteusgl "(let ((o (namestring (merge-pathnames \".o\" \"$test_l\"))) (so (namestring (merge-pathnames \".so\" \"$test_l\")))) (compile-file \"$test_l\" :o o) (if (probe-file so) (load so) (exit 1))))"
export TMP_EXIT_STATUS=$?

travis_time_end `expr 32 - $TMP_EXIT_STATUS`

export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`;

done;
echo "Exit status : $EXIT_STATUS";

[ $EXIT_STATUS == 0 ] || exit 1
4 changes: 2 additions & 2 deletions irteus/demo/full-body-ik.l
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

(defun full-body-ik
(&key (target (make-coords :pos (float-vector 0 0 1500)))
(use-torso t) (use-leg))
(use-torso t) (use-leg) (debug-view :no-flush))
"full body ik"
(send *irtviewer* :title "full-body-ik")
(unless (boundp '*robot*)
Expand Down Expand Up @@ -34,7 +34,7 @@
:move-target (send *robot* :larm :end-coords)
:rotation-axis nil :translation-axis t
:manipulability-gain 0.05
:debug-view :no-flush
:debug-view debug-view
(if use-leg '(:manipulability-limit 0.5)))
(send *robot* :head :look-at
(send *robot* :larm :end-coords :worldpos))
Expand Down
1 change: 0 additions & 1 deletion irteus/demo/hand-grasp-ik.l
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
(pqp-collision-distance l c0))
(flatten (link-descendants (send j :child-link))))
#'<= #'car))
(print r)
(if (evenp (/ i 400))
(if (> (caar r) 5)
(send j :joint-angle (elt av k) :relative t))
Expand Down
114 changes: 0 additions & 114 deletions irteus/test/bignum.l

This file was deleted.

49 changes: 0 additions & 49 deletions irteus/test/character.l

This file was deleted.

29 changes: 0 additions & 29 deletions irteus/test/const.l

This file was deleted.

36 changes: 0 additions & 36 deletions irteus/test/coords.l
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,6 @@

(setq i-max 100000)

(deftest test-makecoords-rpy
(setq vmrss-orig (elt (unix::getrusage 0) 2))
(dotimes (j 10)
(dotimes (i i-max)
(setq ret #f(0 0 0))
(make-cascoords :pos (float-vector 0 0 0)
:rpy (float-vector 0 0 0)))
;;
(setq vmrss (elt (unix::getrusage 0) 2))
(format *error-output* "~A gc:~A, vmrss:~A -> ~A~%" j (sys::gc) vmrss-orig vmrss)
(assert (< vmrss (* 2 vmrss-orig)) "make-coords pos/rpy")))

(deftest test-makecoords-rot-1
(setq vmrss-orig (elt (unix::getrusage 0) 2))
(dotimes (j 10)
(dotimes (i i-max)
(setq ret #f(0 0 0))
(make-cascoords :pos (float-vector 0 0 0)
:rot (unit-matrix 3)))
;;
(setq vmrss (elt (unix::getrusage 0) 2))
(format *error-output* "~A gc:~A, vmrss:~A -> ~A~%" j (sys::gc) vmrss-orig vmrss)
(assert (< vmrss (* 2 vmrss-orig)) "make-coords pos/rot (unit-matrix)")))

(deftest test-makecoords-rot-2
(setq vmrss-orig (elt (unix::getrusage 0) 2))
(dotimes (j 10)
(dotimes (i i-max)
(setq ret #f(0 0 0))
(make-cascoords :pos (float-vector 0 0 0)
:rot (rpy-matrix 0 0 0)))
;;
(setq vmrss (elt (unix::getrusage 0) 2))
(format *error-output* "~A gc:~A, vmrss:~A -> ~A~%" j (sys::gc) vmrss-orig vmrss)
(assert (< vmrss (* 2 vmrss-orig)) "make-coords pos/rot (rpy-matrix)")))

(deftest test-makecoords-quaternion
(setq vmrss-orig (elt (unix::getrusage 0) 2))
(dotimes (j 10)
Expand Down
12 changes: 2 additions & 10 deletions irteus/test/geo.l
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
(init-unit-test)

(in-package "GEO")
;; redefined to use normalize-vector defined in irteus(?)
;; this requrie to avoid outer circuit not found in (body+ c1 b d1 c2 d2 c3 d3 c4 d4),
(defun face-normal-vector (vertices)
(let* ((v1 (first vertices)) (v2) (vlist (rest vertices))
(v (float-vector 0 0 0))
Expand Down Expand Up @@ -77,16 +79,6 @@
-0.2))
)

(deftest test-face-distance
(let* ((f
(instance face :init :vertices
'(#f(100 100 0) #f(-100 100 0) #f(-100 -100 0) #f(100 -100 0))))
)
(assert (eps= (send f :distance (float-vector 0 0 100)) 100.0))
(assert (eps= (send f :distance (float-vector 200 0 0)) 100.0))
(assert (eps= (send f :distance (float-vector 200 0 100)) (norm #f(100 100))))
))

(run-all-tests)
(exit)

10 changes: 6 additions & 4 deletions irteus/test/irteus-demo.l
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
(init-unit-test)

(load "irteus/demo/demo.l")
(defmacro do-until-key (&rest forms) (with-gensyms (do-until-key-counter tm) `(progn (setq tm (instance mtimer :init)) (dotimes (do-until-key-counter 10) (warning-message 2 ";; do-until-key ~7,3f ~A/~A~%" (send tm :stop) do-until-key-counter 10) ,@forms))))
(if (or (null x::*display*) (= x::*display* 0)) ;; aboid to show (window-main-one nil) was called, but no display is found. message to reduce outputs in travis
(defun x::window-main-one (&rest args) ))
(defmacro do-until-key (&rest forms) (with-gensyms (do-until-key-counter tm) `(progn (setq tm (instance mtimer :init)) (dotimes (do-until-key-counter 10) ,@forms))))

(deftest test-full-body-ik
(full-body-ik))
(full-body-ik :debug-view nil))

(deftest test-full-body-ik-use-torso
(full-body-ik :use-torso nil))
(full-body-ik :use-torso nil :debug-view nil))

(deftest test-full-body-ik-use-leg
(full-body-ik :use-leg t))
(full-body-ik :use-leg t :debug-view nil))

(deftest test-dual-arm-ik
(dual-arm-ik))
Expand Down
Loading

0 comments on commit 59b0356

Please sign in to comment.