mesa_test 1.1.6 → 1.1.9

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/mesa_test +52 -49
  3. data/lib/mesa_test.rb +26 -17
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62a113597b8d49b277030dabfb72f46b42bf4c6d33993d86fd3bd98c513bbf44
4
- data.tar.gz: 355642660dddb5a4b87934c0f8fcb9c43a9fa4f900d8d809f62cda3cafcb8d89
3
+ metadata.gz: b1bc3ecd06c1d2cc95d041b7171dc9c6cda0ccb6536beec798f3969b8f8aa87d
4
+ data.tar.gz: 4c0109db46572db7e9dc3d2f2aa0dda259b21ba5049448874d5a0d1ec7a85d6a
5
5
  SHA512:
6
- metadata.gz: 6db7a9183094ce00ca25adc3c51a02570a4d381432be02ee61ebf48d774b4e90904f61171e8530f8db6f2b6dc819bc78ff644ec8e85ff4b0da5d45ea70bf9f37
7
- data.tar.gz: a42908b873207b17ed8195f26c4bde8dd479e2c69dc49e3f2a406e4190109f95522aeb466741b2f18fd1d9966356bf22b7539ec2630af37322b7544bc3ac4cfc
6
+ metadata.gz: f28bd6704f63e5e37c9fc1bf253458012587febf4c11278e143ec2edf10d826d4c37a183cf0a870c6e92419c2145509407cc3cee37136ee43b02035d7f6254d0
7
+ data.tar.gz: 92055286204281167d4655278e9b36c35c4bc1c4de04fb8e41180d19cbc21d71f4b50d5f2489628068ffc79bf1fb0794e164b4f6dcdadac2ad46e31cf34c98d8
data/bin/mesa_test CHANGED
@@ -57,29 +57,31 @@ class MesaTest < Thor
57
57
  mod: options[:module].downcase.to_sym,
58
58
  github_protocol: s.github_protocol
59
59
  )
60
- if test_case_name
61
- # only testing one test case
62
- t = create_and_check_test_case(mesa: m, test_case_name: test_case_name,
63
- mod: options[:module].downcase.to_sym)
64
-
65
- # run test
66
- t.do_one
67
-
68
- # bail out if not submitting
69
- return unless options[:submit]
70
-
71
- # submit results
72
- shell.say 'Submitting results to ' + s.base_uri + '... ', :blue
73
- s.submit_instance(m, t, force_logs: options['force-logs'])
74
- else
75
- # run all tests
76
- m.each_test_run(mod: options[:module].downcase.to_sym)
77
-
78
- # bail out if not submitting
79
- return unless options[:submit]
80
-
81
- shell.say 'Submitting results to ' + s.base_uri + '... ', :blue
82
- s.submit_commit(m, force_logs: options['force-logs'])
60
+ m.with_mesa_dir do
61
+ if test_case_name
62
+ # only testing one test case
63
+ t = create_and_check_test_case(mesa: m, test_case_name: test_case_name,
64
+ mod: options[:module].downcase.to_sym)
65
+
66
+ # run test
67
+ t.do_one
68
+
69
+ # bail out if not submitting
70
+ return unless options[:submit]
71
+
72
+ # submit results
73
+ shell.say 'Submitting results to ' + s.base_uri + '... ', :blue
74
+ s.submit_instance(m, t, force_logs: options['force-logs'])
75
+ else
76
+ # run all tests
77
+ m.each_test_run(mod: options[:module].downcase.to_sym)
78
+
79
+ # bail out if not submitting
80
+ return unless options[:submit]
81
+
82
+ shell.say 'Submitting results to ' + s.base_uri + '... ', :blue
83
+ s.submit_commit(m, force_logs: options['force-logs'])
84
+ end
83
85
  end
84
86
  shell.say "Done.\n", :green
85
87
  end
@@ -123,31 +125,32 @@ class MesaTest < Thor
123
125
 
124
126
  # default value for now; might change to false if we have a bad
125
127
  # installation or if a test case is specified
