xref: /redis-3.2.3/tests/support/tmpfile.tcl (revision 5e1d2d30)
1set ::tmpcounter 0
2set ::tmproot "./tests/tmp"
3file mkdir $::tmproot
4
5# returns a dirname unique to this process to write to
6proc 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
19proc tmpfile {basename} {
20    file join $::tmproot $basename.[pid].[incr ::tmpcounter]
21}
22