linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add a testsuite, call it on "make check"
@ 2006-11-06 23:51 Pavel Roskin
  2006-11-07  0:46 ` Josh Triplett
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Roskin @ 2006-11-06 23:51 UTC (permalink / raw)
  To: linux-sparse

From: Pavel Roskin <proski@gnu.org>

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 Makefile             |    3 +
 validation/testsuite |  118 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 2dcd514..40e916b 100644
--- a/Makefile
+++ b/Makefile
@@ -138,4 +138,7 @@ pre-process.h:
 clean:
 	rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) $(SLIB_FILE) pre-process.h
 
+check:
+	cd validation && ./testsuite
+
 % : SCCS/s.%s
diff --git a/validation/testsuite b/validation/testsuite
new file mode 100755
index 0000000..5498290
--- /dev/null
+++ b/validation/testsuite
@@ -0,0 +1,118 @@
+#! /bin/sh
+
+set -e
+
+: ${SPARSE=../sparse}
+: ${SPARSE_FLAGS=}
+
+# sparse should report a problem and it does
+BAD_EXP_BAD="
+bad-array-designated-initializer.c
+bad-assignment.c
+bad-cast.c
+bad-ternary-cond.c
+badtype2.c
+badtype3.c
+badtype4.c
+"
+
+# sparse should not report a problem and it doesn't
+OK_EXP_OK="
+bitfields.c
+field-overlap.c
+foul-bitwise.c
+init-char-array.c
+inline_compound_literals.c
+preprocessor16.c
+preprocessor17.c
+preprocessor6.c
+struct-as.c
+struct-ns1.c
+struct-ns2.c
+struct-size1.c
+test-be.c
+type1.c
+typeconvert.c
+varargs1.c
+phase3/comments
+"
+
+# sparse should report a problem but it doesn't
+# This needs to be fixed!
+BAD_EXP_OK="
+badtype1.c
+"
+
+# sparse should not report a problem but it does
+# This needs to be fixed!
+OK_EXP_BAD="
+builtin_safe1.c
+check_byte_count-ice.c
+choose_expr.c
+cond_expr.c
+context.c
+initializer-entry-defined-twice.c
+noderef.c
+preprocessor1.c
+preprocessor10.c
+preprocessor11.c
+preprocessor12.c
+preprocessor13.c
+preprocessor14.c
+preprocessor15.c
+preprocessor18.c
+preprocessor19.c
+preprocessor2.c
+preprocessor20.c
+preprocessor3.c
+preprocessor4.c
+preprocessor5.c
+preprocessor7.c
+preprocessor8.c
+preprocessor9.c
+phase2/backslash
+"
+
+unexp=0
+
+for t in $BAD_EXP_BAD; do
+	$SPARSE $SPARSE_FLAGS $t 2>test-err
+	if test -s test-err; then
+		echo "PASS: $t"
+	else
+		echo "UNEXPECTED FAIL: $t"
+		unexp=1
+	fi
+done
+
+for t in $OK_EXP_OK; do
+	$SPARSE $SPARSE_FLAGS $t 2>test-err
+	if test -s test-err; then
+		echo "UNEXPECTED FAIL: $t"
+		unexp=1
+	else
+		echo "PASS: $t"
+	fi
+done
+
+for t in $BAD_EXP_OK; do
+	$SPARSE $SPARSE_FLAGS $t 2>test-err
+	if test -s test-err; then
+		echo "UNEXPECTED PASS: $t"
+		unexp=1
+	else
+		echo "(known) FAIL: $t"
+	fi
+done
+
+for t in $OK_EXP_BAD; do
+	$SPARSE $SPARSE_FLAGS $t 2>test-err
+	if test -s test-err; then
+		echo "(known) FAIL: $t"
+	else
+		echo "UNEXPECTED PASS: $t"
+		unexp=1
+	fi
+done
+
+exit $unexp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-07 16:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-06 23:51 [PATCH] Add a testsuite, call it on "make check" Pavel Roskin
2006-11-07  0:46 ` Josh Triplett
2006-11-07 16:08   ` Pavel Roskin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).