mesa_test 0.0.24 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +5 -5
  2. data/bin/mesa_test +193 -278
  3. data/lib/mesa_test.rb +92 -19
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e2b622d9f1d9572a01e95e1241f6137657a1353f
4
- data.tar.gz: ef68a62fc75bbb5bbd4bd7be2f96482009fe24e0
2
+ SHA256:
3
+ metadata.gz: e42b738498fdc133b5bb6a6f79e669042a635df47b13bc0447c96b0f1695f369
4
+ data.tar.gz: 52fb25fcb3561cf196459422c54c339c6d7500026c487448017a7c7878726276
5
5
  SHA512:
6
- metadata.gz: 62b5a24bd389978818f8cb6272d5c62feabbe842b6318e2c756a7f9a8791a7f1053586a9bf4abe31594473b04b74c1fc02f9aa163c7ff1bd547ce181633d676c
7
- data.tar.gz: 11e6d07143ed78de2929dfe3b50e79bd1b0ea224ed3367690bcb26bbea0b56b24be43c8ed63a6490e5a227f3849814f507242dd23de8f9d069c37ff0b8bb8b0e
6
+ metadata.gz: 4d3bfa26356589fa5201c765916179164f23cfc3dd928e13a18cd2b4ba923c8d18f4cf4a73b97d86826106cd39813f258f62f929d97791f653141b3d50c20e7d
7
+ data.tar.gz: fcf9b6814d87ab717388e93f6fce7425673d4287e14cadef00242a3657c64777bb3dc869a7c527ea387a5c49838987715114c076b55e4522b693fb732c15971c
data/bin/mesa_test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # if true, submit cases to localhost:3000 and load local mesa_test library
4
4
  # rather than system version
5
- DEVELOPMENT_MODE = false
5
+ DEVELOPMENT_MODE = true
6
6
 
7
7
  if DEVELOPMENT_MODE
8
8
  require_relative '../lib/mesa_test'
@@ -11,6 +11,7 @@ else
11
11
  end
12
12
 
13
13
  require 'thor'
14
+ require 'yaml'
14
15
 
15
16
  class MesaTest < Thor
16
17
  DEVELOPMENT_URI = 'http://localhost:3000'.freeze
@@ -36,31 +37,33 @@ class MesaTest < Thor
36
37
  searched/concatenated in this order:
37
38
 
38
39
  #{MesaTestCase.modules.map { |mod| ' ' + mod.to_s }.join(', ')}
39
-
40
- With --diff option, assume the checksums are up-to-date (behave like
41
- each_test_run_and_diff), off by default.
42
-
43
- With --force option, skip confirmation of computer details, assuming values
44
- in ~/.mesa_test.yml are correct.
45
-
46
- With --module option, select which module to search through, with the default
47
- being "all" (search all modules in order). Example: --module=star.
48
-
49
- With --log option, save yml file of test results in test directory, on
50
- by default. Shut off with --no-log.
51
-
52
- With --submit option, upload results to MESATestHub. By default, this is on.
53
- To run without submission, use --no-submit.
54
40
  LONGDESC
55
- option :diff, type: :boolean, default: false
56
- option :force, type: :boolean, aliases: '-f'
57
- option :log, type: :boolean, default: true
58
- option :module, type: :string, default: :all
59
- option :submit, type: :boolean, default: true
41
+ option :force, desc: 'When submitting, assume submission data in ' +
42
+ '~/.mesa_test.yml are correct rather than checking ' +
43
+ 'with user.', type: :boolean, default: false,
44
+ aliases: '-f'
45
+ option :submit, desc: 'Submit results (if any) to MesaTestHub.',
46
+ type: :boolean, default: true
47
+ option :diff, type: :boolean, default: false, desc: 'Assume checksums are ' +
48
+ 'up to date and perform diff', aliases: '-d'
49
+ option :svn, desc: 'Use svn to gather log/version data. Safe to use when ' +
50
+ 'also using --no-submit; else may give bad version numbers.',
51
+ type: :boolean, default: true
52
+ option :set_sdk, desc: 'Override user- and test-generated data to deterine' +
53
+ ' if the SDK is used and instead use value of --using_sdk.',
54
+ type: :boolean, default: false
55
+ option :using_sdk, desc: 'Assume we are using the SDK and automatically ' +
56
+ 'determine SDK version. Ignored unless using --set-sdk).',
57
+ type: :boolean, default: true
58
+ option :module, desc: 'Which module to test and/or submit, if applicable.',
59
+ type: :string, default: 'all', aliases: '-m'
60
+ option :log, type: :boolean, default: true, desc: 'Save yml file of test ' \
61
+ 'results in test case directory.'
60
62
  def test_one(mesa_dir, test_case_name)
61
63
  s = create_and_check_submitter(force: options[:force]) if options[:submit]
62
64
  m = create_and_check_mesa(mesa_dir: mesa_dir, diff: options[:diff],
63
- mod: options[:module].downcase.to_sym)
65
+ mod: options[:module].downcase.to_sym,
66
+ use_svn: options[:svn], using_sdk: using_sdk?(s))
64
67
  t = create_and_check_test_case(mesa: m, test_case_name: test_case_name,
65
68
  mod: options[:module].downcase.to_sym)
66
69
 
@@ -80,52 +83,6 @@ class MesaTest < Thor
80
83
  puts "Done.\n"
81
84
  end
82
85
 
