mesa_test 1.1.3 → 1.1.7

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 +4 -4
  2. data/bin/mesa_test +12 -5
  3. data/lib/mesa_test.rb +22 -12
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de6aece52d2c391d00f2fc190fc466bbcd65f892e0779857d191b60705aa16aa
4
- data.tar.gz: 5783cb8940b3ad6d7e8373fec41325c5ffc60f7ba63c912c04c9da78fbf3173e
3
+ metadata.gz: efc30aaa2527a9b7d5b1432f73086b20e5b2eeec104f818c1fc8fdb7c9b69e0f
4
+ data.tar.gz: 606ed99026dfbcefbdca50f6e4e3f53049f59594e2e21ee092b8ff226312148f
5
5
  SHA512:
6
- metadata.gz: 2fc8fe1a184c7ac9b9df350236288445f01e5cccbb8ab4c2d684911e268730f65df24479e1afa62bf03bdabefa9a0e7d82cdbfbda44528e8fb38764071f0bc67
7
- data.tar.gz: 4001cf3f05fd3076f27fae7082aff30f55b1257ee466c38e1a8dee0cc9529f7748357eea6106f6c8adcadaf6f839923f006a73365a198b45d939a425a30531a7
6
+ metadata.gz: fd3560820fdd7b33e16cde218d61cdf964f851f99f08e1ef7b590cd659314fd5c5cf6cba739095318b9214e8110b098bd4dfc569388cb7c93b39f82bbc2646a5
7
+ data.tar.gz: 2a4f7d381e7ac5e155bf7000347443fafd04fda8363f12debeea1843561b5b832e9f3268d3670e267f41ec241b8f4cb3d775158d9cf00e5a3eddbd6f86caad23
data/bin/mesa_test CHANGED
@@ -36,6 +36,8 @@ class MesaTest < Thor
36
36
  '~/.mesa_test.yml are correct rather than checking ' \
37
37
  'with user.',
38
38
  type: :boolean, default: true, aliases: '-f'
39
+ option 'force-logs', desc: 'Submit logs for test case(s), even if they pass',
40
+ type: :boolean, default: false
39
41
  option :submit, desc: 'Submit results (if any) to MesaTestHub.',
40
42
  type: :boolean, default: true
41
43
  option :module, desc: 'Which module to test and/or submit, if applicable.',
@@ -68,7 +70,7 @@ class MesaTest < Thor
68
70
 
69
71
  # submit results
70
72
  shell.say 'Submitting results to ' + s.base_uri + '... ', :blue
71
- s.submit_instance(m, t)
73
+ s.submit_instance(m, t, force_logs: options['force-logs'])
72
74
  else
73
75
  # run all tests
74
76
  m.each_test_run(mod: options[:module].downcase.to_sym)
@@ -77,7 +79,7 @@ class MesaTest < Thor
77
79
  return unless options[:submit]
78
80
 
79
81
  shell.say 'Submitting results to ' + s.base_uri + '... ', :blue
80
- s.submit_commit(m)
82
+ s.submit_commit(m, force_logs: options['force-logs'])
81
83
  end
82
84
  shell.say "Done.\n", :green
83
85
  end
@@ -98,6 +100,8 @@ class MesaTest < Thor
98
100
  '~/.mesa_test.yml are correct rather than checking ' \
99
101
  'with user.',
100
102
  type: :boolean, default: true, aliases: '-f'
103
+ option 'force-logs', desc: 'Submit logs for test case(s), even if they pass',
104
+ type: :boolean, default: false
101
105
  option :module, desc: 'Which module to test and/or submit, if applicable.',
102
106
  type: :string, default: 'all', aliases: '-m'
103
107
  option :empty, desc: 'Whether any test cases will be submitted. Useful for '\
@@ -129,7 +133,7 @@ class MesaTest < Thor
129
133
  mod: options[:module].downcase.to_sym)
130
134
  # submit results
131
135
  shell.say 'Submitting results to ' + s.base_uri + '... ', :blue
132
- s.submit_instance(m, t)
136
+ s.submit_instance(m, t, force_logs: options['force-logs'])
133
137
  shell.say "Done.\n", :green
134
138
  else
135
139
  # submitting compilation information and either all tests (entire) or
@@ -143,7 +147,7 @@ class MesaTest < Thor
143
147
  empty = true
144
148
  ensure
145
149
  # submit all tests
146
- s.submit_commit(m, empty: empty)
150
+ s.submit_commit(m, empty: empty, force_logs: options['force-logs'])
147
151
  end
148
152
  end
149
153
  end
@@ -298,7 +302,10 @@ class MesaTest < Thor
298
302
  ensure
299
303
  # submit all commit and test data
300
304
  successfully_submitted = false
301
- successfully_submitted = s.submit_commit(m) if options[:submit]
305
+ if options[:submit]
306
+ successfully_submitted = s.submit_commit(
307
+ m, force_logs: options['force-logs'])
308
+ end
302
309
 
