Skip to content

Commit

Permalink
pass tags to filter and match via arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
pietern committed Jun 2, 2010
1 parent 3c5b5e1 commit 19b49c3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -88,7 +88,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
Expand Down
2 changes: 1 addition & 1 deletion tests/support/test.tcl
Expand Up @@ -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
}
}
Expand Down
19 changes: 19 additions & 0 deletions tests/test_helper.tcl
Expand Up @@ -91,6 +91,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
Expand Down

0 comments on commit 19b49c3

Please sign in to comment.