83
- desc 'test_all MESA_DIR', 'run, check, and submit all test cases'
84
- long_desc <<-LONGDESC
85
- Run and check all test cases residing in MESA_DIR/star/test_suite. Then
86
- report results to MesaTestHub. Specifically, runs and checks all tests
87
- detailed in MESA_DIR/star/test_suite/do1_test_source.
88
-
89
- With --diff option, assume the checksums are up-to-date (behave like
90
- each_test_run_and_diff), off by default.
91
-
92
- With --force option, skip confirmation of computer details, assuming values
93
- in ~/.mesa_test.yml are correct. Only relevant if --submit option is on
94
- (by default it is).
95
-
96
- With --module option, select which module to search through, with the default
97
- being "all" (search all modules in order). Example: --module=star.
98
-
99
- With --log option, save yml file of test results in test directory and a
100
- summary in the test suite directory. On by default. Shut off with --no-log.
101
-
102
- With --submit option, upload results to MESATestHub. By default, this is on.
103
- To run without submission, use --no-submit.
104
-
105
- With --svn option, confirm version number with svn rather than trusting
106
- self-reported version number. By default, this is on. To run without using
107
- svn, use --no-svn.
108
- LONGDESC
109
- option :diff, type: :boolean, default: false
110
- option :force, type: :boolean, aliases: '-f'
111
- option :log, type: :boolean, default: true
112
- option :module, type: :string, default: :all
113
- option :submit, type: :boolean, default: true
114
- option :svn, type: :boolean, default: true
115
- def test_all(mesa_dir)
116
- s = create_and_check_submitter(force: options[:force]) if options[:submit]
117
- m = create_and_check_mesa(mesa_dir: mesa_dir, diff: options[:diff],
118
- mod: options[:module].downcase.to_sym,
119
- use_svn: options[:svn])
120
-
121
- # run all tests
122
- m.each_test_run_and_diff(log_results: options[:log],
123
- mod: options[:module].downcase.to_sym)
124
-
125
- # submit all tests
126
- s.submit_all(m, options[:module].downcase.to_sym) if options[:submit]
127
- end
128
-
129
86
  desc 'test_revision MESA_DIR', 'test and submit all tests as a packaged version'
130
87
  long_desc <<-LONGDESC
131
88
  Run and check all test cases residing in MESA_DIR/star/test_suite. Then
@@ -133,38 +90,34 @@ class MesaTest < Thor
133
90
  detailed in MESA_DIR/star/test_suite/do1_test_source. Also submit version
134
91
  information with test instances. Submits all test instances and version data
135
92
  in a single request rather than case-by-case in `test_all`.
136
-
137
- With --diff option, assume the checksums are up-to-date (behave like
138
- each_test_run_and_diff), off by default.
139
-
140
- With --force option, skip confirmation of computer details, assuming values
141
- in ~/.mesa_test.yml are correct. Only relevant if --submit option is on
142
- (by default it is).
143
-
144
- With --module option, select which module to search through, with the default
145
- being "all" (search all modules in order). Example: --module=star.
146
-
147
- With --log option, save yml file of test results in test directory and a
148
- summary in the test suite directory. On by default. Shut off with --no-log.
149
-
150
- With --submit option, upload results to MESATestHub. By default, this is on.
151
- To run without submission, use --no-submit.
152
-
153
- With --svn option, get version info (number, author, commit message) from
154
- svn. By default, this is on. To shut off, use --no-svn. If off, no author or
155
- commit message are saved.
156
93
  LONGDESC
157
- option :diff, type: :boolean, default: false
158
- option :force, type: :boolean, aliases: '-f'
159
- option :log, type: :boolean, default: true
160
- option :module, type: :string, default: :all
161
- option :submit, type: :boolean, default: true
162
- option :svn, type: :boolean, default: true
94
+
95
+ option :force, desc: 'When submitting, assume submission data in ' +
96
+ '~/.mesa_test.yml are correct rather than checking ' +
97
+ 'with user.', type: :boolean, default: false,
98
+ aliases: '-f'
99
+ option :submit, desc: 'Submit results (if any) to MesaTestHub.',
100
+ type: :boolean, default: true
101
+ option :diff, type: :boolean, default: false, desc: 'Assume checksums are ' +
102
+ 'up to date and perform diff', aliases: '-d'
103
+ option :svn, desc: 'Use svn to gather log/version data. Safe to use when ' +
104
+ 'also using --no-submit; else may give bad version numbers.',
105
+ type: :boolean, default: true
106
+ option :set_sdk, desc: 'Override user- and test-generated data to deterine' +
107
+ ' if the SDK is used and instead use value of --using_sdk.',
108
+ type: :boolean, default: false
109
+ option :using_sdk, desc: 'Assume we are using the SDK and automatically ' +
110
+ 'determine SDK version. Ignored unless using --set-sdk).',
111
+ type: :boolean, default: true
112
+ option :module, desc: 'Which module to test and/or submit, if applicable.',
113
+ type: :string, default: 'all', aliases: '-m'
114
+ option :log, type: :boolean, default: true, desc: 'Save yml file of test ' \
115
+ 'results in test case directory.'
163
116
  def test_revision(mesa_dir)
164
117
  s = create_and_check_submitter(force: options[:force]) if options[:submit]
165
118
  m = create_and_check_mesa(mesa_dir: mesa_dir, diff: options[:diff],
166
119
  mod: options[:module].downcase.to_sym,
167
- use_svn: options[:svn])
120
+ use_svn: options[:svn], using_sdk: using_sdk?(s))
168
121
 
169
122
  # run all tests
170
123
  m.each_test_run_and_diff(log_results: options[:log],
@@ -183,19 +136,27 @@ class MesaTest < Thor
183
136
  no module is specified). Modules are searched/concatenated in this order:
184
137
 
185
138
  #{MesaTestCase.modules.map { |mod| ' ' + mod.to_s }.join(', ')}
