higgs 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +67 -0
- data/bin/higgs_apply_jlog +1 -1
- data/bin/higgs_backup +1 -1
- data/bin/higgs_dump_index +1 -1
- data/bin/higgs_dump_jlog +1 -1
- data/bin/higgs_ping +1 -1
- data/bin/higgs_verify +1 -1
- data/lib/cgi/session/higgs.rb +3 -3
- data/lib/higgs/block.rb +3 -3
- data/lib/higgs/cache.rb +17 -13
- data/lib/higgs/dbm.rb +3 -3
- data/lib/higgs/exceptions.rb +3 -3
- data/lib/higgs/flock.rb +3 -3
- data/lib/higgs/index.rb +35 -17
- data/lib/higgs/jlog.rb +3 -3
- data/lib/higgs/lock.rb +5 -5
- data/lib/higgs/services.rb +3 -3
- data/lib/higgs/sman.rb +7 -3
- data/lib/higgs/storage.rb +14 -3
- data/lib/higgs/store.rb +3 -3
- data/lib/higgs/tar.rb +3 -3
- data/lib/higgs/thread.rb +130 -8
- data/lib/higgs/tman.rb +15 -13
- data/lib/higgs/utils/bman.rb +3 -3
- data/lib/higgs/utils.rb +3 -3
- data/lib/higgs/version.rb +4 -4
- data/lib/higgs.rb +2 -2
- data/misc/cache_bench/cache_bench.rb +2 -2
- data/misc/dbm_bench/.strc +1 -1
- data/misc/dbm_bench/Rakefile +1 -1
- data/misc/dbm_bench/dbm_multi_thread.rb +2 -2
- data/misc/dbm_bench/dbm_rnd_delete.rb +2 -2
- data/misc/dbm_bench/dbm_rnd_read.rb +2 -2
- data/misc/dbm_bench/dbm_rnd_update.rb +2 -2
- data/misc/dbm_bench/dbm_seq_read.rb +2 -2
- data/misc/dbm_bench/dbm_seq_write.rb +2 -2
- data/misc/dbm_bench/run.rb +52 -0
- data/misc/dbm_bench/st_verify.rb +2 -2
- data/misc/io_bench/cksum_bench.rb +1 -1
- data/misc/io_bench/jlog_bench.rb +2 -2
- data/misc/io_bench/write_bench.rb +1 -1
- data/misc/thread_bench/lock_bench.rb +2 -2
- data/test/Rakefile +1 -1
- data/test/run.rb +3 -3
- data/test/test_block.rb +1 -1
- data/test/test_cache.rb +9 -9
- data/test/test_cache_mvcc.rb +403 -168
- data/test/test_cgi_session.rb +3 -3
- data/test/test_dbm.rb +14 -5
- data/test/test_flock.rb +1 -1
- data/test/test_index.rb +5 -7
- data/test/test_jlog.rb +1 -1
- data/test/test_lock.rb +21 -21
- data/test/test_online_backup.rb +1 -1
- data/test/test_services.rb +1 -1
- data/test/test_storage.rb +4 -4
- data/test/test_storage_conf.rb +1 -1
- data/test/test_storage_init_opts.rb +1 -1
- data/test/test_store.rb +2 -2
- data/test/test_tar.rb +19 -19
- data/test/test_thread.rb +46 -46
- data/test/test_tman.rb +2 -2
- data/test/test_tman_init_opts.rb +1 -1
- data/test/test_tman_mvcc.rb +11 -11
- data/test/test_utils_bman.rb +4 -2
- metadata +10 -18
- data/Rakefile +0 -81
- data/mkrdoc.rb +0 -11
- data/rdoc.yml +0 -13
data/test/test_cgi_session.rb
CHANGED
@@ -9,7 +9,7 @@ require 'test/unit'
|
|
9
9
|
module Higgs::Test
|
10
10
|
module CGISessionTest
|
11
11
|
# for ident(1)
|
12
|
-
CVS_ID = '$Id: test_cgi_session.rb
|
12
|
+
CVS_ID = '$Id: test_cgi_session.rb 781 2008-07-28 15:13:27Z toki $'
|
13
13
|
|
14
14
|
def new_store(session, options={})
|
15
15
|
options.update('tmpdir' => @tmpdir, :logger => @logger)
|
@@ -119,7 +119,7 @@ module Higgs::Test
|
|
119
119
|
include CGISessionTest
|
120
120
|
|
121
121
|
# for ident(1)
|
122
|
-
CVS_ID = '$Id: test_cgi_session.rb
|
122
|
+
CVS_ID = '$Id: test_cgi_session.rb 781 2008-07-28 15:13:27Z toki $'
|
123
123
|
|
124
124
|
def store_type
|
125
125
|
CGI::Session::PStore
|
@@ -133,7 +133,7 @@ module Higgs::Test
|
|
133
133
|
include CGISessionTest
|
134
134
|
|
135
135
|
# for ident(1)
|
136
|
-
CVS_ID = '$Id: test_cgi_session.rb
|
136
|
+
CVS_ID = '$Id: test_cgi_session.rb 781 2008-07-28 15:13:27Z toki $'
|
137
137
|
|
138
138
|
def store_type
|
139
139
|
CGI::Session::HiggsStore
|
data/test/test_dbm.rb
CHANGED
@@ -10,7 +10,7 @@ module Higgs::Test
|
|
10
10
|
include Higgs
|
11
11
|
|
12
12
|
# for ident(1)
|
13
|
-
CVS_ID = '$Id: test_dbm.rb
|
13
|
+
CVS_ID = '$Id: test_dbm.rb 781 2008-07-28 15:13:27Z toki $'
|
14
14
|
|
15
15
|
def setup
|
16
16
|
@test_dir = 'dbm_test'
|
@@ -73,9 +73,18 @@ module Higgs::Test
|
|
73
73
|
@db.transaction{|tx|
|
74
74
|
tx.update('foo') {|s|
|
75
75
|
assert_equal(true, s.frozen?)
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
case (RUBY_VERSION)
|
77
|
+
when /^1\.8\./
|
78
|
+
assert_raise(TypeError, 'ruby-1.8') {
|
79
|
+
s << 'foo' << ',' << 'bar' << ',' << 'baz'
|
80
|
+
}
|
81
|
+
when /^1\.9\./
|
82
|
+
assert_raise(RuntimeError, 'ruby-1.9') {
|
83
|
+
s << 'foo' << ',' << 'bar' << ',' << 'baz'
|
84
|
+
}
|
85
|
+
else
|
86
|
+
flunk("unknown RUBY_VERSION: #{RUBY_VERSION}")
|
87
|
+
end
|
79
88
|
}
|
80
89
|
|
81
90
|
assert_equal('', tx['foo'], 'not updated')
|
@@ -128,7 +137,7 @@ module Higgs::Test
|
|
128
137
|
include Higgs
|
129
138
|
|
130
139
|
# for ident(1)
|
131
|
-
CVS_ID = '$Id: test_dbm.rb
|
140
|
+
CVS_ID = '$Id: test_dbm.rb 781 2008-07-28 15:13:27Z toki $'
|
132
141
|
|
133
142
|
def setup
|
134
143
|
@test_dir = 'dbm_test'
|
data/test/test_flock.rb
CHANGED
data/test/test_index.rb
CHANGED
@@ -10,7 +10,7 @@ module Higgs::Test
|
|
10
10
|
include Higgs
|
11
11
|
|
12
12
|
# for ident(1)
|
13
|
-
CVS_ID = '$Id: test_index.rb
|
13
|
+
CVS_ID = '$Id: test_index.rb 781 2008-07-28 15:13:27Z toki $'
|
14
14
|
|
15
15
|
def setup
|
16
16
|
@idx = Index.new
|
@@ -45,7 +45,7 @@ module Higgs::Test
|
|
45
45
|
include Higgs
|
46
46
|
|
47
47
|
# for ident(1)
|
48
|
-
CVS_ID = '$Id: test_index.rb
|
48
|
+
CVS_ID = '$Id: test_index.rb 781 2008-07-28 15:13:27Z toki $'
|
49
49
|
|
50
50
|
def setup
|
51
51
|
@idx = Index.new
|
@@ -91,7 +91,7 @@ module Higgs::Test
|
|
91
91
|
include Higgs
|
92
92
|
|
93
93
|
# for ident(1)
|
94
|
-
CVS_ID = '$Id: test_index.rb
|
94
|
+
CVS_ID = '$Id: test_index.rb 781 2008-07-28 15:13:27Z toki $'
|
95
95
|
|
96
96
|
def setup
|
97
97
|
@idx = Index.new
|
@@ -164,7 +164,7 @@ module Higgs::Test
|
|
164
164
|
include Higgs
|
165
165
|
|
166
166
|
# for ident(1)
|
167
|
-
CVS_ID = '$Id: test_index.rb
|
167
|
+
CVS_ID = '$Id: test_index.rb 781 2008-07-28 15:13:27Z toki $'
|
168
168
|
|
169
169
|
def setup
|
170
170
|
@idx = Index.new
|
@@ -184,10 +184,8 @@ module Higgs::Test
|
|
184
184
|
def test_identity_dup
|
185
185
|
@idx[:foo] = 0
|
186
186
|
@idx['foo'] = 1
|
187
|
-
@idx[ %w[ f o o ] ] = 2
|
188
187
|
assert_equal('foo', @idx.identity(:foo))
|
189
188
|
assert_equal('foo.a', @idx.identity('foo'))
|
190
|
-
assert_equal('foo.b', @idx.identity(%w[ f o o ]))
|
191
189
|
end
|
192
190
|
|
193
191
|
def test_delete
|
@@ -205,7 +203,7 @@ module Higgs::Test
|
|
205
203
|
include Higgs
|
206
204
|
|
207
205
|
# for ident(1)
|
208
|
-
CVS_ID = '$Id: test_index.rb
|
206
|
+
CVS_ID = '$Id: test_index.rb 781 2008-07-28 15:13:27Z toki $'
|
209
207
|
|
210
208
|
def setup
|
211
209
|
@path = 'test.idx'
|
data/test/test_jlog.rb
CHANGED
data/test/test_lock.rb
CHANGED
@@ -11,7 +11,7 @@ module Higgs::Test
|
|
11
11
|
include Higgs
|
12
12
|
|
13
13
|
# for ident(1)
|
14
|
-
CVS_ID = '$Id: test_lock.rb
|
14
|
+
CVS_ID = '$Id: test_lock.rb 781 2008-07-28 15:13:27Z toki $'
|
15
15
|
|
16
16
|
WORK_COUNT = 1000
|
17
17
|
THREAD_COUNT = 10
|
@@ -40,11 +40,11 @@ module Higgs::Test
|
|
40
40
|
|
41
41
|
def test_read_transaction_multithread
|
42
42
|
v = "foo"
|
43
|
-
|
43
|
+
th_list = []
|
44
44
|
barrier = Barrier.new(THREAD_COUNT + 1)
|
45
45
|
|
46
46
|
THREAD_COUNT.times{|i|
|
47
|
-
|
47
|
+
th_list << Thread.new{
|
48
48
|
@lock_manager.transaction(true) {|lock_handler|
|
49
49
|
lock_handler.lock(:foo, :data, 0)
|
50
50
|
barrier.wait
|
@@ -56,7 +56,7 @@ module Higgs::Test
|
|
56
56
|
}
|
57
57
|
|
58
58
|
barrier.wait
|
59
|
-
for t in
|
59
|
+
for t in th_list
|
60
60
|
t.join
|
61
61
|
end
|
62
62
|
end
|
@@ -66,11 +66,11 @@ module Higgs::Test
|
|
66
66
|
mvcc_last_cnum = 0
|
67
67
|
mvcc_old_values = {}
|
68
68
|
mvcc_lock = Mutex.new
|
69
|
-
|
69
|
+
th_list = []
|
70
70
|
barrier = Barrier.new(THREAD_COUNT + 1)
|
71
71
|
|
72
72
|
THREAD_COUNT.times do
|
73
|
-
|
73
|
+
th_list << Thread.new{
|
74
74
|
barrier.wait
|
75
75
|
WORK_COUNT.times do
|
76
76
|
begin
|
@@ -96,7 +96,7 @@ module Higgs::Test
|
|
96
96
|
end
|
97
97
|
|
98
98
|
barrier.wait
|
99
|
-
for t in
|
99
|
+
for t in th_list
|
100
100
|
t.join
|
101
101
|
end
|
102
102
|
assert_equal(THREAD_COUNT * WORK_COUNT, count)
|
@@ -107,11 +107,11 @@ module Higgs::Test
|
|
107
107
|
mvcc_last_cnum = 0
|
108
108
|
mvcc_old_values = {}
|
109
109
|
mvcc_lock = Mutex.new
|
110
|
-
|
110
|
+
th_list = []
|
111
111
|
barrier = Barrier.new(THREAD_COUNT * 2 + 1)
|
112
112
|
|
113
113
|
THREAD_COUNT.times{|i|
|
114
|
-
|
114
|
+
th_list << Thread.new{
|
115
115
|
@lock_manager.transaction(true) {|lock_handler|
|
116
116
|
curr_cnum = mvcc_last_cnum # save at first
|
117
117
|
lock_handler.lock(:foo, :data, curr_cnum)
|
@@ -126,7 +126,7 @@ module Higgs::Test
|
|
126
126
|
}
|
127
127
|
|
128
128
|
THREAD_COUNT.times do
|
129
|
-
|
129
|
+
th_list << Thread.new{
|
130
130
|
barrier.wait
|
131
131
|
WORK_COUNT.times do
|
132
132
|
begin
|
@@ -154,7 +154,7 @@ module Higgs::Test
|
|
154
154
|
end
|
155
155
|
|
156
156
|
barrier.wait
|
157
|
-
for t in
|
157
|
+
for t in th_list
|
158
158
|
t.join
|
159
159
|
end
|
160
160
|
assert_equal(THREAD_COUNT * WORK_COUNT, count)
|
@@ -171,11 +171,11 @@ module Higgs::Test
|
|
171
171
|
|
172
172
|
def test_exclusive_multithread
|
173
173
|
count = 0
|
174
|
-
|
174
|
+
th_list = []
|
175
175
|
barrier = Barrier.new(THREAD_COUNT + 1)
|
176
176
|
|
177
177
|
THREAD_COUNT.times do
|
178
|
-
|
178
|
+
th_list << Thread.new{
|
179
179
|
barrier.wait
|
180
180
|
WORK_COUNT.times do
|
181
181
|
@lock_manager.exclusive{
|
@@ -186,7 +186,7 @@ module Higgs::Test
|
|
186
186
|
end
|
187
187
|
|
188
188
|
barrier.wait
|
189
|
-
for t in
|
189
|
+
for t in th_list
|
190
190
|
t.join
|
191
191
|
end
|
192
192
|
assert_equal(THREAD_COUNT * WORK_COUNT, count)
|
@@ -199,11 +199,11 @@ module Higgs::Test
|
|
199
199
|
mvcc_last_cnum = 0
|
200
200
|
mvcc_old_values = {}
|
201
201
|
mvcc_lock = Mutex.new
|
202
|
-
|
202
|
+
th_list = []
|
203
203
|
barrier = Barrier.new(THREAD_COUNT * 3 + 1)
|
204
204
|
|
205
205
|
THREAD_COUNT.times{|i|
|
206
|
-
|
206
|
+
th_list << Thread.new{
|
207
207
|
barrier.wait
|
208
208
|
WORK_COUNT.times do |j|
|
209
209
|
@lock_manager.transaction(true) {|lock_handler|
|
@@ -220,7 +220,7 @@ module Higgs::Test
|
|
220
220
|
}
|
221
221
|
|
222
222
|
THREAD_COUNT.times{|i|
|
223
|
-
|
223
|
+
th_list << Thread.new{
|
224
224
|
barrier.wait
|
225
225
|
WORK_COUNT.times do |j|
|
226
226
|
begin
|
@@ -249,7 +249,7 @@ module Higgs::Test
|
|
249
249
|
}
|
250
250
|
|
251
251
|
THREAD_COUNT.times{|i|
|
252
|
-
|
252
|
+
th_list << Thread.new{
|
253
253
|
barrier.wait
|
254
254
|
WORK_COUNT.times do |j|
|
255
255
|
@lock_manager.exclusive{
|
@@ -263,7 +263,7 @@ module Higgs::Test
|
|
263
263
|
}
|
264
264
|
|
265
265
|
barrier.wait
|
266
|
-
for t in
|
266
|
+
for t in th_list
|
267
267
|
t.join
|
268
268
|
end
|
269
269
|
assert_equal(THREAD_COUNT * WORK_COUNT, count)
|
@@ -306,7 +306,7 @@ module Higgs::Test
|
|
306
306
|
include LockManagerTest
|
307
307
|
|
308
308
|
# for ident(1)
|
309
|
-
CVS_ID = '$Id: test_lock.rb
|
309
|
+
CVS_ID = '$Id: test_lock.rb 781 2008-07-28 15:13:27Z toki $'
|
310
310
|
|
311
311
|
def setup
|
312
312
|
@lock_manager = GiantLockManager.new
|
@@ -324,7 +324,7 @@ module Higgs::Test
|
|
324
324
|
include LockManagerTest
|
325
325
|
|
326
326
|
# for ident(1)
|
327
|
-
CVS_ID = '$Id: test_lock.rb
|
327
|
+
CVS_ID = '$Id: test_lock.rb 781 2008-07-28 15:13:27Z toki $'
|
328
328
|
|
329
329
|
def setup
|
330
330
|
@lock_manager = OptimisticLockManager.new
|
data/test/test_online_backup.rb
CHANGED
data/test/test_services.rb
CHANGED
@@ -10,7 +10,7 @@ module Higgs::Test
|
|
10
10
|
include Higgs
|
11
11
|
|
12
12
|
# for ident(1)
|
13
|
-
CVS_ID = '$Id: test_services.rb
|
13
|
+
CVS_ID = '$Id: test_services.rb 781 2008-07-28 15:13:27Z toki $'
|
14
14
|
|
15
15
|
STORAGE_DIR = 'remote_storage'
|
16
16
|
REMOTE_SERVICES_URI = 'druby://localhost:31415'
|
data/test/test_storage.rb
CHANGED
@@ -11,7 +11,7 @@ module Higgs::Test
|
|
11
11
|
include Higgs
|
12
12
|
|
13
13
|
# for ident(1)
|
14
|
-
CVS_ID = '$Id: test_storage.rb
|
14
|
+
CVS_ID = '$Id: test_storage.rb 781 2008-07-28 15:13:27Z toki $'
|
15
15
|
|
16
16
|
def setup
|
17
17
|
srand(0) # preset for rand
|
@@ -37,7 +37,7 @@ module Higgs::Test
|
|
37
37
|
include StorageTestCase
|
38
38
|
|
39
39
|
# for ident(1)
|
40
|
-
CVS_ID = '$Id: test_storage.rb
|
40
|
+
CVS_ID = '$Id: test_storage.rb 781 2008-07-28 15:13:27Z toki $'
|
41
41
|
|
42
42
|
def new_storage
|
43
43
|
Storage.new(@name, :logger => @logger)
|
@@ -469,7 +469,7 @@ module Higgs::Test
|
|
469
469
|
include StorageTestCase
|
470
470
|
|
471
471
|
# for ident(1)
|
472
|
-
CVS_ID = '$Id: test_storage.rb
|
472
|
+
CVS_ID = '$Id: test_storage.rb 781 2008-07-28 15:13:27Z toki $'
|
473
473
|
|
474
474
|
def new_storage
|
475
475
|
Storage.new(@name,
|
@@ -791,7 +791,7 @@ module Higgs::Test
|
|
791
791
|
include Higgs
|
792
792
|
|
793
793
|
# for ident(1)
|
794
|
-
CVS_ID = '$Id: test_storage.rb
|
794
|
+
CVS_ID = '$Id: test_storage.rb 781 2008-07-28 15:13:27Z toki $'
|
795
795
|
|
796
796
|
def setup
|
797
797
|
@test_dir = 'st_test'
|
data/test/test_storage_conf.rb
CHANGED
@@ -7,7 +7,7 @@ require 'test/unit'
|
|
7
7
|
module Higgs::Test
|
8
8
|
class StorageConfTest < Test::Unit::TestCase
|
9
9
|
# for ident(1)
|
10
|
-
CVS_ID = '$Id: test_storage_conf.rb
|
10
|
+
CVS_ID = '$Id: test_storage_conf.rb 781 2008-07-28 15:13:27Z toki $'
|
11
11
|
|
12
12
|
include Higgs
|
13
13
|
|
@@ -6,7 +6,7 @@ require 'test/unit'
|
|
6
6
|
module Higgs::Test
|
7
7
|
class StorageInitOptionsTest < Test::Unit::TestCase
|
8
8
|
# for ident(1)
|
9
|
-
CVS_ID = '$Id: test_storage_init_opts.rb
|
9
|
+
CVS_ID = '$Id: test_storage_init_opts.rb 781 2008-07-28 15:13:27Z toki $'
|
10
10
|
|
11
11
|
include Higgs::Storage::InitOptions
|
12
12
|
|
data/test/test_store.rb
CHANGED
@@ -10,7 +10,7 @@ module Higgs::Test
|
|
10
10
|
include Higgs
|
11
11
|
|
12
12
|
# for ident(1)
|
13
|
-
CVS_ID = '$Id: test_store.rb
|
13
|
+
CVS_ID = '$Id: test_store.rb 781 2008-07-28 15:13:27Z toki $'
|
14
14
|
|
15
15
|
def setup
|
16
16
|
@test_dir = 'store_test'
|
@@ -215,7 +215,7 @@ module Higgs::Test
|
|
215
215
|
include Higgs
|
216
216
|
|
217
217
|
# for ident(1)
|
218
|
-
CVS_ID = '$Id: test_store.rb
|
218
|
+
CVS_ID = '$Id: test_store.rb 781 2008-07-28 15:13:27Z toki $'
|
219
219
|
|
220
220
|
def setup
|
221
221
|
@test_dir = 'store_test'
|
data/test/test_tar.rb
CHANGED
@@ -9,7 +9,7 @@ module Higgs::Test
|
|
9
9
|
include Higgs::Tar
|
10
10
|
|
11
11
|
# for ident(1)
|
12
|
-
CVS_ID = '$Id: test_tar.rb
|
12
|
+
CVS_ID = '$Id: test_tar.rb 781 2008-07-28 15:13:27Z toki $'
|
13
13
|
|
14
14
|
def test_padding_size
|
15
15
|
assert_equal(0, Block.padding_size(0))
|
@@ -68,7 +68,7 @@ module Higgs::Test
|
|
68
68
|
|
69
69
|
class TarIOReadTest < Test::Unit::TestCase
|
70
70
|
# for ident(1)
|
71
|
-
CVS_ID = '$Id: test_tar.rb
|
71
|
+
CVS_ID = '$Id: test_tar.rb 781 2008-07-28 15:13:27Z toki $'
|
72
72
|
|
73
73
|
def open_for_read(filename)
|
74
74
|
File.open(filename, 'rb')
|
@@ -139,7 +139,7 @@ module Higgs::Test
|
|
139
139
|
include Higgs::Tar
|
140
140
|
|
141
141
|
# for ident(1)
|
142
|
-
CVS_ID = '$Id: test_tar.rb
|
142
|
+
CVS_ID = '$Id: test_tar.rb 781 2008-07-28 15:13:27Z toki $'
|
143
143
|
|
144
144
|
def open_for_read(filename)
|
145
145
|
RawIO.new(File.open(filename, 'rb'))
|
@@ -151,7 +151,7 @@ module Higgs::Test
|
|
151
151
|
include Higgs::Tar::Block
|
152
152
|
|
153
153
|
# for ident(1)
|
154
|
-
CVS_ID = '$Id: test_tar.rb
|
154
|
+
CVS_ID = '$Id: test_tar.rb 781 2008-07-28 15:13:27Z toki $'
|
155
155
|
|
156
156
|
def open_for_read(filename)
|
157
157
|
File.open(filename, 'rb')
|
@@ -181,7 +181,7 @@ module Higgs::Test
|
|
181
181
|
head_and_body = @tar.fetch
|
182
182
|
assert('foo/' == head_and_body[:name] || 'foo' == head_and_body[:name])
|
183
183
|
assert_equal(0, head_and_body[:size])
|
184
|
-
assert_equal(File.stat('foo').mtime, head_and_body[:mtime])
|
184
|
+
assert_equal(Time.at(File.stat('foo').mtime.to_i), head_and_body[:mtime])
|
185
185
|
assert_equal(DIRTYPE, head_and_body[:typeflag])
|
186
186
|
assert_equal(MAGIC, head_and_body[:magic])
|
187
187
|
assert_equal(nil, head_and_body[:body])
|
@@ -189,7 +189,7 @@ module Higgs::Test
|
|
189
189
|
head_and_body = @tar.fetch
|
190
190
|
assert_equal('foo/bar', head_and_body[:name])
|
191
191
|
assert_equal(5, head_and_body[:size])
|
192
|
-
assert_equal(File.stat('foo/bar').mtime, head_and_body[:mtime])
|
192
|
+
assert_equal(Time.at(File.stat('foo/bar').mtime.to_i), head_and_body[:mtime])
|
193
193
|
assert_equal(REGTYPE, head_and_body[:typeflag])
|
194
194
|
assert_equal(MAGIC, head_and_body[:magic])
|
195
195
|
assert_equal("HALO\n", head_and_body[:body])
|
@@ -197,7 +197,7 @@ module Higgs::Test
|
|
197
197
|
head_and_body = @tar.fetch
|
198
198
|
assert_equal('baz', head_and_body[:name])
|
199
199
|
assert_equal(13, head_and_body[:size])
|
200
|
-
assert_equal(File.stat('baz').mtime, head_and_body[:mtime])
|
200
|
+
assert_equal(Time.at(File.stat('baz').mtime.to_i), head_and_body[:mtime])
|
201
201
|
assert_equal(REGTYPE, head_and_body[:typeflag])
|
202
202
|
assert_equal(MAGIC, head_and_body[:magic])
|
203
203
|
assert_equal("Hello world.\n", head_and_body[:body])
|
@@ -205,7 +205,7 @@ module Higgs::Test
|
|
205
205
|
head_and_body = @tar.fetch
|
206
206
|
assert_equal('zero', head_and_body[:name])
|
207
207
|
assert_equal(0, head_and_body[:size])
|
208
|
-
assert_equal(File.stat('zero').mtime, head_and_body[:mtime])
|
208
|
+
assert_equal(Time.at(File.stat('zero').mtime.to_i), head_and_body[:mtime])
|
209
209
|
assert_equal(REGTYPE, head_and_body[:typeflag])
|
210
210
|
assert_equal(MAGIC, head_and_body[:magic])
|
211
211
|
assert_equal('', head_and_body[:body])
|
@@ -221,28 +221,28 @@ module Higgs::Test
|
|
221
221
|
when 0
|
222
222
|
assert('foo/' == head_and_body[:name] || 'foo' == head_and_body[:name])
|
223
223
|
assert_equal(0, head_and_body[:size])
|
224
|
-
assert_equal(File.stat('foo').mtime, head_and_body[:mtime])
|
224
|
+
assert_equal(Time.at(File.stat('foo').mtime.to_i), head_and_body[:mtime])
|
225
225
|
assert_equal(DIRTYPE, head_and_body[:typeflag])
|
226
226
|
assert_equal(MAGIC, head_and_body[:magic])
|
227
227
|
assert_equal(nil, head_and_body[:body])
|
228
228
|
when 1
|
229
229
|
assert_equal('foo/bar', head_and_body[:name])
|
230
230
|
assert_equal(5, head_and_body[:size])
|
231
|
-
assert_equal(File.stat('foo/bar').mtime, head_and_body[:mtime])
|
231
|
+
assert_equal(Time.at(File.stat('foo/bar').mtime.to_i), head_and_body[:mtime])
|
232
232
|
assert_equal(REGTYPE, head_and_body[:typeflag])
|
233
233
|
assert_equal(MAGIC, head_and_body[:magic])
|
234
234
|
assert_equal("HALO\n", head_and_body[:body])
|
235
235
|
when 2
|
236
236
|
assert_equal('baz', head_and_body[:name])
|
237
237
|
assert_equal(13, head_and_body[:size])
|
238
|
-
assert_equal(File.stat('baz').mtime, head_and_body[:mtime])
|
238
|
+
assert_equal(Time.at(File.stat('baz').mtime.to_i), head_and_body[:mtime])
|
239
239
|
assert_equal(REGTYPE, head_and_body[:typeflag])
|
240
240
|
assert_equal(MAGIC, head_and_body[:magic])
|
241
241
|
assert_equal("Hello world.\n", head_and_body[:body])
|
242
242
|
when 3
|
243
243
|
assert_equal('zero', head_and_body[:name])
|
244
244
|
assert_equal(0, head_and_body[:size])
|
245
|
-
assert_equal(File.stat('zero').mtime, head_and_body[:mtime])
|
245
|
+
assert_equal(Time.at(File.stat('zero').mtime.to_i), head_and_body[:mtime])
|
246
246
|
assert_equal(REGTYPE, head_and_body[:typeflag])
|
247
247
|
assert_equal(MAGIC, head_and_body[:magic])
|
248
248
|
assert_equal('', head_and_body[:body])
|
@@ -262,7 +262,7 @@ module Higgs::Test
|
|
262
262
|
|
263
263
|
class TarArchiveReaderSyscallTest < TarArchiveReaderTest
|
264
264
|
# for ident(1)
|
265
|
-
CVS_ID = '$Id: test_tar.rb
|
265
|
+
CVS_ID = '$Id: test_tar.rb 781 2008-07-28 15:13:27Z toki $'
|
266
266
|
|
267
267
|
def open_for_read(filename)
|
268
268
|
RawIO.new(File.open(filename, 'rb'))
|
@@ -274,7 +274,7 @@ module Higgs::Test
|
|
274
274
|
include Higgs::Tar::Block
|
275
275
|
|
276
276
|
# for ident(1)
|
277
|
-
CVS_ID = '$Id: test_tar.rb
|
277
|
+
CVS_ID = '$Id: test_tar.rb 781 2008-07-28 15:13:27Z toki $'
|
278
278
|
|
279
279
|
def open_for_write(filename)
|
280
280
|
File.open(filename, 'wb')
|
@@ -312,21 +312,21 @@ module Higgs::Test
|
|
312
312
|
when 0
|
313
313
|
assert_equal('foo', head_and_body[:name])
|
314
314
|
assert_equal(0, head_and_body[:size])
|
315
|
-
assert_equal(File.stat('foo').mtime, head_and_body[:mtime])
|
315
|
+
assert_equal(Time.at(File.stat('foo').mtime.to_i), head_and_body[:mtime])
|
316
316
|
assert_equal(DIRTYPE, head_and_body[:typeflag])
|
317
317
|
assert_equal(MAGIC, head_and_body[:magic])
|
318
318
|
assert_equal(nil, head_and_body[:body])
|
319
319
|
when 1
|
320
320
|
assert_equal('foo/bar', head_and_body[:name])
|
321
321
|
assert_equal(5, head_and_body[:size])
|
322
|
-
assert_equal(File.stat('foo/bar').mtime, head_and_body[:mtime])
|
322
|
+
assert_equal(Time.at(File.stat('foo/bar').mtime.to_i), head_and_body[:mtime])
|
323
323
|
assert_equal(REGTYPE, head_and_body[:typeflag])
|
324
324
|
assert_equal(MAGIC, head_and_body[:magic])
|
325
325
|
assert_equal("HALO\n", head_and_body[:body])
|
326
326
|
when 2
|
327
327
|
assert_equal('baz', head_and_body[:name])
|
328
328
|
assert_equal(13, head_and_body[:size])
|
329
|
-
assert_equal(timestamp.to_i,
|
329
|
+
assert_equal(Time.at(timestamp.to_i), head_and_body[:mtime])
|
330
330
|
assert_equal(REGTYPE, head_and_body[:typeflag])
|
331
331
|
assert_equal(MAGIC, head_and_body[:magic])
|
332
332
|
assert_equal(Process.euid, head_and_body[:uid])
|
@@ -344,7 +344,7 @@ module Higgs::Test
|
|
344
344
|
|
345
345
|
class TarArchiveWriterSyscallTest < TarArchiveWriterTest
|
346
346
|
# for ident(1)
|
347
|
-
CVS_ID = '$Id: test_tar.rb
|
347
|
+
CVS_ID = '$Id: test_tar.rb 781 2008-07-28 15:13:27Z toki $'
|
348
348
|
|
349
349
|
def open_for_write(filename)
|
350
350
|
RawIO.new(File.open(filename, 'wb'))
|
@@ -356,7 +356,7 @@ module Higgs::Test
|
|
356
356
|
include Higgs::Tar::Block
|
357
357
|
|
358
358
|
# for ident(1)
|
359
|
-
CVS_ID = '$Id: test_tar.rb
|
359
|
+
CVS_ID = '$Id: test_tar.rb 781 2008-07-28 15:13:27Z toki $'
|
360
360
|
|
361
361
|
def setup
|
362
362
|
@output = File.open('foo.tar', 'wb')
|