higgs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +208 -0
- data/LICENSE +26 -0
- data/README +2 -0
- data/Rakefile +75 -0
- data/bin/higgs_backup +67 -0
- data/bin/higgs_dump_index +43 -0
- data/bin/higgs_dump_jlog +42 -0
- data/bin/higgs_verify +37 -0
- data/lib/cgi/session/higgs.rb +72 -0
- data/lib/higgs/block.rb +192 -0
- data/lib/higgs/cache.rb +117 -0
- data/lib/higgs/dbm.rb +55 -0
- data/lib/higgs/exceptions.rb +31 -0
- data/lib/higgs/flock.rb +77 -0
- data/lib/higgs/index.rb +164 -0
- data/lib/higgs/jlog.rb +159 -0
- data/lib/higgs/lock.rb +189 -0
- data/lib/higgs/storage.rb +1086 -0
- data/lib/higgs/store.rb +228 -0
- data/lib/higgs/tar.rb +390 -0
- data/lib/higgs/thread.rb +370 -0
- data/lib/higgs/tman.rb +513 -0
- data/lib/higgs/utils/bman.rb +285 -0
- data/lib/higgs/utils.rb +22 -0
- data/lib/higgs/version.rb +21 -0
- data/lib/higgs.rb +59 -0
- data/misc/cache_bench/cache_bench.rb +43 -0
- data/misc/dbm_bench/.strc +8 -0
- data/misc/dbm_bench/Rakefile +78 -0
- data/misc/dbm_bench/dbm_multi_thread.rb +199 -0
- data/misc/dbm_bench/dbm_rnd_delete.rb +43 -0
- data/misc/dbm_bench/dbm_rnd_read.rb +44 -0
- data/misc/dbm_bench/dbm_rnd_update.rb +44 -0
- data/misc/dbm_bench/dbm_seq_read.rb +45 -0
- data/misc/dbm_bench/dbm_seq_write.rb +44 -0
- data/misc/dbm_bench/st_verify.rb +28 -0
- data/misc/io_bench/cksum_bench.rb +48 -0
- data/misc/io_bench/jlog_bench.rb +71 -0
- data/misc/io_bench/write_bench.rb +128 -0
- data/misc/thread_bench/lock_bench.rb +132 -0
- data/mkrdoc.rb +8 -0
- data/rdoc.yml +13 -0
- data/sample/count.rb +60 -0
- data/sample/dbmtest.rb +38 -0
- data/test/Rakefile +45 -0
- data/test/run.rb +32 -0
- data/test/test_block.rb +163 -0
- data/test/test_cache.rb +214 -0
- data/test/test_cgi_session.rb +142 -0
- data/test/test_flock.rb +162 -0
- data/test/test_index.rb +258 -0
- data/test/test_jlog.rb +180 -0
- data/test/test_lock.rb +320 -0
- data/test/test_online_backup.rb +169 -0
- data/test/test_storage.rb +439 -0
- data/test/test_storage_conf.rb +202 -0
- data/test/test_storage_init_opts.rb +89 -0
- data/test/test_store.rb +211 -0
- data/test/test_tar.rb +432 -0
- data/test/test_thread.rb +541 -0
- data/test/test_tman.rb +875 -0
- data/test/test_tman_init_opts.rb +56 -0
- data/test/test_utils_bman.rb +234 -0
- metadata +115 -0
data/test/test_tar.rb
ADDED
@@ -0,0 +1,432 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'higgs/tar'
|
5
|
+
require 'test/unit'
|
6
|
+
|
7
|
+
module Higgs::Test
|
8
|
+
class TarBlockTest < Test::Unit::TestCase
|
9
|
+
include Higgs::Tar
|
10
|
+
|
11
|
+
# for ident(1)
|
12
|
+
CVS_ID = '$Id: test_tar.rb 559 2007-09-25 15:20:20Z toki $'
|
13
|
+
|
14
|
+
def test_padding_size
|
15
|
+
assert_equal(0, Block.padding_size(0))
|
16
|
+
|
17
|
+
assert_equal(511, Block.padding_size(1))
|
18
|
+
assert_equal(510, Block.padding_size(2))
|
19
|
+
assert_equal(509, Block.padding_size(3))
|
20
|
+
|
21
|
+
assert_equal(3, Block.padding_size(509))
|
22
|
+
assert_equal(2, Block.padding_size(510))
|
23
|
+
assert_equal(1, Block.padding_size(511))
|
24
|
+
|
25
|
+
assert_equal(0, Block.padding_size(512))
|
26
|
+
|
27
|
+
assert_equal(511, Block.padding_size(513))
|
28
|
+
assert_equal(510, Block.padding_size(514))
|
29
|
+
assert_equal(509, Block.padding_size(515))
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_blocked_size
|
33
|
+
assert_equal(0, Block.blocked_size(0))
|
34
|
+
|
35
|
+
assert_equal(512, Block.blocked_size(1))
|
36
|
+
assert_equal(512, Block.blocked_size(2))
|
37
|
+
assert_equal(512, Block.blocked_size(3))
|
38
|
+
|
39
|
+
assert_equal(512, Block.blocked_size(509))
|
40
|
+
assert_equal(512, Block.blocked_size(510))
|
41
|
+
assert_equal(512, Block.blocked_size(511))
|
42
|
+
|
43
|
+
assert_equal(512, Block.blocked_size(512))
|
44
|
+
|
45
|
+
assert_equal(1024, Block.blocked_size(513))
|
46
|
+
assert_equal(1024, Block.blocked_size(514))
|
47
|
+
assert_equal(1024, Block.blocked_size(515))
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_tar?
|
51
|
+
begin
|
52
|
+
FileUtils.mkdir_p('foo')
|
53
|
+
File.open('foo/bar', 'wb') {|w| w << "HALO\n" }
|
54
|
+
File.open('baz', 'wb') {|w| w << "Hello world.\n" }
|
55
|
+
system('tar cf foo.tar foo baz') # required unix tar command
|
56
|
+
|
57
|
+
assert((File.exist? 'foo.tar'))
|
58
|
+
assert_equal(true, (Block.tar? 'foo.tar'))
|
59
|
+
assert_equal(false, (Block.tar? 'foo'))
|
60
|
+
assert_equal(false, (Block.tar? 'foo/bar'))
|
61
|
+
assert_equal(false, (Block.tar? 'baz'))
|
62
|
+
ensure
|
63
|
+
FileUtils.rm_f %w[ foo.tar foo/bar baz ]
|
64
|
+
FileUtils.rm_rf('foo')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class TarIOReadTest < Test::Unit::TestCase
|
70
|
+
# for ident(1)
|
71
|
+
CVS_ID = '$Id: test_tar.rb 559 2007-09-25 15:20:20Z toki $'
|
72
|
+
|
73
|
+
def open_for_read(filename)
|
74
|
+
File.open(filename, 'rb')
|
75
|
+
end
|
76
|
+
|
77
|
+
def setup
|
78
|
+
File.open('foo.dat', 'wb') {|w| w << '0123456789' }
|
79
|
+
@io = open_for_read('foo.dat')
|
80
|
+
end
|
81
|
+
|
82
|
+
def teardown
|
83
|
+
@io.close
|
84
|
+
FileUtils.rm_f('foo.dat')
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_read
|
88
|
+
assert_equal(0, @io.tell)
|
89
|
+
assert_equal('0', @io.read(1))
|
90
|
+
assert_equal(1, @io.pos)
|
91
|
+
assert_equal('12', @io.read(2))
|
92
|
+
assert_equal(3, @io.tell)
|
93
|
+
assert_equal('345', @io.read(3))
|
94
|
+
assert_equal(6, @io.pos)
|
95
|
+
assert_equal('6789', @io.read(5))
|
96
|
+
assert_equal(10, @io.tell)
|
97
|
+
assert_equal(nil, @io.read(7))
|
98
|
+
assert_equal(10, @io.tell)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_seek
|
102
|
+
@io.seek(10)
|
103
|
+
assert_equal(10, @io.tell)
|
104
|
+
assert_equal(nil, @io.read(1))
|
105
|
+
@io.pos = 9
|
106
|
+
assert_equal(9, @io.pos)
|
107
|
+
assert_equal('9', @io.read(1))
|
108
|
+
@io.seek(8)
|
109
|
+
assert_equal(8, @io.tell)
|
110
|
+
assert_equal('8', @io.read(1))
|
111
|
+
@io.pos = 7
|
112
|
+
assert_equal(7, @io.pos)
|
113
|
+
assert_equal('7', @io.read(1))
|
114
|
+
@io.seek(6)
|
115
|
+
assert_equal(6, @io.tell)
|
116
|
+
assert_equal('6', @io.read(1))
|
117
|
+
@io.pos = 5
|
118
|
+
assert_equal(5, @io.pos)
|
119
|
+
assert_equal('5', @io.read(1))
|
120
|
+
@io.seek(4)
|
121
|
+
assert_equal(4, @io.tell)
|
122
|
+
assert_equal('4', @io.read(1))
|
123
|
+
@io.pos = 3
|
124
|
+
assert_equal(3, @io.pos)
|
125
|
+
assert_equal('3', @io.read(1))
|
126
|
+
@io.seek(2)
|
127
|
+
assert_equal(2, @io.tell)
|
128
|
+
assert_equal('2', @io.read(1))
|
129
|
+
@io.pos = 1
|
130
|
+
assert_equal(1, @io.pos)
|
131
|
+
assert_equal('1', @io.read(1))
|
132
|
+
@io.seek(0)
|
133
|
+
assert_equal(0, @io.tell)
|
134
|
+
assert_equal('0', @io.read(1))
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
class TarIOSysreadTest < TarIOReadTest
|
139
|
+
include Higgs::Tar
|
140
|
+
|
141
|
+
# for ident(1)
|
142
|
+
CVS_ID = '$Id: test_tar.rb 559 2007-09-25 15:20:20Z toki $'
|
143
|
+
|
144
|
+
def open_for_read(filename)
|
145
|
+
RawIO.new(File.open(filename, 'rb'))
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
class TarArchiveReaderTest < Test::Unit::TestCase
|
150
|
+
include Higgs::Tar
|
151
|
+
include Higgs::Tar::Block
|
152
|
+
|
153
|
+
# for ident(1)
|
154
|
+
CVS_ID = '$Id: test_tar.rb 559 2007-09-25 15:20:20Z toki $'
|
155
|
+
|
156
|
+
def open_for_read(filename)
|
157
|
+
File.open(filename, 'rb')
|
158
|
+
end
|
159
|
+
|
160
|
+
def setup
|
161
|
+
# tar
|
162
|
+
FileUtils.mkdir_p('foo')
|
163
|
+
File.open('foo/bar', 'wb') {|w| w << "HALO\n" }
|
164
|
+
File.open('baz', 'wb') {|w| w << "Hello world.\n" }
|
165
|
+
FileUtils.touch 'zero'
|
166
|
+
system('tar cf foo.tar foo baz zero') # required unix tar command
|
167
|
+
|
168
|
+
# target
|
169
|
+
@input = open_for_read('foo.tar')
|
170
|
+
@tar = ArchiveReader.new(@input)
|
171
|
+
end
|
172
|
+
|
173
|
+
def teardown
|
174
|
+
@input.close unless @input.closed?
|
175
|
+
#system('cp foo.tar foo_debug.tar') # debug
|
176
|
+
FileUtils.rm_f %w[ foo.tar foo/bar baz zero ]
|
177
|
+
FileUtils.rm_rf('foo')
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_fetch
|
181
|
+
head_and_body = @tar.fetch
|
182
|
+
assert('foo/' == head_and_body[:name] || 'foo' == head_and_body[:name])
|
183
|
+
assert_equal(0, head_and_body[:size])
|
184
|
+
assert_equal(File.stat('foo').mtime, head_and_body[:mtime])
|
185
|
+
assert_equal(DIRTYPE, head_and_body[:typeflag])
|
186
|
+
assert_equal(MAGIC, head_and_body[:magic])
|
187
|
+
assert_equal(nil, head_and_body[:body])
|
188
|
+
|
189
|
+
head_and_body = @tar.fetch
|
190
|
+
assert_equal('foo/bar', head_and_body[:name])
|
191
|
+
assert_equal(5, head_and_body[:size])
|
192
|
+
assert_equal(File.stat('foo/bar').mtime, head_and_body[:mtime])
|
193
|
+
assert_equal(REGTYPE, head_and_body[:typeflag])
|
194
|
+
assert_equal(MAGIC, head_and_body[:magic])
|
195
|
+
assert_equal("HALO\n", head_and_body[:body])
|
196
|
+
|
197
|
+
head_and_body = @tar.fetch
|
198
|
+
assert_equal('baz', head_and_body[:name])
|
199
|
+
assert_equal(13, head_and_body[:size])
|
200
|
+
assert_equal(File.stat('baz').mtime, head_and_body[:mtime])
|
201
|
+
assert_equal(REGTYPE, head_and_body[:typeflag])
|
202
|
+
assert_equal(MAGIC, head_and_body[:magic])
|
203
|
+
assert_equal("Hello world.\n", head_and_body[:body])
|
204
|
+
|
205
|
+
head_and_body = @tar.fetch
|
206
|
+
assert_equal('zero', head_and_body[:name])
|
207
|
+
assert_equal(0, head_and_body[:size])
|
208
|
+
assert_equal(File.stat('zero').mtime, head_and_body[:mtime])
|
209
|
+
assert_equal(REGTYPE, head_and_body[:typeflag])
|
210
|
+
assert_equal(MAGIC, head_and_body[:magic])
|
211
|
+
assert_equal('', head_and_body[:body])
|
212
|
+
|
213
|
+
head_and_body = @tar.fetch
|
214
|
+
assert_equal(nil, head_and_body)
|
215
|
+
end
|
216
|
+
|
217
|
+
def test_each
|
218
|
+
count = 0
|
219
|
+
@tar.each do |head_and_body|
|
220
|
+
case (count)
|
221
|
+
when 0
|
222
|
+
assert('foo/' == head_and_body[:name] || 'foo' == head_and_body[:name])
|
223
|
+
assert_equal(0, head_and_body[:size])
|
224
|
+
assert_equal(File.stat('foo').mtime, head_and_body[:mtime])
|
225
|
+
assert_equal(DIRTYPE, head_and_body[:typeflag])
|
226
|
+
assert_equal(MAGIC, head_and_body[:magic])
|
227
|
+
assert_equal(nil, head_and_body[:body])
|
228
|
+
when 1
|
229
|
+
assert_equal('foo/bar', head_and_body[:name])
|
230
|
+
assert_equal(5, head_and_body[:size])
|
231
|
+
assert_equal(File.stat('foo/bar').mtime, head_and_body[:mtime])
|
232
|
+
assert_equal(REGTYPE, head_and_body[:typeflag])
|
233
|
+
assert_equal(MAGIC, head_and_body[:magic])
|
234
|
+
assert_equal("HALO\n", head_and_body[:body])
|
235
|
+
when 2
|
236
|
+
assert_equal('baz', head_and_body[:name])
|
237
|
+
assert_equal(13, head_and_body[:size])
|
238
|
+
assert_equal(File.stat('baz').mtime, head_and_body[:mtime])
|
239
|
+
assert_equal(REGTYPE, head_and_body[:typeflag])
|
240
|
+
assert_equal(MAGIC, head_and_body[:magic])
|
241
|
+
assert_equal("Hello world.\n", head_and_body[:body])
|
242
|
+
when 3
|
243
|
+
assert_equal('zero', head_and_body[:name])
|
244
|
+
assert_equal(0, head_and_body[:size])
|
245
|
+
assert_equal(File.stat('zero').mtime, head_and_body[:mtime])
|
246
|
+
assert_equal(REGTYPE, head_and_body[:typeflag])
|
247
|
+
assert_equal(MAGIC, head_and_body[:magic])
|
248
|
+
assert_equal('', head_and_body[:body])
|
249
|
+
else
|
250
|
+
raise "unknown data: #{head_and_body.inspect}"
|
251
|
+
end
|
252
|
+
count += 1
|
253
|
+
end
|
254
|
+
assert_equal(4, count)
|
255
|
+
end
|
256
|
+
|
257
|
+
def test_close
|
258
|
+
@tar.close
|
259
|
+
assert(@input.closed?)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
class TarArchiveReaderSyscallTest < TarArchiveReaderTest
|
264
|
+
# for ident(1)
|
265
|
+
CVS_ID = '$Id: test_tar.rb 559 2007-09-25 15:20:20Z toki $'
|
266
|
+
|
267
|
+
def open_for_read(filename)
|
268
|
+
RawIO.new(File.open(filename, 'rb'))
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
class TarArchiveWriterTest < Test::Unit::TestCase
|
273
|
+
include Higgs::Tar
|
274
|
+
include Higgs::Tar::Block
|
275
|
+
|
276
|
+
# for ident(1)
|
277
|
+
CVS_ID = '$Id: test_tar.rb 559 2007-09-25 15:20:20Z toki $'
|
278
|
+
|
279
|
+
def open_for_write(filename)
|
280
|
+
File.open(filename, 'wb')
|
281
|
+
end
|
282
|
+
|
283
|
+
def setup
|
284
|
+
# contents of tar
|
285
|
+
FileUtils.mkdir_p('foo')
|
286
|
+
File.open('foo/bar', 'wb') {|w| w << "HALO\n" }
|
287
|
+
|
288
|
+
# target
|
289
|
+
@output = open_for_write('foo.tar')
|
290
|
+
@tar = ArchiveWriter.new(@output)
|
291
|
+
end
|
292
|
+
|
293
|
+
def teardown
|
294
|
+
@output.close unless @output.closed?
|
295
|
+
#system('cp foo.tar foo_debug.tar') # debug
|
296
|
+
FileUtils.rm_f %w(foo.tar foo/bar)
|
297
|
+
FileUtils.rm_rf('foo')
|
298
|
+
end
|
299
|
+
|
300
|
+
def test_add
|
301
|
+
@tar.add_file('foo')
|
302
|
+
@tar.add_file('foo/bar')
|
303
|
+
timestamp = Time.now
|
304
|
+
@tar.add('baz', "Hello world.\n", :mtime => timestamp)
|
305
|
+
@tar.close
|
306
|
+
assert(@output.closed?)
|
307
|
+
File.open('foo.tar') {|r|
|
308
|
+
tar = ArchiveReader.new(r)
|
309
|
+
count = 0
|
310
|
+
for head_and_body in tar
|
311
|
+
case (count)
|
312
|
+
when 0
|
313
|
+
assert_equal('foo', head_and_body[:name])
|
314
|
+
assert_equal(0, head_and_body[:size])
|
315
|
+
assert_equal(File.stat('foo').mtime, head_and_body[:mtime])
|
316
|
+
assert_equal(DIRTYPE, head_and_body[:typeflag])
|
317
|
+
assert_equal(MAGIC, head_and_body[:magic])
|
318
|
+
assert_equal(nil, head_and_body[:body])
|
319
|
+
when 1
|
320
|
+
assert_equal('foo/bar', head_and_body[:name])
|
321
|
+
assert_equal(5, head_and_body[:size])
|
322
|
+
assert_equal(File.stat('foo/bar').mtime, head_and_body[:mtime])
|
323
|
+
assert_equal(REGTYPE, head_and_body[:typeflag])
|
324
|
+
assert_equal(MAGIC, head_and_body[:magic])
|
325
|
+
assert_equal("HALO\n", head_and_body[:body])
|
326
|
+
when 2
|
327
|
+
assert_equal('baz', head_and_body[:name])
|
328
|
+
assert_equal(13, head_and_body[:size])
|
329
|
+
assert_equal(timestamp.to_i, head_and_body[:mtime].to_i)
|
330
|
+
assert_equal(REGTYPE, head_and_body[:typeflag])
|
331
|
+
assert_equal(MAGIC, head_and_body[:magic])
|
332
|
+
assert_equal(Process.euid, head_and_body[:uid])
|
333
|
+
assert_equal(Process.egid, head_and_body[:gid])
|
334
|
+
assert_equal("Hello world.\n", head_and_body[:body])
|
335
|
+
else
|
336
|
+
raise "unknown data: #{head_and_body.inspect}"
|
337
|
+
end
|
338
|
+
count += 1
|
339
|
+
end
|
340
|
+
assert_equal(3, count)
|
341
|
+
}
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
class TarArchiveWriterSyscallTest < TarArchiveWriterTest
|
346
|
+
# for ident(1)
|
347
|
+
CVS_ID = '$Id: test_tar.rb 559 2007-09-25 15:20:20Z toki $'
|
348
|
+
|
349
|
+
def open_for_write(filename)
|
350
|
+
RawIO.new(File.open(filename, 'wb'))
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
class TarArchiveHeaderTest < Test::Unit::TestCase
|
355
|
+
include Higgs::Tar
|
356
|
+
include Higgs::Tar::Block
|
357
|
+
|
358
|
+
# for ident(1)
|
359
|
+
CVS_ID = '$Id: test_tar.rb 559 2007-09-25 15:20:20Z toki $'
|
360
|
+
|
361
|
+
def setup
|
362
|
+
@output = File.open('foo.tar', 'wb')
|
363
|
+
@input = File.open('foo.tar', 'rb')
|
364
|
+
@writer = ArchiveWriter.new(@output)
|
365
|
+
@reader = ArchiveReader.new(@input)
|
366
|
+
end
|
367
|
+
|
368
|
+
def teardown
|
369
|
+
@output.close unless @output.closed?
|
370
|
+
@input.close unless @input.closed?
|
371
|
+
FileUtils.rm_f('foo.tar')
|
372
|
+
end
|
373
|
+
|
374
|
+
def test_read_header_FormatError_unexpected_EOF
|
375
|
+
assert_equal(0, @input.stat.size)
|
376
|
+
assert_raise(FormatError) { @reader.read_header }
|
377
|
+
end
|
378
|
+
|
379
|
+
def test_read_header_FormatError_too_short_header
|
380
|
+
@output.write("foo\n")
|
381
|
+
@output.flush
|
382
|
+
assert_equal(4, @input.stat.size)
|
383
|
+
assert_raise(FormatError) { @reader.read_header }
|
384
|
+
end
|
385
|
+
|
386
|
+
def test_read_header_FormatError_not_of_EOA
|
387
|
+
@output.write("\0" * BLKSIZ)
|
388
|
+
@output.flush
|
389
|
+
assert_equal(BLKSIZ, @input.stat.size)
|
390
|
+
assert_raise(FormatError) { @reader.read_header }
|
391
|
+
end
|
392
|
+
|
393
|
+
def test_read_header_typeflag_AREGTYPE
|
394
|
+
@writer.add('foo', "Hello world.\n", :typeflag => AREGTYPE)
|
395
|
+
@output.flush
|
396
|
+
assert_equal(BLKSIZ * 2, @input.stat.size)
|
397
|
+
head = @reader.read_header
|
398
|
+
assert_equal(BLKSIZ, @input.pos)
|
399
|
+
assert_equal('foo', head[:name])
|
400
|
+
assert_equal(REGTYPE, head[:typeflag], 'AREGTYPE -> REGTYPE')
|
401
|
+
end
|
402
|
+
|
403
|
+
def test_read_header_MagicError_unknown_format
|
404
|
+
@writer.add('foo', "Hello world.\n", :magic => 'unknown')
|
405
|
+
@output.flush
|
406
|
+
assert_equal(BLKSIZ * 2, @input.stat.size)
|
407
|
+
assert_raise(MagicError) { @reader.read_header }
|
408
|
+
assert_equal(BLKSIZ, @input.pos)
|
409
|
+
end
|
410
|
+
|
411
|
+
def test_read_header_CheckSumError_broken_tar
|
412
|
+
@writer.add('foo', "Hello world.\n", :chksum => 0)
|
413
|
+
@output.flush
|
414
|
+
assert_equal(BLKSIZ * 2, @input.stat.size)
|
415
|
+
assert_raise(CheckSumError) { @reader.read_header }
|
416
|
+
assert_equal(BLKSIZ, @input.pos)
|
417
|
+
end
|
418
|
+
|
419
|
+
def test_read_header_skip_body
|
420
|
+
@writer.add('foo', "Hello world.\n")
|
421
|
+
@output.flush
|
422
|
+
assert_equal(BLKSIZ * 2, @input.stat.size)
|
423
|
+
@reader.read_header(true)
|
424
|
+
assert_equal(BLKSIZ * 2, @input.pos)
|
425
|
+
end
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
# Local Variables:
|
430
|
+
# mode: Ruby
|
431
|
+
# indent-tabs-mode: nil
|
432
|
+
# End:
|