]> git.saurik.com Git - redis.git/commitdiff
pass tags to filter and match via arguments
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Wed, 2 Jun 2010 21:04:22 +0000 (23:04 +0200)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Wed, 2 Jun 2010 21:22:20 +0000 (23:22 +0200)
Makefile
tests/support/test.tcl
tests/test_helper.tcl

index b7dfb1cdb4b38ef5fd37c96fc75ad338a2404088..31a763ad864ea7408ba04ae4f5509fa4b7e5604d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -86,7 +86,7 @@ staticsymbols:
        tclsh utils/build-static-symbols.tcl > staticsymbols.h
 
 test:
        tclsh utils/build-static-symbols.tcl > staticsymbols.h
 
 test:
-       tclsh8.5 tests/test_helper.tcl
+       tclsh8.5 tests/test_helper.tcl --tags "${TAGS}"
 
 bench:
        ./redis-benchmark
 
 bench:
        ./redis-benchmark
index c13072f042003af60b41b28c4945cc0c0225e2dd..d2674da19a28f8d202298341c52bcb80daefa2b2 100644 (file)
@@ -15,7 +15,7 @@ proc test {name code okpattern} {
     if {[llength $::allowtags] > 0} {
         set matched 0
         foreach tag $::allowtags {
     if {[llength $::allowtags] > 0} {
         set matched 0
         foreach tag $::allowtags {
-            if {[lsearch $::tags $tag]} {
+            if {[lsearch $::tags $tag] >= 0} {
                 incr matched
             }
         }
                 incr matched
             }
         }
index da9071e88f84c59a5122875e00af3ac2ddf16fc7..95508cda9385c3f42b9c898f36b308403af8c1df 100644 (file)
@@ -93,6 +93,25 @@ proc main {} {
     cleanup
 }
 
     cleanup
 }
 
+# parse arguments
+for {set j 0} {$j < [llength $argv]} {incr j} {
+    set opt [lindex $argv $j]
+    set arg [lindex $argv [expr $j+1]]
+    if {$opt eq {--tags}} {
+        foreach tag $arg {
+            if {[string index $tag 0] eq "-"} {
+                lappend ::denytags [string range $tag 1 end]
+            } else {
+                lappend ::allowtags $tag
+            }
+        }
+        incr j
+    } else {
+        puts "Wrong argument: $opt"
+        exit 1
+    }
+}
+
 if {[catch { main } err]} {
     if {[string length $err] > 0} {
         # only display error when not generated by the test suite
 if {[catch { main } err]} {
     if {[string length $err] > 0} {
         # only display error when not generated by the test suite