| 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca> |
| 4 | # |
| 5 | # This program is free software; you can redistribute it and/or |
| 6 | # modify it under the terms of the GNU General Public License |
| 7 | # as published by the Free Software Foundation; only version 2 |
| 8 | # of the License. |
| 9 | # |
| 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program; if not, write to the Free Software |
| 17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | # |
| 19 | |
| 20 | #### ADD TESTS HERE #### |
| 21 | |
| 22 | # A spawned session daemon is needed for those tests |
| 23 | test_with_sessiond=( lttng/runall.sh ust-nevents/run ust-nprocesses/run ) |
| 24 | |
| 25 | # No session daemon needed |
| 26 | test_no_sessiond=( test_sessions test_kernel_data_trace test_ust_data_trace ) |
| 27 | |
| 28 | #### END TESTS HERE #### |
| 29 | |
| 30 | TESTDIR=$(dirname $0) |
| 31 | |
| 32 | source $TESTDIR/utils.sh |
| 33 | |
| 34 | ## NO Session daemon ## |
| 35 | for bin in ${test_no_sessiond[@]}; |
| 36 | do |
| 37 | if [ ! -e $bin ]; then |
| 38 | echo -e "$bin not found, passing" |
| 39 | continue |
| 40 | fi |
| 41 | |
| 42 | ./$bin |
| 43 | # Test must return 0 to pass. |
| 44 | if [ $? -ne 0 ]; then |
| 45 | echo -e '\e[1;31mFAIL\e[0m' |
| 46 | echo "" |
| 47 | exit 1 |
| 48 | fi |
| 49 | done |
| 50 | |
| 51 | # With session daemon |
| 52 | start_sessiond |
| 53 | out=$? |
| 54 | if [ $out -eq 2 ]; then |
| 55 | # Kernel version is not compatible. |
| 56 | exit 0 |
| 57 | elif [ $out -ne 0 ]; then |
| 58 | echo "NOT bad $?" |
| 59 | exit 1 |
| 60 | fi |
| 61 | |
| 62 | for bin in ${test_with_sessiond[@]}; |
| 63 | do |
| 64 | if [ ! -e $bin ]; then |
| 65 | echo -e "$bin not found, passing" |
| 66 | continue |
| 67 | fi |
| 68 | |
| 69 | ./$bin |
| 70 | # Test must return 0 to pass. |
| 71 | if [ $? -ne 0 ]; then |
| 72 | echo -e '\e[1;31mFAIL\e[0m' |
| 73 | echo "" |
| 74 | stop_sessiond |
| 75 | exit 1 |
| 76 | fi |
| 77 | done |
| 78 | |
| 79 | echo "" |
| 80 | stop_sessiond |
| 81 | exit 0 |