Fix PMU validation tests on GitHub's Ubuntu VM (#12)

Summary:
The Ubuntu VM that GitHub Actions uses doesn't seem to have permissions
to access the PMU. This exits the test successfully if it's not available.

Pull Request resolved: https://github.com/facebookexperimental/reverie/pull/12

Reviewed By: andronat

Differential Revision: D35838916

Pulled By: jasonwhite

fbshipit-source-id: 0e6cba4c170e3c7e293300e031ee41333c399040
This commit is contained in:
Jason White 2022-04-22 11:52:10 -07:00 committed by Facebook GitHub Bot
parent 6cb6d53799
commit 7de9d81972

View file

@ -605,9 +605,14 @@ fn check_for_xen_pmi_bug(precise_ip: bool) -> Result<(), PmuValidationError> {
#[cfg(test)]
mod test {
use super::*;
use crate::perf::is_perf_supported;
#[test]
fn test_check_for_ioc_period_bug() {
if !is_perf_supported() {
return;
}
// This assumes the machine running the test will not have this bug
if let Err(pmu_err) = check_for_ioc_period_bug(false) {
panic!("Ioc period bug check failed - {}", pmu_err);
@ -616,6 +621,10 @@ mod test {
#[test]
fn test_check_working_counters() {
if !is_perf_supported() {
return;
}
// This assumes the machine running the test will have working counters
if let Err(pmu_err) = check_working_counters(false) {
panic!("Working counters check failed - {}", pmu_err);
@ -624,6 +633,10 @@ mod test {
#[test]
fn test_check_for_arch_bugs() {
if !is_perf_supported() {
return;
}
// This assumes the machine running the test will not have arch bugs
if let Err(pmu_err) = check_for_arch_bugs(false) {
panic!("Architecture-specific bug check failed - {}", pmu_err);