126
-
127
- if test_case_name
128
- # just submitting one test case.
129
- # this is not an empty submission since there is one test case (the
130
- # +empty+ option is ignored in this case)
131
-
132
- t = create_and_check_test_case(mesa: m, test_case_name: test_case_name,
133
- mod: options[:module].downcase.to_sym)
134
- # submit results
135
- shell.say 'Submitting results to ' + s.base_uri + '... ', :blue
136
- s.submit_instance(m, t, force_logs: options['force-logs'])
137
- shell.say "Done.\n", :green
138
- else
139
- # submitting compilation information and either all tests (entire) or
140
- # no tests (empty)
141
- begin
142
- m.check_installation
143
- rescue MesaDirError
144
- shell.say %q{This MESA installation doesn't seem to be compiled } \
145
- 'properly. Attempting to submit a compilation failure to '\
146
- 'MESATestHub.', :red
147
- empty = true
148
- ensure
149
- # submit all tests
150
- s.submit_commit(m, empty: empty, force_logs: options['force-logs'])
128
+ m.with_mesa_dir do
129
+ if test_case_name
130
+ # just submitting one test case.
131
+ # this is not an empty submission since there is one test case (the
132
+ # +empty+ option is ignored in this case)
133
+
134
+ t = create_and_check_test_case(mesa: m, test_case_name: test_case_name,
135
+ mod: options[:module].downcase.to_sym)
136
+ # submit results
137
+ shell.say 'Submitting results to ' + s.base_uri + '... ', :blue
138
+ s.submit_instance(m, t, force_logs: options['force-logs'])
139
+ shell.say "Done.\n", :green
140
+ else
141
+ # submitting compilation information and either all tests (entire) or
142
+ # no tests (empty)
143
+ begin
144
+ m.check_installation
145
+ rescue MesaDirError
146
+ shell.say %q{This MESA installation doesn't seem to be compiled } \
147
+ 'properly. Attempting to submit a compilation failure to '\
148
+ 'MESATestHub.', :red
149
+ empty = true
150
+ ensure
151
+ # submit all tests
152
+ s.submit_commit(m, empty: empty, force_logs: options['force-logs'])
153
+ end
151
154
  end
152
155
  end
153
156
  end
@@ -298,7 +301,7 @@ class MesaTest < Thor
298
301
 
299
302
  # run all tests. Don't be fooled, whether or not a diff happens is set
300
303
  # by the diff attribute of the mesa object, set above.
301
- m.each_test_run(mod: options[:module].downcase.to_sym)
304
+ m.with_mesa_dir { m.each_test_run(mod: options[:module].downcase.to_sym) }
302
305
  ensure
303
306
  # submit all commit and test data
304
307
  successfully_submitted = false
data/lib/mesa_test.rb CHANGED
@@ -484,8 +484,9 @@ e-mail and password will be stored in plain text.'
484
484
 
485
485
  # send build log to the logs server
486
486
  def submit_test_log(test_case, skip_passing: true)
487
- # skip submission if mesa was never installed or if the test passed
488
- if !test_case.mesa.installed? || (test_case.passed? && skip_passing)
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)
489
490
  return true
490
491
  end
491
492
 
@@ -608,11 +609,11 @@ class Mesa
608
609
  end
609
610
  end
610
611
 
611
- update_mirror
612
-
613
612
  # ensure "work" directory is removed from worktree
614
613
  remove
615
614
 
615
+ update_mirror
616
+
616
617
  # create "work" directory with proper commit
617
618
  shell.say "\nSetting up worktree repo...", :blue
618
619
  FileUtils.mkdir_p mesa_dir
@@ -812,16 +813,6 @@ class Mesa
812
813
  File.exist? File.join(mesa_dir, 'testhub.yml')
813
814
  end
814
815
 
815
- private
816
-
817
- # verify that mesa_dir is valid by checking for existence of test_suite
818
- # directory for each module (somewhat arbitrary)
819
- def check_mesa_dir
820
- MesaTestCase.modules.inject(true) do |res, mod|
821
- res && dir_or_symlink_exists?(test_suite_dir(mod: mod))
822
- end
823
- end
824
-
825
816
  # change MESA_DIR for the execution of the block and then revert to the
826
817
  # original value
827
818
  def with_mesa_dir
@@ -829,7 +820,7 @@ class Mesa
829
820
  orig_mesa_dir = ENV['MESA_DIR']
830
821
  ENV['MESA_DIR'] = mesa_dir
831
822
  shell.say "Temporarily changed MESA_DIR to #{ENV['MESA_DIR']}.", :blue
832
-
823
+
833
824
  # do the stuff
834
825
  begin
835
826
  yield
@@ -840,6 +831,16 @@ class Mesa
840
831
  end
841
832
  end
842
833
 
834
+ private
835
+
836
+ # verify that mesa_dir is valid by checking for existence of test_suite
837
+ # directory for each module (somewhat arbitrary)
838
+ def check_mesa_dir
839
+ MesaTestCase.modules.inject(true) do |res, mod|
840
+ res && dir_or_symlink_exists?(test_suite_dir(mod: mod))
841
+ end
842
+ end
843
+
843
844
  def all_names_ordered(mod: :all)
844
845
  load_test_source_data unless @names_to_numbers
845
846
  if mod == :all
@@ -978,6 +979,10 @@ class MesaTestCase
978
979
  File.join(test_suite_dir, test_name)
979
980
  end
980
981
 
982
+ def testhub_file
983
+ File.join(test_case_dir, 'testhub.yml')
984
+ end
985
+
981
986
  # just punt to +each_test_run+ in the test_suite directory. It's your problem
982
987
  # now, sucker!
983
988
  def do_one
@@ -988,14 +993,18 @@ class MesaTestCase
988
993
  end
989
994
 
990
995
  def results_hash
991
- testhub_file = File.join(test_case_dir, 'testhub.yml')
992
- unless File.exist?(testhub_file)
996
+ unless ran?
993
997
  raise TestCaseDirError.new('No results found for test case '\
994
998
  "#{test_name}.")
995
999
  end
996
1000
  YAML.load(File.read(testhub_file))
997
1001
  end
998
1002
 
1003
+ # rough proxy for whether or not the test has even been run
1004
+ def ran?
1005
+ File.exist?(testhub_file)
1006
+ end
1007
+
999
1008
  # whether or not a test case has passed; only has meaning
1000
1009
  # if we can load the results hash, though
1001
1010
  def passed?
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.6
4
+ version: 1.1.9
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-08-18 00:00:00.000000000 Z
11
+ date: 2022-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json