xref: /Universal-ctags/misc/tlib (revision 61ddb9b40361e5f0f49873832d95cbea85207da3)
1#!/bin/sh
2#
3# tlib - testing libctags.a via mini-geany
4#
5# Copyright (C) 2019 Masatake YAMATO
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19#
20set -e
21
22MINI_GEANY=$1
23expected=$2
24actual=$3
25VG=$4
26
27VALGRIND=
28if test "${VG}" = 1; then
29   VALGRIND="valgrind --leak-check=full"
30fi
31
32${VALGRIND} ${MINI_GEANY} > ${actual}
33echo "${VALGRIND} ${MINI_GEANY} output:"
34cat ${actual}
35N=$(sed -n -e 's/^Number of all parsers is: \([0-9]*\)$/\1/p' ${actual})
36
37test "$N" -gt 0
38
39sed -i -e '/^Number of all parsers is: [0-9]*$/d' ${actual}
40
41echo "comparing with expected output:"
42diff -uN --strip-trailing-cr ${expected} ${actual} && rm ${actual}
43
44exit 0
45