Blame SOURCES/cscope-selftest.patch

0d2092
commit efc92106173b5130e32587f6c788f19f2477051d
0d2092
Author: Neil Horman <nhorman@tuxdriver.com>
0d2092
Date:   Fri Jul 27 15:52:49 2018 -0400
0d2092
0d2092
    Add make check test harness
0d2092
    
0d2092
    Start adding tests to self test cscope in travis ci
0d2092
    
0d2092
    Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
0d2092
0d2092
diff --git a/Makefile.am b/Makefile.am
0d2092
index ae0fc53..d79d44e 100644
0d2092
--- a/Makefile.am
0d2092
+++ b/Makefile.am
0d2092
@@ -1,6 +1,6 @@
0d2092
 ## Process this file with automake to produce Makefile.in
0d2092
 
0d2092
-SUBDIRS = doc src contrib
0d2092
+SUBDIRS = doc src contrib tests
0d2092
 
0d2092
 EXTRA_DIST = INSTALL.gnu packages
0d2092
 
0d2092
diff --git a/bootstrap.sh b/bootstrap.sh
0d2092
new file mode 100755
0d2092
index 0000000..6a363ed
0d2092
--- /dev/null
0d2092
+++ b/bootstrap.sh
0d2092
@@ -0,0 +1,7 @@
0d2092
+#!/bin/sh
0d2092
+
0d2092
+aclocal
0d2092
+autoheader
0d2092
+autoconf
0d2092
+automake --add-missing
0d2092
+
0d2092
diff --git a/configure.in b/configure.in
0d2092
index c51887d..e0a8b1f 100644
0d2092
--- a/configure.in
0d2092
+++ b/configure.in
0d2092
@@ -425,5 +425,5 @@ case "$host_os" in
0d2092
 	;;
0d2092
 esac
0d2092
 
0d2092
-AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile contrib/Makefile])
0d2092
+AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile contrib/Makefile tests/Makefile])
0d2092
 AC_OUTPUT
