Created
March 17, 2021 22:27
-
-
Save conorsch/261d71988744d6cab91ed0c502df8e11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_spectre_meltdown_checker(host): | |
""" | |
Runs the "spectre-meltdown-checker" script to evaluate | |
vulnerability for CPU side-channel attacks. | |
""" | |
if not host.exists("/usr/bin/spectre-meltdown-checker"): | |
warnings.warn("Installing spectre-meltdown-checker to run CPU tests") | |
with host.sudo(): | |
host.run("apt-get install -y spectre-meltdown-checker") | |
try: | |
with host.sudo(): | |
stdout = host.check_output("spectre-meltdown-checker --batch json") | |
results = json.loads(stdout) | |
for result in results: | |
assert result["VULNERABLE"] == False | |
finally: | |
host.run("apt-get remove -y spectre-meltdown-checker") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment