mesa_test 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mesa_test.rb +21 -15
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '09c46538653cda8c85d7220ff6e0d497b64ad844'
4
- data.tar.gz: 6552eb58501b0332208d950853d9d1044ef8b02d
3
+ metadata.gz: a2c7d57fcb8bd7da9aaff752053c555b18412065
4
+ data.tar.gz: c43742504753ae1a46d5cf692165d430799ef208
5
5
  SHA512:
6
- metadata.gz: df3e1da87539e138ad83208e2a7368350296ca4ab9c079914f57a6391336a95c3ba429c78f44451580167f54d60dee525e5d84fe8b9d82ba60cf995c285c31d0
7
- data.tar.gz: '05479705c0aa5900e125a1c1afad33ec141fcf4e1c9e11b5426aebfb1950346b54f06a0b497be37eaaf9c4fe4f373cbbee72d90400b92a4644e42a395ca1ba75'
6
+ metadata.gz: 31ce61fb6f5273bf07724327a1f1fc819f0b83feb4958948cf4295f89c28af31a9357abe5b412dce483d749d28436f591cc169ecb75cfc822cf20a26eaad195c
7
+ data.tar.gz: 4635bbd0192f920da02015064a6e6f852326741c964a2d8752e4f94c00195774e8d2ff9e9bbaff14c7838c8093a8af07f4acc6b06ee2a40e9947fa52bf93d091
data/lib/mesa_test.rb CHANGED
@@ -361,8 +361,10 @@ class Mesa
361
361
 
362
362
  def self.download(version_number: nil, new_mesa_dir: nil)
363
363
  new_mesa_dir ||= File.join(ENV['HOME'], 'mesa-test-r' + version_number.to_s)
364
- success = system("svn co -r #{version_number} " \
365
- "svn://svn.code.sf.net/p/mesa/code/trunk #{new_mesa_dir}")
364
+ success = bash_execute(
365
+ "svn co -r #{version_number} " \
366
+ "svn://svn.code.sf.net/p/mesa/code/trunk #{new_mesa_dir}"
367
+ )
366
368
  unless success
367
369
  raise MesaDirError, 'Encountered a problem in download mesa ' \
368
370
  "revision #{version_number}."
@@ -459,7 +461,7 @@ class Mesa
459
461
  "running `clean` in #{mesa_dir}." do
460
462
  puts 'MESA_DIR = ' + ENV['MESA_DIR']
461
463
  puts './clean'
462
- system('./clean')
464
+ bash_execute('./clean')
463
465
  end
464
466
  end
465
467
  self
@@ -471,7 +473,7 @@ class Mesa
471
473
  "running `install` in #{mesa_dir}." do
472
474
  puts 'MESA_DIR = ' + ENV['MESA_DIR']
473
475
  puts './install'
474
- system('./install')
476
+ bash_execute('./install')
475
477
  end
476
478
  end
477
479
  self
@@ -825,7 +827,7 @@ class MesaTestCase
825
827
  check_test_case
826
828
  in_dir do
827
829
  puts './clean'
828
- unless system('./clean')
830
+ unless bash_execute('./clean')
829
831
  raise TestCaseDirError, 'Encountered an error while running ./clean ' \
830
832
  "in #{Dir.getwd}."
831
833
  end
@@ -990,7 +992,7 @@ class MesaTestCase
990
992
 
991
993
  # do the run
992
994
  puts './rn >> out.txt 2> err.txt'
993
- system('./rn >> out.txt 2> err.txt')
995
+ bash_execute('./rn >> out.txt 2> err.txt')
994
996
 
995
997
  # report runtime and clean up
996
998
  run_finish = Time.now
@@ -1021,7 +1023,7 @@ class MesaTestCase
1021
1023
  # if this is false, behave like each_test_run_and_diff. assume
1022
1024
  # the checksum is up-to-date and check it matches after rn and re.
1023
1025
  if @mesa.update_checksums
1024
- system("md5sum \"#{final_model}\" > checks.md5")
1026
+ bash_execute("md5sum \"#{final_model}\" > checks.md5")
1025
1027
  puts "md5sum \"#{final_model}\" > checks.md5"
1026
1028
  FileUtils.cp final_model, 'final_check.mod'
1027
1029
 
@@ -1034,7 +1036,7 @@ class MesaTestCase
1034
1036
  # check that final model matches
1035
1037
  puts './ck >& final_check_diff.txt'
1036
1038
  return fail_test(:run_checksum) unless
1037
- system('./ck >& final_check_diff.txt')
1039
+ bash_execute('./ck >& final_check_diff.txt')
1038
1040
  return fail_test(:run_diff) if File.exist?('final_check_diff.txt') &&
1039
1041
  !File.read('final_check_diff.txt').empty?
1040
1042
  return succeed(:run_checksum) if File.exist? final_model
@@ -1056,13 +1058,13 @@ class MesaTestCase
1056
1058
 
1057
1059
  # do restart and consolidate output
1058
1060
  puts "./re #{photo} >> out.txt 2> err.txt"
1059
- system("./re #{photo} >> out.txt 2> err.txt")
1061
+ bash_execute("./re #{photo} >> out.txt 2> err.txt")
1060
1062
  append_and_rm_err
1061
1063
 
1062
1064
  # check that final model matches
1063
1065
  puts './ck >& final_check_diff.txt'
1064
1066
  return fail_test(:photo_checksum) unless
1065
- system('./ck >& final_check_diff.txt')
1067
+ bash_execute('./ck >& final_check_diff.txt')
1066
1068
  return fail_test(:photo_diff) if
1067
1069
  File.exist?('final_check_diff.txt') &&
1068
1070
  !File.read('final_check_diff.txt').empty?
@@ -1073,9 +1075,8 @@ class MesaTestCase
1073
1075
  # assumes we are in the test case directory. Should only be called
1074
1076
  # in the context of an `in_dir` block.
1075
1077
 
1076
- # first clean and make... worried about shell compatibility since we
1077
- # aren't forcing bash. Hopefully '>' for redirecting output is pretty
1078
- # universal
1078
+ # first clean and make... Should be compatible with any shell since
1079
+ # redirection is always wrapped in 'bash -c "{STUFF}"'
1079
1080
  simple_clean
1080
1081
  mk
1081
1082
 
@@ -1109,14 +1110,14 @@ class MesaTestCase
1109
1110
 
1110
1111
  def simple_clean
1111
1112
  puts './clean'
1112
- return if system('./clean')
1113
+ return if bash_execute('./clean')
1113
1114
  raise TestCaseDirError, 'Encountered an error when running `clean` in ' \
1114
1115
  "#{Dir.getwd} for test case #{test_name}."
1115
1116
  end
1116
1117
 
1117
1118
  def mk
1118
1119
  puts './mk > mk.txt'
1119
- unless system('./mk > mk.txt')
1120
+ unless bash_execute('./mk > mk.txt')
1120
1121
  raise TestCaseDirError, 'Encountered an error when running `mk` in ' \
1121
1122
  "#{Dir.getwd} for test case #{test_name}."
1122
1123
  end
@@ -1129,6 +1130,11 @@ class MesaTestCase
1129
1130
  return unless File.exist?(final_model)
1130
1131
  FileUtils.rm(final_model)
1131
1132
  end
1133
+
1134
+ # force the execution to happen with bash
1135
+ def bash_execute(command)
1136
+ system('bash -c "' + command + '"')
1137
+ end
1132
1138
  end
1133
1139
 
1134
1140
  ################################
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.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Wolf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-11 00:00:00.000000000 Z
11
+ date: 2017-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json