303
310
  # if requested, installation and submission are successful, destroy the
304
311
  # directory
data/lib/mesa_test.rb CHANGED
@@ -212,7 +212,7 @@ e-mail and password will be stored in plain text.'
212
212
  end
213
213
 
214
214
  def load_computer_data
215
- data_hash = YAML.safe_load(File.read(config_file), [Symbol])
215
+ data_hash = YAML.load(File.read(config_file))
216
216
  @computer_name = data_hash['computer_name']
217
217
  @email = data_hash['email']
218
218
  @password = data_hash['password']
@@ -334,7 +334,7 @@ e-mail and password will be stored in plain text.'
334
334
 
335
335
  # submit entire commit's worth of test cases, OR submit compilation status
336
336
  # and NO test cases
337
- def submit_commit(mesa, empty: false)
337
+ def submit_commit(mesa, empty: false, force_logs: false)
338
338
  unless mesa.install_attempted?
339
339
  raise MesaDirError, 'No testhub.yml file found in installation; '\
340
340
  'must attempt to install before subitting.'
@@ -386,8 +386,8 @@ e-mail and password will be stored in plain text.'
386
386
  test_case_hash.each do |tc_name, test_case|
387
387
  # get at each individual test case, see if it failed, and if it
388
388
  # did, submit its log files
389
- unless test_case.passed?
390
- res &&= submit_test_log(test_case)
389
+ if !test_case.passed? || force_logs
390
+ res &&= submit_test_log(test_case, skip_passing: !force_logs)
391
391
  end
392
392
  end
393
393
  end
@@ -401,7 +401,7 @@ e-mail and password will be stored in plain text.'
401
401
 
402
402
  # submit results for a single test case instance. Does *not* report overall
403
403
  # compilation status to testhub. Use an empty commit submission for that
404
- def submit_instance(mesa, test_case)
404
+ def submit_instance(mesa, test_case, force_logs: false)
405
405
  unless mesa.install_attempted?
406
406
  raise MesaDirError, 'No testhub.yml file found in installation; '\
407
407
  'must attempt to install before subitting.'
@@ -436,7 +436,9 @@ e-mail and password will be stored in plain text.'
436
436
  shell.say "\nSuccessfully submitted instance of #{test_case.test_name} "\
437
437
  "for commit #{mesa.sha}.", :green
438
438
  # submit logs if test failed
439
- return submit_test_log(test_case) unless test_case.passed?
439
+ if !test_case.passed? || force_logs
440
+ return submit_test_log(test_case, skip_passing: !force_logs)
441
+ end
440
442
  true
441
443
  end
442
444
  end
@@ -481,9 +483,12 @@ e-mail and password will be stored in plain text.'
481
483
  end
482
484
 
483
485
  # send build log to the logs server
484
- def submit_test_log(test_case)
485
- # skip submission if mesa was never installed or if the test passed
486
- return true if !test_case.mesa.installed? || test_case.passed?
486
+ def submit_test_log(test_case, skip_passing: true)
487
+ # skip submission if mesa was never installed, test was never run, or if
488
+ # the test passed
489
+ if !test_case.mesa.installed? || !test_case.ran? || (test_case.passed? && skip_passing)
490
+ return true
491
+ end
487
492
 
488
493
  # don't even try unless we have a logs token set
489
494
  unless logs_token
@@ -622,7 +627,7 @@ class Mesa
622
627
 
623
628
  def update_mirror
624
629
  shell.say "\nFetching MESA history...", :blue
625
- command = "git -C #{mirror_dir} fetch origin"
630
+ command = "git -C #{mirror_dir} fetch origin --prune"
626
631
  shell.say command
627
632
  # fail loudly
628
633
  return if bash_execute(command)
@@ -985,11 +990,16 @@ class MesaTestCase
985
990
 
986
991
  def results_hash
987
992
  testhub_file = File.join(test_case_dir, 'testhub.yml')
988
- unless File.exist?(testhub_file)
993
+ unless ran?
989
994
  raise TestCaseDirError.new('No results found for test case '\
990
995
  "#{test_name}.")
991
996
  end
992
- YAML.safe_load(File.read(testhub_file), [Symbol])
997
+ YAML.load(File.read(testhub_file))
998
+ end
999
+
1000
+ # rough proxy for whether or not the test has even been run
1001
+ def ran?
1002
+ File.exist?(testhub_file)
993
1003
  end
994
1004
 
995
1005
  # whether or not a test case has passed; only has meaning
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: 1.1.3
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Wolf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-20 00:00:00.000000000 Z
11
+ date: 2021-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  requirements: []
84
- rubygems_version: 3.2.3
84
+ rubygems_version: 3.1.2
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: Command line tool for running and reporting the MESA test suites.