configure.ac: Run gen-ver.sh to get the version value
[libquvi-scripts.git] / tests / find_tests.sh
blob08f1a1c6585909c6354f4aa58df7212cec7dc59d
1 #!/bin/sh
3 # libquvi-scripts
4 # Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301, USA.
21 set -e
23 C='\n' # delimiter
24 O= # output buffer
25 T= # tests
27 dump_tests()
29 O=; for t in $T; do
30 O="$O$t$C"
31 done
32 echo "$O" | sed 's/,$//'
35 find_tests()
37 dir=`dirname $0`
38 T=`find $dir -name '*.c' -type f -exec sh -c '
39 for f; do
40 sed -n <"$f" "s/^static void \(test_.*\)()/\1/p"
41 done' _ {} +`
42 return 0
45 help()
47 echo "Usage: $0 [OPTIONS]
48 -h Show this help and exit
49 -c Use comma to separate test names"
50 exit 0
53 while [ $# -gt 0 ]
55 case "$1" in
56 -h) help;;
57 -c) C=,;;
58 *) break;;
59 esac
60 shift
61 done
63 find_tests
64 dump_tests
66 # vim: set ts=2 sw=2 tw=72 expandtab: