tests: vsock: Use VMADDR_CID_LOCAL for loopback testing.
[nbdkit/ericb.git] / tests / test.tcl
blob57e8d15fef397ff9f71a12826c8633dc0a0b3c55
1 # XXX This actually creates a Unicode (UCS-2) array. It's also rather
2 # slow to run. It's possible we should be using a list instead.
3 set disk [string repeat "\u0000" [expr 1024*1024]]
5 proc plugin_open {readonly} {
6 return 1
9 proc get_size {h} {
10 global disk
12 return [string length $disk]
15 proc pread {h count offset} {
16 global disk
18 set last [expr $offset+$count-1]
19 return [string range $disk $offset $last]
22 proc pwrite {h buf offset} {
23 global disk
25 set count [string length $buf]
26 set last [expr $offset+$count-1]
27 set disk [string replace $disk $offset $last $buf]