186
-
187
- With --force option, skip confirmation of computer details, assuming values
188
- in ~/.mesa_test.yml are correct.
189
-
190
- With --module option, select which module to search through, with the default
191
- being "all". Example: --module=star.
192
139
  LONGDESC
193
- option :force, type: :boolean, aliases: '-f'
194
- option :module, type: :string, aliases: '-m', default: 'all'
140
+
141
+ option :force, desc: 'When submitting, assume submission data in ' +
142
+ '~/.mesa_test.yml are correct rather than checking ' +
143
+ 'with user.', type: :boolean, default: false,
144
+ aliases: '-f'
145
+ option :svn, desc: 'Use svn to gather log/version data. NECESSARY TO GET ' +
146
+ 'ACCURATE VERSION NUMBER.', type: :boolean, default: true
147
+ option :set_sdk, desc: 'Override user- and test-generated data to deterine' +
148
+ ' if the SDK is used and instead use value of --using_sdk.',
149
+ type: :boolean, default: false
150
+ option :using_sdk, desc: 'Assume we are using the SDK and automatically ' +
151
+ 'determine SDK version. Ignored unless using --set-sdk).',
152
+ type: :boolean, default: true
153
+ option :module, desc: 'Which module to test and/or submit, if applicable.',
154
+ type: :string, default: 'all', aliases: '-m'
195
155
  def submit_one(mesa_dir, test_case_name)
196
156
  s = create_and_check_submitter(force: options[:force])
197
157
  m = create_and_check_mesa(mesa_dir: mesa_dir,
198
- mod: options[:module].downcase.to_sym)
158
+ mod: options[:module].downcase.to_sym,
159
+ using_sdk: using_sdk?(s), use_svn: options[:svn])
199
160
  t = create_and_check_test_case(mesa: m, test_case_name: test_case_name,
200
161
  mod: options[:module].downcase.to_sym)
201
162
  # load test results
@@ -207,38 +168,6 @@ class MesaTest < Thor
207
168
  puts "Done.\n"
208
169
  end
209
170
 
210
- desc 'submit_all MESA_DIR', 'submit all [previously run] test cases'
211
- long_desc <<-LONGDESC
212
- Load results for all test cases residing in MESA_DIR/star/test_suite. Then
213
- submit results to MesaTestHub. Specifically, loads and submits all tests
214
- detailed in MESA_DIR/star/test_suite/do1_test_source.
215
-
216
- With --force option, skip confirmation of computer details, assuming values
217
- in ~/.mesa_test.yml are correct.
218
-
219
- With --module option, select which module to search through, with the default
220
- being "all" (search all modules in order). Example: --module=star.
221
-
222
- With --svn option, confirm version number with svn rather than trusting
223
- self-reported version number. By default, this is on. To run without using
224
- svn, use --no-svn.
225
- LONGDESC
226
- option :force, type: :boolean, aliases: '-f'
227
- option :module, type: :string, aliases: '-m', default: 'all'
228
- option :svn, type: :boolean, default: true
229
- def submit_all(mesa_dir)
230
- s = create_and_check_submitter(force: options[:force])
231
- m = create_and_check_mesa(mesa_dir: mesa_dir,
232
- mod: options[:module].downcase.to_sym,
233
- use_svn: options[:svn])
234
-
235
- # load all test data
236
- m.each_test_load_results(mod: options[:module].downcase.to_sym)
237
-
238
- # submit all tests
239
- s.submit_all(m, options[:module].downcase.to_sym)
240
- end
241
-
242
171
  desc 'submit_revision MESA_DIR', 'submit version with pre-run test cases'
243
172
  long_desc <<-LONGDESC
244
173
  Load results for all test cases residing in MESA_DIR/star/test_suite. Then
@@ -247,31 +176,38 @@ class MesaTest < Thor
247
176
  (number, author, and commit message). Unlike submit_all, this submits all
248
177
  test cases AND version info in a single request rather than just the cases
249
178
  in series.
250
-
251
- With --force option, skip confirmation of computer details, assuming values
252
- in ~/.mesa_test.yml are correct.
253
-
254
- With --module option, select which module to search through, with the default
255
- being "all" (search all modules in order). Example: --module=star.
256
-
257
- With --svn option, get version info (number, author, commit message) from
258
- svn. By default, this is on. To shut off, use --no-svn. If off, no author or
259
- commit message are submitted.
260
179
  LONGDESC
261
- option :force, type: :boolean, aliases: '-f'
262
- option :module, type: :string, aliases: '-m', default: 'all'
263
- option :svn, type: :boolean, default: true
180
+ option :force, desc: 'When submitting, assume submission data in ' +
181
+ '~/.mesa_test.yml are correct rather than checking ' +
182
+ 'with user.', type: :boolean, default: false,
183
+ aliases: '-f'
184
+ option :module, desc: 'Which module to test and/or submit, if applicable.',
185
+ type: :string, default: 'all', aliases: '-m'
186
+ option :svn, desc: 'Use svn to gather log/version data. NECESSARY TO GET ' +
187
+ 'ACCURATE VERSION NUMBER.', type: :boolean, default: true
188
+ option :set_sdk, desc: 'Override user- and test-generated data to deterine' +
189
+ ' if the SDK is used and instead use value of --using_sdk.',
190
+ type: :boolean, default: false
191
+ option :using_sdk, desc: 'Assume we are using the SDK and automatically ' +
192
+ 'determine SDK version. Ignored unless using --set-sdk).',
193
+ type: :boolean, default: true
264
194
  def submit_revision(mesa_dir)
265
195
  s = create_and_check_submitter(force: options[:force])
266
196
  m = create_and_check_mesa(mesa_dir: mesa_dir,
267
197
  mod: options[:module].downcase.to_sym,
268
- use_svn: options[:svn])
269
-
270
- # load all test data
271
- m.each_test_load_results(mod: options[:module].downcase.to_sym)
272
-
273
- # submit all tests
274
- s.submit_revision(m)
198
+ use_svn: options[:svn], using_sdk: using_sdk?(s))
199
+ begin
200
+ m.check_installation
201
+ rescue MesaDirError
202
+ shell.say %q{This MESA installation doesn't seem to be compiled } \
203
+ 'properly. Submitting a compilation failure to MESATestHub.', :red
204
+ else
205
+ # load all test data
206
+ m.each_test_load_results(mod: options[:module].downcase.to_sym)
207
+ ensure
208
+ # submit all tests
209
+ s.submit_revision(m)
210
+ end
275
211
  end
276
212
 
277
213
 
@@ -289,76 +225,6 @@ class MesaTest < Thor
289
225
  m.install
290
226
  end
291
227
 
292
- desc 'install_and_test_all VERSION_NUMBER MESA_DIR', 'download and install '\
293
- 'mesa release VERSION_NUMBER to directory MESA_DIR and run/submit all tests'
294
- long_desc <<-LONGDESC
295
- Calls to svn to install mesa release VERSION_NUMBER into the directory
296
- MESA_DIR. Basically just an svn checkout followed by going into the directory
297
- and running ./clean and ./install. SDK or compilers must be set up prior.
298
- Once installation is complete, run the test suite, and report results to
299
- MesaTestHub. Does not affect the user's MESA_DIR or other environment
300
- variables. This is basically a shortcut for running
301
-
302
- `mesa_test install SOME_VERSION SOME_DIR`
303
-
304
- followed by
305
-
306
- `mesa_test test_all SOME_DIR`
307
-
308
- If VERSION_NUMBER is 'non-paxton' or 'non_paxton', then the most recent
309
- commit by anyone other than Bill Paxton ('bill_paxton') is tested and the
310
- --diff flag is ignored and set to false. Note that using 'HEAD' for version
311
- number will automatically select the most recent release, regardless of the
312
- author.
313
-
314
- With --diff option, assume the checksums are up-to-date (behave like
315
- each_test_run_and_diff), off by default.
316
-
317
- Use flag --destroy to self destruct MESA_DIR after successful test
318
- submission. Essentially does rm -rf MESA_DIR after the test suite. Useful
319
- for automated testing without piling up disk space.
320
-
321
- Use flag --force to skip confirmation of computer details if they can be
322
- read from ~/.mesa_test.yml.
323
-
324
- With --log option, save yml file of test results in test directory and a
325
- summary in the test suite directory. On by default. Shut off with --no-log.
326
-
327
- With --module option, select which module to search through, with the default
328
- being "all". Example: --module=star.
329
- LONGDESC
330
- option :diff, type: :boolean, default: false
331
- option :destroy, type: :boolean
332
- option :log, type: :boolean, default: true
333
- option :force, type: :boolean, aliases: '-f'
334
- option :module, type: :string, aliases: '-m', default: 'all'
335
- def install_and_test_all(version, mesa_dir)
336
- s = create_and_check_submitter(force: options[:force])
337
- mesa_version, diff = filter_version_and_diff(version, s)
338
- if mesa_version.nil?
339
- puts 'No commits by anyone other than Bill Paxton since '\
340
- "r#{s.last_tested}. Exiting."
341
- return
342
- end
343
- m = Mesa.download(version_number: mesa_version, new_mesa_dir: mesa_dir)
344
- m.clean
345
- m.install
346
-
347
- m = create_and_check_mesa(mesa_dir: mesa_dir, diff: diff,
348
- mod: options[:module].downcase.to_sym)
349
-
350
- # run all tests. Don't be fooled, whether or not a diff happens is set
351
- # by the diff attribute of the mesa object, set above.
352
- m.each_test_run_and_diff(mod: options[:module].downcase.to_sym,
353
- log_results: options[:log])
354
-
355
- # submit all tests
356
- successfully_submitted = s.submit_all(m, options[:module].downcase.to_sym)
357
-
358
- # if requested, and if submission successful, destroy the directory
359
- m.destroy if successfully_submitted && options[:destroy]
360
- end
361
-
362
228
  desc 'install_and_test_revision VERSION_NUMBER MESA_DIR', 'download and '\
363
229
  'install mesa release VERSION_NUMBER to directory MESA_DIR, run all tests,'\
364
230
  'and submit version and test data in single request.'
@@ -383,35 +249,37 @@ class MesaTest < Thor
383
249
  --diff flag is ignored and set to false. Note that using 'HEAD' for version
384
250
  number will automatically select the most recent release, regardless of the
385
251
  author.
386
-
387
- With --diff option, assume the checksums are up-to-date (behave like
388
- each_test_run_and_diff), off by default.
389
-
390
- Use flag --destroy to self destruct MESA_DIR after successful test
391
- submission. Essentially does rm -rf MESA_DIR after the test suite. Useful
392
- for automated testing without piling up disk space.
393
-
394
- Use flag --force to skip confirmation of computer details if they can be
395
- read from ~/.mesa_test.yml.
396
-
397
- With --log option, save yml file of test results in test directory and a
398
- summary in the test suite directory. On by default. Shut off with --no-log.
399
-
400
- With --module option, select which module to search through, with the default
401
- being "all". Example: --module=star.
402
-
403
- With --svn option, get version info (number, author, commit message) from
404
- svn. By default, this is on. To shut off, use --no-svn. If off, no author or
405
- commit message are submitted.
406
252
  LONGDESC
407
- option :diff, type: :boolean, default: false
408
- option :destroy, type: :boolean
409
- option :log, type: :boolean, default: true
410
- option :force, type: :boolean, aliases: '-f'
411
- option :module, type: :string, aliases: '-m', default: 'all'
412
- option :svn, type: :boolean, default: true
253
+
254
+ option :force, desc: 'When submitting, assume submission data in ' +
255
+ '~/.mesa_test.yml are correct rather than checking ' +
256
+ 'with user.', type: :boolean, default: false,
257
+ aliases: '-f'
258
+ option :submit, desc: 'Submit results (if any) to MesaTestHub.',
259
+ type: :boolean, default: true
260
+ option :diff, type: :boolean, default: false, desc: 'Assume checksums are ' +
261
+ 'up to date and perform diff', aliases: '-d'
262
+ option :svn, desc: 'Use svn to gather log/version data. Safe to use when ' +
263
+ 'also using --no-submit; else may give bad version numbers.',
264
+ type: :boolean, default: true
265
+ option :set_sdk, desc: 'Override user- and test-generated data to deterine' +
266
+ ' if the SDK is used and instead use value of --using_sdk.',
267
+ type: :boolean, default: false
268
+ option :using_sdk, desc: 'Assume we are using the SDK and automatically ' +
269
+ 'determine SDK version. Ignored unless using --set-sdk).',
270
+ type: :boolean, default: true
271
+ option :module, desc: 'Which module to test and/or submit, if applicable.',
272
+ type: :string, default: 'all', aliases: '-m'
273
+ option :destroy, type: :boolean, desc: 'Delete mesa installation upon ' \
274
+ 'submission of complete results.', default: false
275
+ option :log, type: :boolean, default: true, desc: 'Save yml file of test ' \
276
+ 'results in test case directory.'
277
+ # option :force, type: :boolean, aliases: '-f'
278
+ # option :module, type: :string, aliases: '-m', default: 'all'
279
+ # option :svn, type: :boolean, default: true
413
280
  def install_and_test_revision(version, mesa_dir)
414
- s = create_and_check_submitter(force: options[:force])
281
+ s = nil # to make sure using_sdk? below will work properly
282
+ s = create_and_check_submitter(force: options[:force]) if options[:submit]
415
283
  mesa_version, diff = filter_version_and_diff(version, s)
416
284
  if mesa_version.nil?
417
285
  puts 'No commits by anyone other than Bill Paxton since '\
@@ -419,24 +287,33 @@ class MesaTest < Thor
419
287
  return
420
288
  end
421
289
  m = Mesa.download(version_number: mesa_version, new_mesa_dir: mesa_dir,
422
- use_svn: options[:svn])
423
- m.clean
424
- m.install
425
-
426
- m = create_and_check_mesa(mesa_dir: mesa_dir, diff: diff,
427
- mod: options[:module].downcase.to_sym,
428
- use_svn: options[:svn])
429
-
430
- # run all tests. Don't be fooled, whether or not a diff happens is set
431
- # by the diff attribute of the mesa object, set above.
432
- m.each_test_run_and_diff(mod: options[:module].downcase.to_sym,
433
- log_results: options[:log])
434
-
435
- # submit all tests
436
- successfully_submitted = s.submit_revision(m)
437
-
438
- # if requested, and if submission successful, destroy the directory
439
- m.destroy if successfully_submitted && options[:destroy]
290
+ use_svn: options[:svn], using_sdk: using_sdk?(s))
291
+ begin
292
+ m.clean
293
+ m.install
294
+ rescue MesaDirError
295
+ shell.say "\nFailed in compiling MESA r-#{m.version_number}.", :red
296
+ else
297
+ check_mesa(m)
298
+ update_mesa(mesa: m, diff: diff, mod: options[:module].downcase.to_sym)
299
+
300
+ # m = create_and_check_mesa(mesa_dir: mesa_dir, diff: diff,
301
+ # mod: options[:module].downcase.to_sym,
302
+ # use_svn: options[:svn])
303
+
304
+ # run all tests. Don't be fooled, whether or not a diff happens is set
305
+ # by the diff attribute of the mesa object, set above.
306
+ m.each_test_run_and_diff(mod: options[:module].downcase.to_sym,
307
+ log_results: options[:log])
308
+ ensure
309
+ # submit all version and test data
310
+ successfully_submitted = false
311
+ successfully_submitted = s.submit_revision(m) if options[:submit]
312
+
313
+ # if requested, installation and submission are successful, destroy the
314
+ # directory
315
+ m.destroy if successfully_submitted && options[:destroy] && m.installed?
316
+ end
440
317
  end
