mesa_test 1.0.3 → 1.0.4

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 +25 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 872e80292cb3ab8bdbe1be17b0dfc082528ad1014010fc2be36257d111481370
4
- data.tar.gz: 8450ccf061a543ec47fcfae07a50fbda80f417efa9f28d8f4d9e20f84ed03b8f
3
+ metadata.gz: ae698f83ffe3b76ef2a0b053c751ffe69a7122fa656b26ed8e208b4fc71543c4
4
+ data.tar.gz: ea75570ccd182d43d362c7c8a58fdd8595854664a3a8ba764d535514fdc00b1e
5
5
  SHA512:
6
- metadata.gz: 37aaad6d044957344a18205cbbf4b834d1b0e3000ff6e6c8f33fd17e6f4d2414d01bec923481ae563b173e64e76a057afddbcb138fbce0cbeafa97edcef4d439
7
- data.tar.gz: 6dd6a997f7ec1e5faa0c11755938f6b4213e0c8fd2005f60a88f4dbd63c1c238f71e0323955ac4e17828be6b4646a80918ee0001363fa6204c7fcfd19d9ff6c8
6
+ metadata.gz: b24851cee6d1e5fdfbaf5678654269742fd6890608784fbb513a5e7089260dc06a201db031f1c4c1763e4d5b91d052fd03acb96a11840abaf6f4b44ed59e510d
7
+ data.tar.gz: 9aa56e5f062faeb96996cf9982cb15ba16f445f3002529ab2d7a341fe3988cb5015fcd70362e776f4916b928b8fa73a1c3199ed1979d601015e6172c88c7b075
@@ -302,6 +302,10 @@ e-mail and password will be stored in plain text.'
302
302
  # submit entire commit's worth of test cases, OR submit compilation status
303
303
  # and NO test cases
304
304
  def submit_commit(mesa, empty: false)
305
+ unless mesa.install_attempted?
306
+ raise MesaDirError, 'No testhub.yml file found in installation; '\
307
+ 'must attempt to install before subitting.'
308
+ end
305
309
  uri = URI.parse(base_uri + '/submissions/create.json')
306
310
  https = Net::HTTP.new(uri.hostname, uri.port)
307
311
  https.use_ssl = true if base_uri.include? 'https'
@@ -341,6 +345,11 @@ e-mail and password will be stored in plain text.'
341
345
  # submit results for a single test case instance. Does *not* report overall
342
346
  # compilation status to testhub. Use an empty commit submission for that
343
347
  def submit_instance(mesa, test_case)
348
+ unless mesa.install_attempted?
349
+ raise MesaDirError, 'No testhub.yml file found in installation; '\
350
+ 'must attempt to install before subitting.'
351
+ end
352
+
344
353
  uri = URI.parse(base_uri + '/submissions/create.json')
345
354
  https = Net::HTTP.new(uri.hostname, uri.port)
346
355
  https.use_ssl = true if base_uri.include? 'https'
@@ -557,14 +566,17 @@ class Mesa
557
566
  # installation
558
567
  def compiler_hash
559
568
  data_file = File.join(mesa_dir, 'testhub.yml')
560
- unless File.exist? data_file
561
- raise(MesaDirError, "Could not find file testhub.yml in #{mesa_dir}.")
569
+ res = {
570
+ compiler: 'Unknown',
571
+ sdk_version: 'Unknown',
572
+ math_backend: 'Unknown'
573
+ }
574
+ if File.exist? data_file
575
+ res = res.merge(YAML.safe_load(File.read(data_file)) || {})
576
+ # currently version_number is reported, but we don't need that in Git land
577
+ res.delete('version_number') # returns the value, not the updated hash
578
+ res
562
579
  end
563
-
564
- res = YAML.safe_load(File.read(data_file))
565
- # currently version_number is reported, but we don't need that in Git land
566
- res.delete('version_number') # returns the value, not the updated hash
567
- res
568
580
  end
569
581
 
570
582
  ## TEST SUITE METHODS
@@ -647,11 +659,16 @@ class Mesa
647
659
  def installed?
648
660
  # assume build log reflects installation status; does not account for
649
661
  # mucking with modules after the fact
650
- downloaded? && File.read(File.join(mesa_dir, 'build.log')).include?(
662
+ build_log = File.join(mesa_dir, 'build.log')
663
+ downloaded? && File.exist?(build_log) && File.read(build_log).include?(
651
664
  'MESA installation was successful'
652
665
  )
653
666
  end
654
667
 
668
+ def install_attempted?
669
+ File.exist? File.join(mesa_dir, 'testhub.yml')
670
+ end
671
+
655
672
  private
656
673
 
657
674
  # verify that mesa_dir is valid by checking for existence of test_suite
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: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Wolf