[llvm-commits] [llvm] r40988 - /llvm/trunk/test/Scripts/count

Dan Gohman djg at cray.com
Fri Aug 10 08:07:05 PDT 2007


Author: djg
Date: Fri Aug 10 10:07:05 2007
New Revision: 40988

URL: http://llvm.org/viewvc/llvm-project?rev=40988&view=rev
Log:
Add a test script for counting lines. This can be used instead of the
"| grep foo | wc -l | grep 2" idiom used by many tests, so that, for
example, tests don't mistakenly accept a count of 12 when 2 is
expected. Also, the new form is more consice: "| grep foo | count 2".

Added:
    llvm/trunk/test/Scripts/count   (with props)

Added: llvm/trunk/test/Scripts/count
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Scripts/count?rev=40988&view=auto

==============================================================================
--- llvm/trunk/test/Scripts/count (added)
+++ llvm/trunk/test/Scripts/count Fri Aug 10 10:07:05 2007
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# Program: count
+#
+# Synopsis: Count the number of lines of input on stdin and test that it
+#           matches the specified number.
+#
+# Syntax:   count <number>
+
+set -e
+set -u
+input_lines=$(wc -l)
+if [ "$input_lines" -ne "$1" ]; then
+  echo "count: expected $1 lines and got ${input_lines}."
+  exit 1
+fi
+exit 0

Propchange: llvm/trunk/test/Scripts/count

------------------------------------------------------------------------------
    svn:executable = *





More information about the llvm-commits mailing list