mesa_test 0.0.11 → 0.0.12

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 +14 -0
  3. data/lib/mesa_test.rb +38 -35
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6255c7b67b9190d0c23406f6222f5dd1c754767
4
- data.tar.gz: 5b53a5a876138cd19f42300b98d2e01826ca85c0
3
+ metadata.gz: e9fed2c720b2a988af51cf039b7fb00c7c2b1351
4
+ data.tar.gz: ee251c506f1f203d4899fa799519921312e4f107
5
5
  SHA512:
6
- metadata.gz: 3c1e1949452d9e28a0bbaa735d937e50659266ee83ea67d01bfce7b959fcc10f30d255873db2ea625d24c05a84f784e8157b1cb7b56a594459e505f308e23bf0
7
- data.tar.gz: 3215aac2ee3c010de8c36daec52757a7a2c96af6b8b0c48212ac04b99af58e1279d260574d2aa5a965f6c81acc5884d012ac3ff12114c325f07073ecc0080775
6
+ metadata.gz: e38d7647e692dba6ffdce3e2fa971bd47b4d4549a52e44805d34e42220bec9696973f786b7c162873fef7c9c63fc77375b790585cd967b233bd5d77f571a1fc0
7
+ data.tar.gz: 94168a931b36aea7d2315914d625f2fd51da500ce4196066213488628e0efafe393e45e222ca2da2aaf38c716b9c5836a05c8e4af7d84a833cd10cc89344d15f
data/bin/mesa_test CHANGED
@@ -27,6 +27,10 @@ class MesaTest < Thor
27
27
 
28
28
  #{MesaTestCase.modules.map { |mod| ' ' + mod.to_s }.join(', ')}
29
29
 
30
+ With --diff option, assume the checksums are up-to-date (behave like
31
+ each_test_run_and_diff), on by default. To update checksums after ./rn
32
+ (behave like each_test_run), use --no-diff.
33
+
30
34
  With --force option, skip confirmation of computer details, assuming values
31
35
  in ~/.mesa_test.yml are correct.
32
36
 
@@ -39,6 +43,7 @@ class MesaTest < Thor
39
43
  With --submit option, upload results to MESATestHub. By default, this is on.
40
44
  To run without submission, use --no-submit.
41
45
  LONGDESC
46
+ option :diff, type: :boolean, default: true
42
47
  option :force, type: :boolean, aliases: '-f'
43
48
  option :log, type: :boolean, default: true
44
49
  option :module, type: :string, default: :all
@@ -62,6 +67,9 @@ class MesaTest < Thor
62
67
  m.installed?
63
68
  m.load_test_source_data
64
69
 
70
+ # choose whether to update checksums
71
+ m.update_checksums = !options[:diff]
72
+
65
73
  # make sure the test case is valid
66
74
  t = m.find_test_case(test_case_name: test_case_name,
67
75
  mod: options[:module].downcase.to_sym)
@@ -97,6 +105,10 @@ class MesaTest < Thor
97
105
  report results to MesaTestHub. Specifically, runs and checks all tests
98
106
  detailed in MESA_DIR/star/test_suite/do1_test_source.
99
107
 
108
+ With --diff option, assume the checksums are up-to-date (behave like
109
+ each_test_run_and_diff), on by default. To update checksums after ./rn
110
+ (behave like each_test_run), use --no-diff.
111
+
100
112
  With --force option, skip confirmation of computer details, assuming values
101
113
  in ~/.mesa_test.yml are correct. Only relevant if --submit option is on
102
114
  (by default it is).
@@ -107,6 +119,7 @@ class MesaTest < Thor
107
119
  With --submit option, upload results to MESATestHub. By default, this is on.
108
120
  To run without submission, use --no-submit.
109
121
  LONGDESC
122
+ option :diff, type: :boolean, default: true
110
123
  option :force, type: :boolean, aliases: '-f'
111
124
  option :log, type: :boolean, default: true
