mesa_test 0.2.6 → 0.2.8
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.
- checksums.yaml +4 -4
- data/lib/mesa_test.rb +84 -16
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffb22b22898afec98716e08605dc1ed3a3efdcf3cf02cf1f1d5602e5282dd712
|
4
|
+
data.tar.gz: 2130f97b864ac9885fc4fedbb7a9c287e245b4a48f674ee389eb6577da252dbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef6a318cd19105e44b87cd146b333ebca8838bde2cf9aeed19c689dd6c429ea37290dcfc18e43ae096364a83a2e7009d7111fdaae4bb6d968cd6ceb5e151ebf5
|
7
|
+
data.tar.gz: 657cf06739a6d955e16f4b0db0d0678e9574bc1b29f99995171fe4a0648429146d2f045beed3b38f339c32d08f79e9b0efa83f01f40445a126a5df4e260042c5
|
data/lib/mesa_test.rb
CHANGED
@@ -241,6 +241,8 @@ e-mail and password will be stored in plain text.'
|
|
241
241
|
email: email,
|
242
242
|
password: password,
|
243
243
|
runtime_seconds: test_case.runtime_seconds,
|
244
|
+
re_time: test_case.re_time,
|
245
|
+
total_runtime_seconds: test_case.total_runtime_seconds,
|
244
246
|
mesa_version: test_case.mesa_version,
|
245
247
|
passed: test_case.passed? ? 1 : 0,
|
246
248
|
compiler: test_case.compiler || compiler,
|
@@ -254,6 +256,8 @@ e-mail and password will be stored in plain text.'
|
|
254
256
|
backups: test_case.backups,
|
255
257
|
diff: test_case.diff,
|
256
258
|
checksum: test_case.checksum,
|
259
|
+
rn_mem: test_case.rn_mem,
|
260
|
+
re_mem: test_case.re_mem,
|
257
261
|
summary_text: test_case.summary_text
|
258
262
|
}
|
259
263
|
|
@@ -300,6 +304,8 @@ e-mail and password will be stored in plain text.'
|
|
300
304
|
res[:instances] << {
|
301
305
|
test_instance: {
|
302
306
|
runtime_seconds: test_case.runtime_seconds,
|
307
|
+
re_time: test_case.re_time,
|
308
|
+
total_runtime_seconds: test_case.total_runtime_seconds,
|
303
309
|
passed: test_case.passed?,
|
304
310
|
compiler: test_case.compiler || compiler,
|
305
311
|
compiler_version: test_case.compiler_version || compiler_version,
|
@@ -312,6 +318,8 @@ e-mail and password will be stored in plain text.'
|
|
312
318
|
backups: test_case.backups,
|
313
319
|
diff: test_case.diff,
|
314
320
|
checksum: test_case.checksum,
|
321
|
+
rn_mem: test_case.rn_mem,
|
322
|
+
re_mem: test_case.re_mem,
|
315
323
|
summary_text: test_case.summary_text
|
316
324
|
},
|
317
325
|
extra: { test_case: test_name, mod: mod }
|
@@ -930,7 +938,8 @@ class MesaTestCase
|
|
930
938
|
:failure_msg, :success_msg, :photo, :runtime_seconds,
|
931
939
|
:test_omp_num_threads, :mesa_version, :shell, :mod, :retries,
|
932
940
|
:backups, :steps, :runtime_minutes, :summary_text, :compiler,
|
933
|
-
:compiler_version, :diff, :checksum
|
941
|
+
:compiler_version, :diff, :checksum, :rn_mem, :re_mem,
|
942
|
+
:re_time, :total_runtime_seconds
|
934
943
|
attr_accessor :data_names, :data_types, :failure_type, :success_type,
|
935
944
|
:outcome
|
936
945
|
|
@@ -953,6 +962,7 @@ class MesaTestCase
|
|
953
962
|
@runtime_seconds = 0
|
954
963
|
@test_omp_num_threads = 1
|
955
964
|
@runtime_minutes = 0
|
965
|
+
@total_runtime_seconds = 0
|
956
966
|
@retries = 0
|
957
967
|
@backups = 0
|
958
968
|
@steps = 0
|
@@ -963,6 +973,12 @@ class MesaTestCase
|
|
963
973
|
# start with nil. Should only be updated to a non-nil value if test is
|
964
974
|
# completely successful
|
965
975
|
@checksum = nil
|
976
|
+
@re_time = nil # rn_time is in the form of @runtime_seconds
|
977
|
+
|
978
|
+
# these only get used with modern versions of both the sdk and the test
|
979
|
+
# suite
|
980
|
+
@rn_mem = nil
|
981
|
+
@re_mem = nil
|
966
982
|
|
967
983
|
# note: this gets overridden for new runs, so this is probably irrelevant
|
968
984
|
@summary_text = nil
|
@@ -1047,8 +1063,8 @@ class MesaTestCase
|
|
1047
1063
|
|
1048
1064
|
# based on $MESA_DIR/star/test_suite/each_test_clean, revision 10000
|
1049
1065
|
def clean
|
1050
|
-
shell.say("
|
1051
|
-
puts ''
|
1066
|
+
shell.say("Cleaning #{test_name}", color = :yellow)
|
1067
|
+
# puts ''
|
1052
1068
|
check_mesa_dir
|
1053
1069
|
check_test_case
|
1054
1070
|
in_dir do
|
@@ -1058,7 +1074,7 @@ class MesaTestCase
|
|
1058
1074
|
"in #{Dir.getwd}."
|
1059
1075
|
end
|
1060
1076
|
shell.say 'Removing all files from LOGS, LOGS1, LOGS2, photos, ' \
|
1061
|
-
'photos1, and photos2', color = :blue
|
1077
|
+
'photos1, and photos2 as well as old test results', color = :blue
|
1062
1078
|
FileUtils.rm_f Dir.glob('LOGS/*')
|
1063
1079
|
FileUtils.rm_f Dir.glob('LOGS1/*')
|
1064
1080
|
FileUtils.rm_f Dir.glob('LOGS2/*')
|
@@ -1066,11 +1082,12 @@ class MesaTestCase
|
|
1066
1082
|
FileUtils.rm_f Dir.glob('photos1/*')
|
1067
1083
|
FileUtils.rm_f Dir.glob('photos2/*')
|
1068
1084
|
|
1069
|
-
shell.say 'Removing files binary_history.data, out.txt,
|
1070
|
-
'test_results.yml', color = :blue
|
1085
|
+
shell.say 'Removing files binary_history.data, out.txt, ' \
|
1086
|
+
'test_results.yml, and memory usage files', color = :blue
|
1071
1087
|
FileUtils.rm_f 'binary_history.data'
|
1072
1088
|
FileUtils.rm_f 'out.txt'
|
1073
1089
|
FileUtils.rm_f 'test_results.yml'
|
1090
|
+
FileUtils.rm_f Dir.glob('mem-*.txt')
|
1074
1091
|
if File.directory? File.join('star_history', 'history_out')
|
1075
1092
|
shell.say 'Removing all files of the form history_out* from ' \
|
1076
1093
|
'star_history', :blue
|
@@ -1088,23 +1105,40 @@ class MesaTestCase
|
|
1088
1105
|
|
1089
1106
|
# based on $MESA_DIR/star/test_suite/each_test_run_and_diff, revision 10000
|
1090
1107
|
def do_one
|
1108
|
+
shell.say("Testing #{test_name}", :yellow)
|
1109
|
+
# puts ''
|
1110
|
+
test_start = Time.now
|
1091
1111
|
@test_omp_num_threads = omp_num_threads
|
1092
1112
|
if mesa.using_sdk
|
1093
|
-
version_bin = File.join(ENV['MESASDK_ROOT'], 'bin', 'mesasdk_version
|
1113
|
+
version_bin = File.join(ENV['MESASDK_ROOT'], 'bin', 'mesasdk_version')
|
1094
1114
|
# can't use bash_execute because the return value of bash_execute is the
|
1095
1115
|
# exit status of the commmand (true or false), whereas backticks give the
|
1096
1116
|
# output (the version string) as the output
|
1097
|
-
|
1117
|
+
if File.exist? version_bin
|
1118
|
+
# newer SDKs have a simple executable
|
1119
|
+
@compiler_version = `#{version_bin}`.strip
|
1120
|
+
else
|
1121
|
+
# older way, call bash on it (file is mesasdk_version.sh)
|
1122
|
+
@compiler_version = `bash -c #{version_bin + '.sh'}`.strip
|
1123
|
+
end
|
1124
|
+
|
1098
1125
|
shell.say("Using version #{@compiler_version} of the SDK.", :blue)
|
1099
1126
|
end
|
1100
1127
|
in_dir do
|
1101
1128
|
FileUtils.touch '.running'
|
1102
|
-
shell.say("building and running #{test_name}", :blue)
|
1103
|
-
puts ''
|
1104
1129
|
build_and_run
|
1130
|
+
# report memory usage if it is available
|
1131
|
+
if File.exist?('mem-rn.txt')
|
1132
|
+
@rn_mem = File.read('mem-rn.txt').strip.to_i
|
1133
|
+
end
|
1134
|
+
if File.exist?('mem-re.txt')
|
1135
|
+
@re_mem = File.read('mem-re.txt').strip.to_i
|
1136
|
+
end
|
1105
1137
|
FileUtils.rm '.running'
|
1106
1138
|
puts ''
|
1107
1139
|
end
|
1140
|
+
test_finish = Time.now
|
1141
|
+
@total_runtime_seconds = (test_finish - test_start).to_i
|
1108
1142
|
end
|
1109
1143
|
|
1110
1144
|
def log_results
|
@@ -1116,6 +1150,8 @@ class MesaTestCase
|
|
1116
1150
|
'test_case' => test_name,
|
1117
1151
|
'module' => mod,
|
1118
1152
|
'runtime_seconds' => runtime_seconds,
|
1153
|
+
're_time' => re_time,
|
1154
|
+
'total_runtime_seconds' => total_runtime_seconds,
|
1119
1155
|
'mesa_version' => mesa_version,
|
1120
1156
|
'outcome' => outcome,
|
1121
1157
|
'omp_num_threads' => test_omp_num_threads,
|
@@ -1127,6 +1163,8 @@ class MesaTestCase
|
|
1127
1163
|
'steps' => steps,
|
1128
1164
|
'diff' => diff,
|
1129
1165
|
'checksum' => checksum,
|
1166
|
+
'rn_mem' => rn_mem,
|
1167
|
+
're_mem' => re_mem,
|
1130
1168
|
'summary_text' => summary_text
|
1131
1169
|
}
|
1132
1170
|
if compiler == 'SDK'
|
@@ -1148,6 +1186,8 @@ class MesaTestCase
|
|
1148
1186
|
end
|
1149
1187
|
data = YAML.safe_load(File.read(load_file), [Symbol])
|
1150
1188
|
@runtime_seconds = data['runtime_seconds'] || @runtime_seconds
|
1189
|
+
@re_time = data['re_time'] || @re_time
|
1190
|
+
@total_runtime_seconds = data['total_runtime_seconds'] || @total_runtime_seconds
|
1151
1191
|
@mod = data['module'] || @mod
|
1152
1192
|
@mesa_version = data['mesa_version'] || @mesa_version
|
1153
1193
|
@outcome = data['outcome'] || @outcome
|
@@ -1160,6 +1200,8 @@ class MesaTestCase
|
|
1160
1200
|
@steps = data['steps'] || @steps
|
1161
1201
|
@diff = data['diff'] || @diff
|
1162
1202
|
@checksum = data['checksum'] || @checksum
|
1203
|
+
@rn_mem = data['rn_mem'] || @rn_mem
|
1204
|
+
@re_mem = data['re_mem'] || @re_mem
|
1163
1205
|
@summary_text = data['summary_text'] || @summary_text
|
1164
1206
|
@compiler = data['compiler'] || @compiler
|
1165
1207
|
|
@@ -1210,6 +1252,10 @@ class MesaTestCase
|
|
1210
1252
|
%i[float integer string boolean]
|
1211
1253
|
end
|
1212
1254
|
|
1255
|
+
def rn_time
|
1256
|
+
runtime_seconds
|
1257
|
+
end
|
1258
|
+
|
1213
1259
|
# cd into the test case directory, do something in a block, then cd back
|
1214
1260
|
# to original directory
|
1215
1261
|
def in_dir(&block)
|
@@ -1289,12 +1335,19 @@ class MesaTestCase
|
|
1289
1335
|
run_start = Time.now
|
1290
1336
|
|
1291
1337
|
# do the run
|
1292
|
-
|
1293
|
-
|
1338
|
+
rn_command = if File.exist?(File.join(ENV['MESASDK_ROOT'], 'bin', 'time'))
|
1339
|
+
%q(command time -f '%M' -o mem-rn.txt ./rn > out.txt 2> ) +
|
1340
|
+
'err.txt'
|
1341
|
+
else
|
1342
|
+
'./rn >> out.txt 2> err.txt'
|
1343
|
+
end
|
1344
|
+
puts rn_command
|
1345
|
+
bash_execute(rn_command)
|
1294
1346
|
|
1295
1347
|
# report runtime and clean up
|
1296
1348
|
run_finish = Time.now
|
1297
1349
|
@runtime_seconds = (run_finish - run_start).to_i
|
1350
|
+
@rn_time = (run_finish - run_start).to_i
|
1298
1351
|
shell.say("Finished with ./rn; runtime = #{@runtime_seconds} seconds.",
|
1299
1352
|
:blue)
|
1300
1353
|
append_and_rm_err
|
@@ -1360,9 +1413,23 @@ class MesaTestCase
|
|
1360
1413
|
# remove final model since it will be remade by restart
|
1361
1414
|
FileUtils.rm_f final_model
|
1362
1415
|
|
1363
|
-
# do restart and consolidate output
|
1364
|
-
|
1365
|
-
|
1416
|
+
# do restart and consolidate output. Command depends on if we have access
|
1417
|
+
# to SDK version of gnu time.
|
1418
|
+
re_command = if File.exist?(File.join(ENV['MESASDK_ROOT'], 'bin', 'time'))
|
1419
|
+
%q(command time -f '%M' -o mem-re.txt ./re ) + "#{photo}" \
|
1420
|
+
' >> out.txt 2> err.txt'
|
1421
|
+
else
|
1422
|
+
"./re #{photo} >> out.txt 2> err.txt"
|
1423
|
+
end
|
1424
|
+
|
1425
|
+
puts re_command
|
1426
|
+
# puts "./re #{photo} >> out.txt 2> err.txt"
|
1427
|
+
re_start = Time.now
|
1428
|
+
# bash_execute("./re #{photo} >> out.txt 2> err.txt")
|
1429
|
+
# bash_execute(%Q{command time -f '%M' -o mem-re.txt ./re #{photo} >> out.txt 2> err.txt})
|
1430
|
+
bash_execute(re_command)
|
1431
|
+
re_finish = Time.now
|
1432
|
+
@re_time = (re_finish - re_start).to_i
|
1366
1433
|
append_and_rm_err
|
1367
1434
|
|
1368
1435
|
# check that final model matches
|
@@ -1541,7 +1608,8 @@ def visit_dir(new_dir)
|
|
1541
1608
|
Dir.chdir(new_dir)
|
1542
1609
|
yield if block_given?
|
1543
1610
|
shell.say "Leaving #{new_dir}\n", :blue
|
1544
|
-
shell.say "
|
1611
|
+
shell.say "Re-entering #{cwd}.", :blue
|
1612
|
+
puts ""
|
1545
1613
|
Dir.chdir(cwd)
|
1546
1614
|
end
|
1547
1615
|
|
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.2.
|
4
|
+
version: 0.2.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:
|
11
|
+
date: 2019-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -81,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
|
-
|
85
|
-
rubygems_version: 2.7.6
|
84
|
+
rubygems_version: 3.0.3
|
86
85
|
signing_key:
|
87
86
|
specification_version: 4
|
88
87
|
summary: Command line tool for running and reporting the MESA test suites.
|