]> git.saurik.com Git - redis.git/blob - tests/support/tmpfile.tcl
CLUSTER SETSLOT command and some refactoring of the cluster command
[redis.git] / tests / support / tmpfile.tcl
1 set ::tmpcounter 0
2 set ::tmproot "./tests/tmp"
3 file mkdir $::tmproot
4
5 # returns a dirname unique to this process to write to
6 proc tmpdir {basename} {
7 if {$::diskstore} {
8 # For diskstore we want to use the same dir again and again
9 # otherwise everything is too slow.
10 set dir [file join $::tmproot $basename.diskstore]
11 } else {
12 set dir [file join $::tmproot $basename.[pid].[incr ::tmpcounter]]
13 }
14 file mkdir $dir
15 set _ $dir
16 }
17
18 # return a filename unique to this process to write to
19 proc tmpfile {basename} {
20 file join $::tmproot $basename.[pid].[incr ::tmpcounter]
21 }