0d2092
diff --git a/tests/Makefile.am b/tests/Makefile.am
0d2092
new file mode 100644
0d2092
index 0000000..2278a71
0d2092
--- /dev/null
0d2092
+++ b/tests/Makefile.am
0d2092
@@ -0,0 +1,7 @@
0d2092
+check_SCRIPTS = check0.sh check1.sh check2.sh \
0d2092
+		check3.sh check4.sh check6.sh \
0d2092
+		check7.sh check8.sh check9.sh
0d2092
+
0d2092
+TESTS = check0.sh check1.sh check2.sh \
0d2092
+	check3.sh check4.sh check6.sh \
0d2092
+	check7.sh check8.sh check9.sh 
0d2092
diff --git a/tests/check0.sh b/tests/check0.sh
0d2092
new file mode 100755
0d2092
index 0000000..2487107
0d2092
--- /dev/null
0d2092
+++ b/tests/check0.sh
0d2092
@@ -0,0 +1,27 @@
0d2092
+#!/bin/sh
0d2092
+
0d2092
+EXPECT=4
0d2092
+SINDEX=0
0d2092
+STERM=main
0d2092
+STYPE="find C symbol"
0d2092
+
0d2092
+echo "Searching item $SINDEX, '$STYPE'"
0d2092
+
0d2092
+#Get to the top level directory
0d2092
+cd ..
0d2092
+
0d2092
+#Remove any previous databases from testing
0d2092
+rm -f cscope.out
0d2092
+
0d2092
+#Count the number of instances of the string 'Copyright'
0d2092
+#We expect 178 currently
0d2092
+COUNT=$(./src/cscope -R -L -$SINDEX$STERM | wc -l)
0d2092
+
0d2092
+if [ $COUNT -ne $EXPECT ]
0d2092
+then
0d2092
+	echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
0d2092
+	exit 1
0d2092
+fi
0d2092
+
0d2092
+exit 0
0d2092
+
0d2092
diff --git a/tests/check1.sh b/tests/check1.sh
0d2092
new file mode 100755
0d2092
index 0000000..a80997b
0d2092
--- /dev/null
0d2092
+++ b/tests/check1.sh
0d2092
@@ -0,0 +1,27 @@
0d2092
+#!/bin/sh
0d2092
+
0d2092
+EXPECT=3
0d2092
+SINDEX=1
0d2092
+STERM=main
0d2092
+STYPE="symbol definition"
0d2092
+
0d2092
+echo "Searching item $SINDEX, '$STYPE'"
0d2092
+
0d2092
+#Get to the top level directory
0d2092
+cd ..
0d2092
+
0d2092
+#Remove any previous databases from testing
0d2092
+rm -f cscope.out
0d2092
+
0d2092
+#Count the number of instances of the string 'Copyright'
0d2092
+#We expect 178 currently
0d2092
+COUNT=$(./src/cscope -R -L -$SINDEX$STERM | wc -l)
0d2092
+
0d2092
+if [ $COUNT -ne $EXPECT ]
0d2092
+then
0d2092
+	echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
0d2092
+	exit 1
0d2092
+fi
0d2092
+
0d2092
+exit 0
0d2092
+
0d2092
diff --git a/tests/check2.sh b/tests/check2.sh
0d2092
new file mode 100755
0d2092
index 0000000..efbf2e5
0d2092
--- /dev/null
0d2092
+++ b/tests/check2.sh
0d2092
@@ -0,0 +1,25 @@
0d2092
+#!/bin/sh
0d2092
+
0d2092
+EXPECT=96
0d2092
+SINDEX=2
0d2092
+STERM=build
0d2092
+STYPE="functions called by"
0d2092
+
0d2092
+echo "Searching item $SINDEX, '$STYPE'"
0d2092
+
0d2092
+#Get to the top level directory
0d2092
+cd ..
0d2092
+
0d2092
+#Remove any previous databases from testing
0d2092
+rm -f cscope.out
0d2092
+
0d2092
+COUNT=$(./src/cscope -R -L -$SINDEX$STERM | wc -l)
0d2092
+
0d2092
+if [ $COUNT -ne $EXPECT ]
0d2092
+then
0d2092
+	echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
0d2092
+	exit 1
0d2092
+fi
0d2092
+
0d2092
+exit 0
0d2092
+
0d2092
diff --git a/tests/check3.sh b/tests/check3.sh
0d2092
new file mode 100755
0d2092
index 0000000..5ec8fc0
0d2092
--- /dev/null
0d2092
+++ b/tests/check3.sh
0d2092
@@ -0,0 +1,26 @@
0d2092
+#!/bin/sh
0d2092
+
0d2092
+EXPECT=44
0d2092
+SINDEX=3
0d2092
+STERM=printf
0d2092
+STYPE="functions calling"
0d2092
+
0d2092
+echo "Searching item $SINDEX, '$STYPE'"
0d2092
+
0d2092
+#Get to the top level directory
0d2092
+cd ..
0d2092
+
0d2092
+#Remove any previous databases from testing
0d2092
+rm -f cscope.out
0d2092
+
0d2092
+#We expect 178 currently
0d2092
+COUNT=$(./src/cscope -R -L -$SINDEX$STERM | wc -l)
0d2092
+
0d2092
+if [ $COUNT -ne $EXPECT ]
0d2092
+then
0d2092
+	echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
0d2092
+	exit 1
0d2092
+fi
0d2092
+
0d2092
+exit 0
0d2092
+
0d2092
diff --git a/tests/check4.sh b/tests/check4.sh
0d2092
new file mode 100755
0d2092
index 0000000..5a58d59
0d2092
--- /dev/null
0d2092
+++ b/tests/check4.sh
0d2092
@@ -0,0 +1,24 @@
0d2092
+#!/bin/sh
0d2092
+EXPECT=3
0d2092
+SINDEX=4
0d2092
+STERM=oldsigquit
0d2092
+STYPE="regular text string"
0d2092
+
0d2092
+echo "Searching item $SINDEX, '$STYPE'"
0d2092
+
0d2092
+#Get to the top level directory
0d2092
+cd ..
0d2092
+
0d2092
+#Remove any previous databases from testing
0d2092
+rm -f cscope.out
0d2092
+
0d2092
+COUNT=$(./src/cscope -R -L -$SINDEX$STERM | wc -l)
0d2092
+
0d2092
+if [ $COUNT -ne $EXPECT ]
0d2092
+then
0d2092
+	echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
0d2092
+	exit 1
0d2092
+fi
0d2092
+
0d2092
+exit 0
0d2092
+
0d2092
diff --git a/tests/check6.sh b/tests/check6.sh
0d2092
new file mode 100755
0d2092
index 0000000..b13b33e
0d2092
--- /dev/null
0d2092
+++ b/tests/check6.sh
0d2092
@@ -0,0 +1,27 @@
0d2092
+#!/bin/sh
0d2092
+
0d2092
+EXPECT=1
0d2092
+SINDEX=6
0d2092
+STERM=msg.*what
0d2092
+STYPE="egrep string"
0d2092
+
0d2092
+echo "Searching item $SINDEX, '$STYPE'"
0d2092
+
0d2092
+#Get to the top level directory
0d2092
+cd ..
0d2092
+
0d2092
+#Remove any previous databases from testing
0d2092
+rm -f cscope.out
0d2092
+
0d2092
+#Count the number of instances of the string 'Copyright'
0d2092
+#We expect 178 currently
0d2092
+COUNT=$(./src/cscope -R -L -$SINDEX$STERM | wc -l)
0d2092
+
0d2092
+if [ $COUNT -ne $EXPECT ]
0d2092
+then
0d2092
+	echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
0d2092
+	exit 1
0d2092
+fi
0d2092
+
0d2092
+exit 0
0d2092
+
0d2092
diff --git a/tests/check7.sh b/tests/check7.sh
0d2092
new file mode 100755
0d2092
index 0000000..3dc0706
0d2092
--- /dev/null
0d2092
+++ b/tests/check7.sh
0d2092
@@ -0,0 +1,27 @@
0d2092
+#!/bin/sh
0d2092
+
0d2092
+EXPECT=1
0d2092
+SINDEX=7
0d2092
+STERM=main.c
0d2092
+STYPE="file named"
0d2092
+
0d2092
+echo "Searching item $SINDEX, '$STYPE'"
0d2092
+
0d2092
+#Get to the top level directory
0d2092
+cd ..
0d2092
+
0d2092
+#Remove any previous databases from testing
0d2092
+rm -f cscope.out
0d2092
+
0d2092
+#Count the number of instances of the string 'Copyright'
0d2092
+#We expect 178 currently
0d2092
+COUNT=$(./src/cscope -R -L -$SINDEX$STERM | wc -l)
0d2092
+
0d2092
+if [ $COUNT -ne $EXPECT ]
0d2092
+then
0d2092
+	echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
0d2092
+	exit 1
0d2092
+fi
0d2092
+
0d2092
+exit 0
0d2092
+
0d2092
diff --git a/tests/check8.sh b/tests/check8.sh
0d2092
new file mode 100755
0d2092
index 0000000..7bede78
0d2092
--- /dev/null
0d2092
+++ b/tests/check8.sh
0d2092
@@ -0,0 +1,27 @@
0d2092
+#!/bin/sh
0d2092
+
0d2092
+EXPECT=9
0d2092
+SINDEX=8
0d2092
+STERM=unistd.h
0d2092
+STYPE="files including this file"
0d2092
+
0d2092
+echo "Searching item $SINDEX, '$STYPE'"
0d2092
+
0d2092
+#Get to the top level directory
0d2092
+cd ..
0d2092
+
0d2092
+#Remove any previous databases from testing
0d2092
+rm -f cscope.out
0d2092
+
0d2092
+#Count the number of instances of the string 'Copyright'
0d2092
+#We expect 178 currently
0d2092
+COUNT=$(./src/cscope -R -L -$SINDEX$STERM | wc -l)
0d2092
+
0d2092
+if [ $COUNT -ne $EXPECT ]
0d2092
+then
0d2092
+	echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
0d2092
+	exit 1
0d2092
+fi
0d2092
+
0d2092
+exit 0
0d2092
+
0d2092
diff --git a/tests/check9.sh b/tests/check9.sh
0d2092
new file mode 100755
0d2092
index 0000000..87f59f3
0d2092
--- /dev/null
0d2092
+++ b/tests/check9.sh
0d2092
@@ -0,0 +1,27 @@
0d2092
+#!/bin/sh
0d2092
+
0d2092
+EXPECT=2
0d2092
+SINDEX=9
0d2092
+STERM=reftime
0d2092
+STYPE="assignments to symbol"
0d2092
+
0d2092
+echo "Searching item $SINDEX, '$STYPE'"
0d2092
+
0d2092
+#Get to the top level directory
0d2092
+cd ..
0d2092
+
0d2092
+#Remove any previous databases from testing
0d2092
+rm -f cscope.out
0d2092
+
0d2092
+#Count the number of instances of the string 'Copyright'
0d2092
+#We expect 178 currently
0d2092
+COUNT=$(./src/cscope -R -L -$SINDEX$STERM | wc -l)
0d2092
+
0d2092
+if [ $COUNT -ne $EXPECT ]
0d2092
+then
0d2092
+	echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
0d2092
+	exit 1
0d2092
+fi
0d2092
+
0d2092
+exit 0
0d2092
+