test_ids 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/application.rb +1 -1
- data/config/version.rb +1 -1
- data/lib/test_ids/git.rb +46 -40
- data/lib/test_ids.rb +68 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cc056bd639bd5288a0ed73842d5790de1beaf2d8ef53aefe004376fd2647ca2
|
4
|
+
data.tar.gz: 75ee0869b2c5d8a9e0e0ec75d9125bd8ad5286a1490af80e95ddcd986874b12e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca98189aaf0d39ba9b4f7acac86354e5f6afa2c537dc3e6f70ebcce6413e607aeca2ed722f548c761432306729163c1b893ca4a10bbf2b711b217cd2418bfc58
|
7
|
+
data.tar.gz: 86b3b1023d650d963adf0cc4998dda002bec9bd925b4ac20e414f4215a765101ca7c8e5a8dfd84024eec4808e17fb61ca425a150218357955c622dc5d22d0bfc
|
data/config/application.rb
CHANGED
@@ -83,7 +83,7 @@ class TestIdsApplication < Origen::Application
|
|
83
83
|
puts "All tests passing, proceeding with release process!"
|
84
84
|
end
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
# To enabled source-less pattern generation create a class (for example PatternDispatcher)
|
88
88
|
# to generate the pattern. This should return false if the requested pattern has been
|
89
89
|
# dispatched, otherwise Origen will proceed with looking up a pattern source as normal.
|
data/config/version.rb
CHANGED
data/lib/test_ids/git.rb
CHANGED
@@ -50,26 +50,28 @@ module TestIds
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def initialize(options)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
53
|
+
if !(TestIds.lsf_manual_init_shutdown) && Origen.running_locally?
|
54
|
+
unless File.exist?("#{options[:local]}/.git")
|
55
|
+
FileUtils.rm_rf(options[:local]) if File.exist?(options[:local])
|
56
|
+
FileUtils.mkdir_p(options[:local])
|
57
|
+
Dir.chdir options[:local] do
|
58
|
+
`git clone #{options[:remote]} .`
|
59
|
+
unless File.exist?('lock.json')
|
60
|
+
# Should really try to use the Git driver for this
|
61
|
+
exec 'touch lock.json'
|
62
|
+
exec 'git add lock.json'
|
63
|
+
exec 'git commit -m "Initial commit"'
|
64
|
+
exec 'git push'
|
65
|
+
end
|
64
66
|
end
|
65
67
|
end
|
68
|
+
@local = options[:local]
|
69
|
+
@repo = ::Git.open(options[:local])
|
70
|
+
# Get rid of any local edits coming in here, this is only called once at the start
|
71
|
+
# of the program generation run.
|
72
|
+
# No need to pull latest as that will be done when we obtain a lock.
|
73
|
+
@repo.reset_hard
|
66
74
|
end
|
67
|
-
@local = options[:local]
|
68
|
-
@repo = ::Git.open(options[:local])
|
69
|
-
# Get rid of any local edits coming in here, this is only called once at the start
|
70
|
-
# of the program generation run.
|
71
|
-
# No need to pull latest as that will be done when we obtain a lock.
|
72
|
-
@repo.reset_hard
|
73
75
|
end
|
74
76
|
|
75
77
|
# Roll the repo back to the given commit ID
|
@@ -108,11 +110,13 @@ module TestIds
|
|
108
110
|
end
|
109
111
|
|
110
112
|
def publish
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
113
|
+
if !(TestIds.lsf_manual_init_shutdown) && Origen.running_locally?
|
114
|
+
Origen.profile 'Publishing the test IDs store' do
|
115
|
+
release_lock
|
116
|
+
repo.add # Checkin everything
|
117
|
+
repo.commit('Publishing latest store')
|
118
|
+
repo.push('origin', 'master', force: true)
|
119
|
+
end
|
116
120
|
end
|
117
121
|
end
|
118
122
|
|
@@ -124,23 +128,25 @@ module TestIds
|
|
124
128
|
end
|
125
129
|
|
126
130
|
def get_lock
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
131
|
+
if !(TestIds.lsf_manual_init_shutdown) && Origen.running_locally?
|
132
|
+
return if @lock_open
|
133
|
+
Origen.profile 'Obtaining test IDs lock' do
|
134
|
+
until available_to_lock?(@repo)
|
135
|
+
puts
|
136
|
+
puts "Waiting for lock, currently locked by #{lock_user} (the lock will expire in less than #{lock_minutes_remaining} #{'minute'.pluralize(lock_minutes_remaining)} if not released before that)"
|
137
|
+
puts
|
138
|
+
sleep 5
|
139
|
+
end
|
140
|
+
data = {
|
141
|
+
'user' => User.current.name,
|
142
|
+
'expires' => (Time.now + minutes(5)).to_f
|
143
|
+
}
|
144
|
+
write('lock.json', JSON.pretty_generate(data))
|
145
|
+
repo.commit('Obtaining lock')
|
146
|
+
repo.push('origin')
|
134
147
|
end
|
135
|
-
|
136
|
-
'user' => User.current.name,
|
137
|
-
'expires' => (Time.now + minutes(5)).to_f
|
138
|
-
}
|
139
|
-
write('lock.json', JSON.pretty_generate(data))
|
140
|
-
repo.commit('Obtaining lock')
|
141
|
-
repo.push('origin')
|
148
|
+
@lock_open = true
|
142
149
|
end
|
143
|
-
@lock_open = true
|
144
150
|
end
|
145
151
|
|
146
152
|
def release_lock
|
@@ -151,11 +157,11 @@ module TestIds
|
|
151
157
|
write('lock.json', JSON.pretty_generate(data))
|
152
158
|
end
|
153
159
|
|
154
|
-
def available_to_lock?
|
160
|
+
def available_to_lock?(repo_to_use)
|
155
161
|
result = false
|
156
162
|
Origen.profile 'Checking for lock' do
|
157
|
-
|
158
|
-
|
163
|
+
repo_to_use.fetch
|
164
|
+
repo_to_use.reset_hard('origin/master')
|
159
165
|
if lock_content && lock_user && lock_user != User.current.name
|
160
166
|
result = Time.now.to_f > lock_expires
|
161
167
|
else
|
data/lib/test_ids.rb
CHANGED
@@ -239,10 +239,78 @@ module TestIds
|
|
239
239
|
@publish = val ? :save : :dont_save
|
240
240
|
end
|
241
241
|
|
242
|
+
def lsf_manual_init_shutdown
|
243
|
+
if @lsf_manual_init_shutdown
|
244
|
+
true
|
245
|
+
end
|
246
|
+
false
|
247
|
+
end
|
248
|
+
|
242
249
|
def next_in_range(range, options)
|
243
250
|
current_configuration.allocator.next_in_range(range, options)
|
244
251
|
end
|
245
252
|
|
253
|
+
def lsf_init(git_repo, lsf_publish)
|
254
|
+
@lsf_manual_init_shutdown = true
|
255
|
+
local_var_git_database_dir = "#{Origen.app.imports_directory}/test_ids/#{Pathname.new(git_repo).basename}"
|
256
|
+
FileUtils.mkdir_p(local_var_git_database_dir)
|
257
|
+
unless File.exist?("#{local_var_git_database_dir}/.git")
|
258
|
+
FileUtils.rm_rf(local_var_git_database_dir) if File.exist?(local_var_git_database_dir)
|
259
|
+
FileUtils.mkdir_p(local_var_git_database_dir)
|
260
|
+
Dir.chdir local_var_git_database_dir do
|
261
|
+
`git clone #{git_repo} .`
|
262
|
+
unless File.exist?('lock.json')
|
263
|
+
# Should really try to use the Git driver for this
|
264
|
+
exec 'touch lock.json'
|
265
|
+
exec 'git add lock.json'
|
266
|
+
exec 'git commit -m "Initial commit"'
|
267
|
+
exec 'git push'
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
@local = local_var_git_database_dir
|
272
|
+
@repo = ::Git.open(local_var_git_database_dir)
|
273
|
+
# Get rid of any local edits coming in here, this is only called once at the start
|
274
|
+
# of the program generation run.
|
275
|
+
# No need to pull latest as that will be done when we obtain a lock.
|
276
|
+
@repo.reset_hard
|
277
|
+
@git = Git.new(local: local_var_git_database_dir, remote: @repo)
|
278
|
+
if lsf_publish
|
279
|
+
return if @lock_open
|
280
|
+
Origen.profile 'Obtaining test IDs lock' do
|
281
|
+
until @git.available_to_lock?(@repo)
|
282
|
+
puts
|
283
|
+
puts "Waiting for lock, currently locked by #{@git.lock_user} (the lock will expire in less than #{@git.lock_minutes_remaining} #{'minute'.pluralize(@git.lock_minutes_remaining)} if not released before that)"
|
284
|
+
puts
|
285
|
+
sleep 5
|
286
|
+
end
|
287
|
+
data = {
|
288
|
+
'user' => User.current.name,
|
289
|
+
'expires' => (Time.now + @git.minutes(5)).to_f
|
290
|
+
}
|
291
|
+
@git.write('lock.json', JSON.pretty_generate(data))
|
292
|
+
repo.commit('Obtaining lock')
|
293
|
+
repo.push('origin')
|
294
|
+
end
|
295
|
+
@lock_open = true
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
def lsf_shutdown(lsf_publish)
|
300
|
+
if lsf_publish
|
301
|
+
Origen.profile 'Publishing the test IDs store' do
|
302
|
+
data = {
|
303
|
+
'user' => nil,
|
304
|
+
'expires' => nil
|
305
|
+
}
|
306
|
+
@git.write('lock.json', JSON.pretty_generate(data))
|
307
|
+
repo.add # Checkin everything
|
308
|
+
repo.commit('Publishing latest store')
|
309
|
+
repo.push('origin', 'master', force: true)
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
246
314
|
## When set to true, all numbers generated will be checked to see if they comply
|
247
315
|
## with the current configuration, and if not they will be re-assigned based on the
|
248
316
|
## current configuration
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_ids
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen McGinty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: origen
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: 1.8.11
|
130
130
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
131
|
+
rubygems_version: 3.2.31
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Origen plugin to assign and track test program bins and test numbers
|