441
318
 
442
319
  private
@@ -464,17 +341,25 @@ class MesaTest < Thor
464
341
  s
465
342
  end
466
343
 
467
- def create_and_check_mesa(mesa_dir:, diff: true, mod: :all, use_svn: true)
468
- m = Mesa.new mesa_dir: mesa_dir, use_svn: use_svn
469
- unless m.installed?
344
+ def create_and_check_mesa(mesa_dir:, use_svn: true, diff: true, mod: :all,
345
+ using_sdk: true)
346
+ m = Mesa.new(mesa_dir: mesa_dir, use_svn: use_svn, using_sdk: using_sdk)
347
+ check_mesa(m)
348
+ update_mesa(mesa: m, diff: diff, mod: mod)
349
+ m
350
+ end
351
+
352
+ def check_mesa(mesa)
353
+ unless mesa.downloaded?
470
354
  raise MesaDirError, "Invalid MESA_DIR: #{mesa_dir}. Please download " \
471
355
  'and install a valid MESA version or provide the path to one.'
472
356
  end
473
- m.load_test_source_data(mod: mod)
357
+ end
474
358
 
359
+ def update_mesa(mesa:, diff: true, mod: :all)
360
+ mesa.load_test_source_data(mod: mod)
475
361
  # choose whether to update checksums