112
125
  option :submit, type: :boolean, default: true
@@ -132,6 +145,7 @@ class MesaTest < Thor
132
145
  m.load_test_source_data
133
146
 
134
147
  # run all tests
148
+ m.update_checksums = !options[:diff]
135
149
  m.each_test_run_and_diff(log_results: options[:log])
136
150
 
137
151
  # submit all tests
data/lib/mesa_test.rb CHANGED
@@ -27,56 +27,56 @@ are all required. All other data are useful, but optional. Any data
27
27
  transferred to MESATestHub will be encrypted via HTTPS, but be warned that your
28
28
  e-mail and password will be stored in plain text.'
29
29
  # Get computer name
30
- response = shell.ask("What is the name of this computer (required)? "+
31
- "(#{s.computer_name}):", color = :blue)
30
+ response = shell.ask('What is the name of this computer (required)? ' \
31
+ "(#{s.computer_name}):", :blue)
32
32
  s.computer_name = response unless response.empty?
33
33
 
34
34
  # Get user name
35
- response = shell.ask "What is the name of the operator of this " +
36
- "computer? (#{s.user_name}):", color = :blue
35
+ response = shell.ask 'What is the name of the operator of this ' \
36
+ "computer? (#{s.user_name}):", :blue
37
37
  s.user_name = response unless response.empty?
38
38
 
39
39
  # Get user e-mail
40
- response = shell.ask "What is the email you can be reached " +
41
- "at (required)? (#{s.email}):", color = :blue
40
+ response = shell.ask 'What is the email you can be reached ' \
41
+ "at (required)? (#{s.email}):", :blue
42
42
  s.email = response unless response.empty?
43
43
 
44
44
  # Get user password
45
- response = shell.ask "What is the password associated with the email " +
46
- "#{s.email} (required)? (#{s.password})", color = :blue
45
+ response = shell.ask 'What is the password associated with the email ' \
46
+ "#{s.email} (required)? (#{s.password})", :blue
47
47
  s.password = response unless response.empty?
48
48
 
49
49
  # Get platform information
50
- response = shell.ask "What is the platform of this computer (eg. " +
51
- "macOS, Ubuntu)? (#{s.platform}):", color = :blue
50
+ response = shell.ask 'What is the platform of this computer (eg. ' \
51
+ "macOS, Ubuntu)? (#{s.platform}):", :blue
52
52
  s.platform = response unless response.empty?
53
- response = shell.ask "What is the version of the platform (eg. 10.13, "+
54
- "16.04)? (#{s.platform_version}):", color = :blue
53
+ response = shell.ask 'What is the version of the platform (eg. 10.13, ' \
54
+ "16.04)? (#{s.platform_version}):", :blue
55
55
  s.platform_version = response unless response.empty?
56
56
 
57
57
  # Get processor information
58
- response = shell.ask "What type of processor does this computer have " +
59
- "(eg. 3.1 GHz Intel i7)? (#{s.processor}):", color = :blue
58
+ response = shell.ask 'What type of processor does this computer have ' \
59
+ "(eg. 3.1 GHz Intel i7)? (#{s.processor}):", :blue
60
60
  s.processor = response unless response.empty?
61
61
 
62
62
  # Get ram information
63
- response = shell.ask "How much RAM (in integer GB) does this computer " +
64
- "have (eg. 8)? (#{s.ram_gb}) ", color = :blue
63
+ response = shell.ask 'How much RAM (in integer GB) does this computer ' \
64
+ "have (eg. 8)? (#{s.ram_gb}) ", :blue
65
65
  s.ram_gb = response.to_i unless response.empty?
66
66
 
67
67
  # Get compiler information
68
- response = shell.ask "Which compiler are you using? (#{s.compiler}):",
69
- color = :blue, limited_to: ['', 'SDK', 'gfortran', 'ifort']
70
- s.compiler = response unless response.empty?
68
+ response = shell.ask "Which compiler are you using? (#{s.compiler}):",
69
+ :blue, limited_to: ['', 'SDK', 'gfortran', 'ifort']
70
+ s.compiler = response unless response.empty?
71
71
 
