From 73bd6c583b9a3e29dbbbf4f1ba8259cfe5e131b8 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Wed, 2 Jun 2010 23:04:22 +0200 Subject: [PATCH] pass tags to filter and match via arguments --- Makefile | 2 +- tests/support/test.tcl | 2 +- tests/test_helper.tcl | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b7dfb1cd..31a763ad 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ staticsymbols: 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 diff --git a/tests/support/test.tcl b/tests/support/test.tcl index c13072f0..d2674da1 100644 --- a/tests/support/test.tcl +++ b/tests/support/test.tcl @@ -15,7 +15,7 @@ proc test {name code okpattern} { if {[llength $::allowtags] > 0} { set matched 0 foreach tag $::allowtags { - if {[lsearch $::tags $tag]} { + if {[lsearch $::tags $tag] >= 0} { incr matched } } diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index da9071e8..95508cda 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -93,6 +93,25 @@ proc main {} { 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 -- 2.45.2