476
- m.update_checksums = !diff
477
- m
362
+ mesa.update_checksums = !diff
478
363
  end
479
364
 
480
365
  def create_and_check_test_case(mesa:, test_case_name:, mod: :all)
@@ -486,7 +371,7 @@ class MesaTest < Thor
486
371
  # this should care about the value in `mod`. Current behavior is only
487
372
  # appropriate if `mod` is :all.
488
373
  msg << MesaTestCase.modules.map do |this_mod|
489
- File.join(m.test_suite_dir(mod: this_mod), 'do1_test_source')
374
+ File.join(mesa.test_suite_dir(mod: this_mod), 'do1_test_source')
490
375
  end.join(' or ')
491
376
  msg << '.'
492
377
  raise TestCaseDirError, msg
@@ -499,6 +384,36 @@ class MesaTest < Thor
499
384
  [version, options[:diff]]
500
385
  end
501
386
  end
387
+
388
+ # determine whether or not we can assume the test should be / was run with
389
+ # the SDK. This results should only be relevant if a test is GOING TO BE RUN.
390
+ # If it has already been run, then the compiler and compiler version have
391
+ # already been set (or the opportunity was lost, either way this won't help.)
392
+ #
393
+ # This gets used in a lot of places where it probably isn't necessary, just
394
+ # to prevent problems later on if things change, as it does no harm when it
395
+ # doesn't help.
396
+ #
397
+ # The only parameter is a submitter, if there is one to lean on. If there
398
+ # isn't, it's no problem.
399
+ def using_sdk?(s = nil)
400
+ # did user specify so? Trust them
401
+ if options[:set_sdk]
402
+ options[:using_sdk]
403
+ # are we submitting? scrape compiler info from that
404
+ elsif s
405
+ s.compiler == 'SDK'
406
+ # we don't have a submitter... need to read config file (same thing
407
+ # submitter is doing)
408
+ elsif File.exist?(File.join(ENV['HOME'], '.mesa_test.yml'))
409
+ data = YAML.load(File.read(File.join(ENV['HOME'], '.mesa_test.yml')))
410
+ data['compiler'] == 'SDK'
411
+ # nothing works. Don't tell mesa that we are using SDK (we could still be
412
+ # using it, but it's up to a future submitter to tell the web site so.)
413
+ else
414
+ false
415
+ end
416
+ end
502
417
  end
503
418
 
504
419
  # actually start the CLI
data/lib/mesa_test.rb CHANGED
@@ -231,6 +231,8 @@ e-mail and password will be stored in plain text.'
231
231
  end
232
232
 
233
233
  # create and return hash of parameters for a TestInstance submission
234
+ # Note: prefer test case's self-reported compiler and compiler version over
235
+ # user reported
234
236
  def submit_params(test_case)
235
237
  res = {
236
238
  test_case: test_case.test_name,
@@ -241,8 +243,8 @@ e-mail and password will be stored in plain text.'
241
243
  runtime_seconds: test_case.runtime_seconds,
242
244
  mesa_version: test_case.mesa_version,
243
245
  passed: test_case.passed? ? 1 : 0,
244
- compiler: compiler,
245
- compiler_version: compiler_version,
246
+ compiler: test_case.compiler || compiler,
247
+ compiler_version: test_case.compiler_version || compiler_version,
246
248
  platform_version: platform_version,
247
249
  omp_num_threads: test_case.test_omp_num_threads,
248
250
  success_type: test_case.success_type,
@@ -268,7 +270,7 @@ e-mail and password will be stored in plain text.'
268
270
  # user gives data about the user and computer submitting information
269
271
  # instances is array of hashes that identify test instances (more below)
270
272
  res = {
271
- version: {number: mesa.version_number},
273
+ version: {number: mesa.version_number, compiled: mesa.installed?},
272
274
  user: {email: email, password: password, computer: computer_name},
273
275
  instances: []
274
276
  }
@@ -277,6 +279,11 @@ e-mail and password will be stored in plain text.'
277
279
  res[:version][:log] = mesa.svn_log
278
280
  end
279
281
 
282
+ # bail out if installation failed (and we care)
283
+ return [res, []] unless res[:version][:compiled]
284
+
285
+ # Successfully compiled, now gather test instance data.
286
+
280
287
  # hold on to test case names that fail in synthesizing params
281
288
  has_errors = []
282
289
 
@@ -380,7 +387,7 @@ e-mail and password will be stored in plain text.'
380
387
  unsubmitted_cases << test_name
381
388
  end
382
389
  end
383
- puts "\n Submission results for #{mod} module:"
390
+ puts "\nSubmission results for #{mod} module:"
384
391
  puts '#####################################'
385
392
  if !submitted_cases.empty?
386
393
  shell.say 'Submitted the following cases:', :green
@@ -418,7 +425,7 @@ e-mail and password will be stored in plain text.'
418
425
  initheader = { 'Content-Type' => 'application/json' }
419
426
  )
420
427
  request_data, error_cases = revision_submit_params(mesa)
421
- if request_data[:instances].empty?
428
+ if request_data[:instances].empty? && mesa.installed?
422
429
  shell.say "No completed test data found in #{mesa.mesa_dir}. Aborting.",
423
430
  :red
424
431
  return false
@@ -439,8 +446,13 @@ e-mail and password will be stored in plain text.'
439
446
  shell.say "\nFailed to gather data for the following cases:", :red