72
72
  # Get compiler version
73
- response = shell.ask "What version of the compiler (eg. 20170921 or " +
74
- "7.2.0)? (#{s.compiler_version}): ", color = :blue
73
+ response = shell.ask 'What version of the compiler (eg. 20170921 or ' \
74
+ "7.2.0)? (#{s.compiler_version}): ", :blue
75
75
  s.compiler_version = response unless response.empty?
76
76
 
77
77
  # Confirm save location
78
- response = shell.ask "This will be saved in #{s.config_file}. Press " +
79
- "enter to accept or enter a new location:", color = :blue, path: true
78
+ response = shell.ask "This will be saved in #{s.config_file}. Press " \
79
+ 'enter to accept or enter a new location:', :blue, path: true
80
80
  s.config_file = response unless response.empty?
81
81
  end
82
82
 
@@ -166,10 +166,8 @@ e-mail and password will be stored in plain text.'
166
166
  puts "Config location #{config_file}"
167
167
  puts '-------------------------------------------------------'
168
168
  puts ''
169
- shell = Thor.new
170
169
  response = shell.ask 'Is this correct? (y/Y = Yes, anything else = No):'
171
- return true if response.strip.casecmp 'y'
172
- false
170
+ response.strip.casecmp('y') == 0
173
171
  end
174
172
 
175
173
  # For one "computer" on the web server, and for [subjective] consistency
@@ -329,6 +327,7 @@ end
329
327
 
330
328
  class Mesa
331
329
  attr_reader :mesa_dir, :test_data, :test_names, :test_cases, :shell
330
+ attr_accessor :update_checksums
332
331
 
333
332
  def self.download(version_number: nil, new_mesa_dir: nil)
334
333
  new_mesa_dir ||= File.join(ENV['HOME'], 'mesa-test-r' + version_number.to_s)
@@ -343,6 +342,7 @@ class Mesa
343
342
 
344
343
  def initialize(mesa_dir: ENV['MESA_DIR'])
345
344
  @mesa_dir = mesa_dir
345
+ @update_checksums = false
346
346
 
347
347
  # these get populated by calling #load_test_data
348
348
  @test_data = {}
@@ -909,20 +909,23 @@ class MesaTestCase
909
909
  # no final model to check, and we already found the test string, so pass
910
910
  return succeed(:run_test_string) unless final_model
911
911
 
912
- # additional checks for final model, if it is specified
913
- # update checks after new run (Bill W. doesn't know what this does)
914
- # (is this supposed to mark things as passed? The original function
915
- # just has a standard "return" statement, which I interpret as passing)
916
- if ENV.include? 'UPDATE_CHECKS'
912
+ # display runtime message
913
+ puts IO.readlines('out.txt').select { |line| line.scan(/runtime/i) }[-1]
914
+
915
+ # update checksums
916
+ #
917
+ # if this is true, behave like each_test_run. update the checksum
918
+ # after rn and then check it matches after re
919
+ #
920
+ # if this is false, behave like each_test_run_and_diff. assume
921
+ # the checksum is up-to-date and check it matches after rn and re.
922
+ if @mesa.update_checksums
917
923
  system("md5sum \"#{final_model}\" > checks.md5")
918
924
  puts "md5sum \"#{final_model}\" > checks.md5"
919
- FileUtils.cp final_model 'final_check.mod'
925
+ FileUtils.cp final_model, 'final_check.mod'
920
926
  return true
921
927
  end
922
928
 
923
- # display runtime message
924
- puts IO.readlines('out.txt').select { |line| line.scan(/runtime/i) }[-1]
925
-
926
929
  # check that final model matches
927
930
  puts './ck >& final_check_diff.txt'
928
931
  return fail_test(:run_checksum) unless
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mesa_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Wolf