Class: HybridPlatformsConductor::HpcPlugins::Test::Spectre

Inherits:
Test
  • Object
show all
Defined in:
lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb

Overview

Test that the vulnerabilities Spectre and Meltdown are patched

Constant Summary collapse

VULNERABILITIES_TO_CHECK =
{
  'CVE-2017-5753' => 'Spectre Variant 1',
  'CVE-2017-5715' => 'Spectre Variant 2',
  'CVE-2017-5754' => 'Meltdown'
}

Constants included from LoggerHelpers

LoggerHelpers::LEVELS_MODIFIERS, LoggerHelpers::LEVELS_TO_STDERR

Instance Attribute Summary

Attributes inherited from Test

#errors, #expected_failure, #name, #node, #platform

Instance Method Summary collapse

Methods inherited from Test

#assert_equal, #assert_match, #error, #executed, #executed?, #initialize, only_on_nodes, only_on_platforms, #to_s

Methods inherited from Plugin

extend_config_dsl_with, #initialize, valid?

Methods included from LoggerHelpers

#err, #init_loggers, #log_component=, #log_debug?, #log_level=, #out, #section, #set_loggers_format, #stderr_device, #stderr_device=, #stderr_displayed?, #stdout_device, #stdout_device=, #stdout_displayed?, #stdouts_to_s, #with_progress_bar

Constructor Details

This class inherits a constructor from HybridPlatformsConductor::Test

Instance Method Details

#test_on_nodeObject

Check my_test_plugin.rb.sample documentation for signature details.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb', line 17

def test_on_node
  spectre_cmd = "    \#{@nodes_handler.sudo_on(@node)} /bin/bash <<'EOAction'\n    \#{File.read(\"\#{__dir__}/spectre-meltdown-checker.sh\")}\n    EOAction\n  EOS\n  {\n    spectre_cmd => {\n      validator: proc do |stdout|\n        VULNERABILITIES_TO_CHECK.each do |id, name|\n          id_regexp = /\#{Regexp.escape(id)}/\n          status_idx = stdout.index { |line| line =~ id_regexp }\n          if status_idx.nil?\n            error \"Unable to find vulnerability section \#{id}\"\n          else\n            while !stdout[status_idx].nil? && !(stdout[status_idx] =~ /STATUS:[^A-Z]+([A-Z ]+)/)\n              status_idx += 1\n            end\n            if stdout[status_idx].nil?\n              error \"Unable to find vulnerability status for \#{id}\"\n            else\n              status = $1.strip\n              error \"Status for \#{name}: \#{status}\" if status != 'NOT VULNERABLE'\n            end\n          end\n        end\n      end,\n      timeout: 30\n    }\n  }\nend\n"