440
447
  error_cases.each { |tc| shell.say " #{tc.test_name}", :red }
441
448
  false
449
+ else
450
+ shell.say "\nSuccessfully submitted revision #{mesa.version_number}.", :green
451
+ @last_tested = mesa.version_number
452
+ shell.say "\n\nUpdating last tested revision to #{last_tested}."
453
+ save_computer_data
454
+ true
442
455
  end
443
- true
444
456
  end
445
457
  end
446
458
 
@@ -448,7 +460,7 @@ class Mesa
448
460
  SVN_URI = 'svn://svn.code.sf.net/p/mesa/code/trunk'.freeze
449
461
 
450
462
  attr_reader :mesa_dir, :test_data, :test_names, :test_cases, :shell,
451
- :svn_version, :svn_author, :svn_log
463
+ :svn_version, :svn_author, :svn_log, :using_sdk
452
464
  attr_accessor :update_checksums
453
465
 
454
466
  def self.download(version_number: nil, new_mesa_dir: nil, use_svn: true)
@@ -458,8 +470,9 @@ class Mesa
458
470
  "svn://svn.code.sf.net/p/mesa/code/trunk #{new_mesa_dir}"
459
471
  )
460
472
  unless success
461
- raise MesaDirError, 'Encountered a problem in download mesa ' \
462
- "revision #{version_number}."
473
+ raise MesaDirError, 'Encountered a problem in downloading mesa ' \
474
+ "revision #{version_number}. Perhaps svn isn't " \
475
+ 'working properly?'
463
476
  end
464
477
  Mesa.new(mesa_dir: new_mesa_dir, use_svn: use_svn)
465
478
  end
@@ -510,11 +523,12 @@ class Mesa
510
523
  nil
511
524
  end
512
525
 
513
- def initialize(mesa_dir: ENV['MESA_DIR'], use_svn: true)
526
+ def initialize(mesa_dir: ENV['MESA_DIR'], use_svn: true, using_sdk: false)
514
527
  # absolute_path ensures that it doesn't matter where commands are executed
515
528
  # from
516
529
  @mesa_dir = File.absolute_path(mesa_dir)
517
530
  @use_svn = use_svn
531
+ @using_sdk = using_sdk
518
532
  @update_checksums = false
519
533
 
520
534
  # these get populated by calling #load_test_data
@@ -544,7 +558,7 @@ class Mesa
544
558
  end
545
559
 
546
560
  def log_entry
547
- `svn log #{SVN_URI} -r #{version_number}`
561
+ `svn log #{mesa_dir} -r #{version_number}`
548
562
  end
549
563
 
550
564
  def load_svn_data
@@ -559,7 +573,9 @@ class Mesa
559
573
 
560
574
  # get version number from svn (preferred method)
561
575
  def svn_version_number
562
- return `svnversion #{mesa_dir}`.strip.to_i
576
+ # match output of svn info to a line with the revision, capturing the
577
+ # number, and defaulting to 0 if none is found.
578
+ return (/Revision\:\s+(\d+)/.match(`svn info #{mesa_dir}`)[1] || 0).to_i
563
579
  rescue Errno::ENOENT
564
580
  return 0
565
581
  end
@@ -594,9 +610,19 @@ class Mesa
594
610
  bash_execute('./install')
595
611
  end
596
612
  end
613
+ # this should never happen if visit_and_check works properly.
614
+ check_installation
597
615
  self
598
616
  end
599
617
 
618
+ # throw an error unless it seems like it's properly compiled
619
+ def check_installation
620
+ unless installed?
621
+ raise MesaDirError, 'Installation check failed (no .mod files found ' \
622
+ 'in the last compiled module).'
623
+ end
624
+ end
625
+
600
626
  def destroy
601
627
  FileUtils.rm_rf mesa_dir
602
628
  end
@@ -694,6 +720,7 @@ class Mesa
694
720
  end
695
721
 
696
722
  def each_test_run_and_diff(mod: :all, log_results: false)
723
+ check_installation
697
724
  each_test_clean(mod: mod)
698
725
 
699
726
  if mod == :all
@@ -721,10 +748,29 @@ class Mesa
721
748
  end
722
749
  end
723
750
 
724
- def installed?
751
+ def downloaded?
725
752
  check_mesa_dir
726
753
  end
727
754
 
755
+ def installed?
756
+ # look for output files in the last-installed module
757
+ # this isn't perfect, but it's a pretty good indicator of completing
758
+ # installation
759
+ install_file = File.join(mesa_dir, 'install')
760
+ # match last line of things like "do_one SOME_MODULE" or "do_one_parallel
761
+ # SOME_MODULE", after which the "SOME_MODULE" will be stored in $1
762
+ # that is the last module to be compiled by ./install.
763
+ IO.readlines(install_file).select do |line|
764
+ line =~ /^\s*do_one\w*\s+\w+/
765
+ end.last =~ /^\s*do_one\w*\s+(\w+)/
766
+ # module is "installed" if there is a nonzero number of files in the
767
+ # module's make directory of the form SOMETHING.mod
768
+ !Dir.entries(File.join(mesa_dir, $1, 'make')).select do |file|
769
+ File.extname(file) == '.mod'
770
+ end.empty?
771
+ end
772
+
773
+
728
774
  private
729
775
 
730
776
  # verify that mesa_dir is valid by checking for version number and test_suite
@@ -847,7 +893,8 @@ class MesaTestCase
847
893
  attr_reader :test_name, :mesa_dir, :mesa, :success_string, :final_model,
848
894
  :failure_msg, :success_msg, :photo, :runtime_seconds,
849
895
  :test_omp_num_threads, :mesa_version, :shell, :mod, :retries,
