mesa_test 1.1.4 → 1.1.8

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 +13 -6
  3. data/lib/mesa_test.rb +26 -13
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ebdd3dbd2229928d24bc1a5c56ab18fa34291181f804c5371df8572eff546c5
4
- data.tar.gz: b9ce87dcff915345719a8992e5db358d431ddd8d9221bb3ef813c7b414af0725
3
+ metadata.gz: cd52a22e9772094f32247bd8785a508f384ceaec1f32d7e6541920d92e730227
4
+ data.tar.gz: 20b34824551a54e1fd529867d2451972168d663d0f7f799fa19c3e9293477360
5
5
  SHA512:
6
- metadata.gz: faf57662b9d766780f26b5cc20e46f603b7de8683b9b4cb124911c356a3ab52eccabe29066b4de347822678b10777a3c3a940c17fcab20972366ec944e84c92a
7
- data.tar.gz: b5925453408e4ea1aca27092b82a09345e096e4e88140eb6be67d6c2ca64f88d9527b27378edd9afe93d4dd3bb89acacba8416ebf6188ecdb6810def9316d618
6
+ metadata.gz: 2ee0df9acc559f188b5dcb1dbab9124cc3cb379ad213aff5910943df367f753e8594d4b2bfee597a2c129f46523434a9e7c931707073c340b9db3ccd26fcc9c7
7
+ data.tar.gz: d1cfbfe89e93881108f0fd5bbe7f0676e2812dbe8310549de9ca971ee044932904ad5062331019bef828d73322ac1aada2c439f0f4533ce2adee7dc51fe022d9
data/bin/mesa_test CHANGED
@@ -4,7 +4,7 @@
4
4
  # rather than system version and run out of local lib, not installed
5
5
  # if :staging, submit to beta version and run out of local lib, not installed
6
6
  # anything else: trust rubygems to get lib and submit to real deal testhub
7
- MODE = :development
7
+ MODE = :production
8
8
 
9
9
  case MODE
10
10
  when :staging, :development
@@ -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)
@@ -974,6 +979,10 @@ class MesaTestCase
974
979
  File.join(test_suite_dir, test_name)
975
980
  end
976
981
 
982
+ def testhub_file
983
+ File.join(test_case_dir, 'testhub.yml')
984
+ end
985
+
977
986
  # just punt to +each_test_run+ in the test_suite directory. It's your problem
978
987
  # now, sucker!
979
988
  def do_one
@@ -984,12 +993,16 @@ class MesaTestCase
984
993
  end
985
994
 
986
995
  def results_hash
987
- testhub_file = File.join(test_case_dir, 'testhub.yml')
988
- unless File.exist?(testhub_file)
996
+ unless ran?
989
997
  raise TestCaseDirError.new('No results found for test case '\
990
998
  "#{test_name}.")
991
999
  end
992
- YAML.safe_load(File.read(testhub_file), [Symbol])
1000
+ YAML.load(File.read(testhub_file))
1001
+ end
1002
+
1003
+ # rough proxy for whether or not the test has even been run
1004
+ def ran?
1005
+ File.exist?(testhub_file)
993
1006
  end
994
1007
 
995
1008
  # 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.4
4
+ version: 1.1.8
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: 2022-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json