850
- :backups, :steps, :runtime_minutes, :summary_text
896
+ :backups, :steps, :runtime_minutes, :summary_text, :compiler,
897
+ :compiler_version
851
898
  attr_accessor :data_names, :data_types, :failure_type, :success_type,
852
899
  :outcome
853
900
 
@@ -874,13 +921,19 @@ class MesaTestCase
874
921
  @backups = 0
875
922
  @steps = 0
876
923
  @summary_text = ''
924
+
925
+ # this overrides the submitters choice if it is non-nil
926
+ @compiler = mesa.using_sdk ? 'SDK' : nil
927
+ # only relevant if @compiler is SDK. Gets set during do_one
928
+ @compiler_version = nil
929
+
877
930
  unless MesaTestCase.modules.include? mod
878
931
  raise TestCaseDirError, "Invalid module: #{mod}. Must be one of: " +
879
932
  MesaTestCase.modules.join(', ')
880
933
  end
881
934
  @mod = mod
882
935
  @failure_msg = {
883
- run_test_string: "#{test_name} failed: does not match test string",
936
+ run_test_string: "#{test_name} run failed: does not match test string",
884
937
  run_checksum: "#{test_name} run failed: checksum for #{final_model} " \
885
938
  'does not match after ./rn',
886
939
  run_diff: "#{test_name} run failed: diff #{final_model} " \
@@ -889,7 +942,9 @@ class MesaTestCase
889
942
  photo_checksum: "#{test_name} restart failed: checksum for " \
890
943
  "#{final_model} does not match after ./re",
891
944
  photo_diff: "#{test_name} restart failed: diff #{final_model} " \
892
- 'final_check.mod after ./re'
945
+ 'final_check.mod after ./re',
946
+ compilation: "#{test_name} compilation failed"
947
+
893
948
  }
894
949
  @success_msg = {
895
950
  run_test_string: "#{test_name} run: found test string: " \
@@ -987,6 +1042,14 @@ class MesaTestCase
987
1042
  # based on $MESA_DIR/star/test_suite/each_test_run_and_diff, revision 10000
988
1043
  def do_one
989
1044
  @test_omp_num_threads = omp_num_threads
1045
+ if mesa.using_sdk
1046
+ version_bin = File.join(ENV['MESASDK_ROOT'], 'bin', 'mesasdk_version.sh')
1047
+ # can't use bash_execute because the return value of bash_execute is the
1048
+ # exit status of the commmand (true or false), whereas backticks give the
1049
+ # output (the version string) as the output
1050
+ @compiler_version = `bash -c #{version_bin}`.strip
1051
+ shell.say("Using version #{@compiler_version} of the SDK.", :blue)
1052
+ end
990
1053
  in_dir do
991
1054
  FileUtils.touch '.running'
992
1055
  shell.say("building and running #{test_name}", :blue)
@@ -1017,6 +1080,10 @@ class MesaTestCase
1017
1080
  'steps' => steps,
1018
1081
  'summary_text' => summary_text
1019
1082
  }
1083
+ if compiler == 'SDK'
1084
+ res['compiler'] = 'SDK'
1085
+ res['compiler_version'] = compiler_version
1086
+ end
1020
1087
  File.open(save_file, 'w') { |f| f.write(YAML.dump(res)) }
1021
1088
  shell.say "Successfully saved results to file #{save_file}.\n", :green
1022
1089
  end
@@ -1043,6 +1110,8 @@ class MesaTestCase
1043
1110
  @backups = data['backups'] || @backups
1044
1111
  @steps = data['steps'] || @steps
1045
1112
  @summary_text = data['summary_text'] || @summary_text
1113
+ @compiler = data['compiler'] || @compiler
1114
+ @compiler_version = data['compiler_version'] || @compiler_version
1046
1115
 
1047
1116
  # convert select data to symbols since that is how they are used
1048
1117
  @outcome = @outcome.to_sym if @outcome
@@ -1188,8 +1257,8 @@ class MesaTestCase
1188
1257
  # if this is false, behave like each_test_run_and_diff. assume
1189
1258
  # the checksum is up-to-date and check it matches after rn and re.
1190
1259
  if @mesa.update_checksums
1191
- bash_execute("md5sum \"#{final_model}\" > checks.md5")
1192
1260
  puts "md5sum \"#{final_model}\" > checks.md5"
1261
+ bash_execute("md5sum \"#{final_model}\" > checks.md5")
1193
1262
  FileUtils.cp final_model, 'final_check.mod'
1194
1263
 
1195
1264
  # if there's no photo, we won't check the checksum, so we've succeeded
@@ -1243,7 +1312,11 @@ class MesaTestCase
1243
1312
  # first clean and make... Should be compatible with any shell since
1244
1313
  # redirection is always wrapped in 'bash -c "{STUFF}"'
1245
1314
  simple_clean
1246
- mk
1315
+ begin
1316
+ mk
1317
+ rescue TestCaseDirError
1318
+ return fail_test(:compilation)
1319
+ end
1247
1320
 
1248
1321
  # remove old final model if it exists
1249
1322
  remove_final_model
@@ -1334,7 +1407,7 @@ class MesaTestCase
1334
1407
  end
1335
1408
 
1336
1409
  def get_summary_text
1337
- lines = IO.readlines(out_file).select do |line|
1410
+ IO.readlines(out_file).select do |line|
1338
1411
  line =~ /^\s*runtime/
1339
1412
  end.join
1340
1413
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mesa_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Wolf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-25 00:00:00.000000000 Z
11
+ date: 2017-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.6.14
85
+ rubygems_version: 2.7.6
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Command line tool for running and reporting the MESA test suites.