Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@PRIORITY_HIGH
@pytest.mark.iface_os
@pytest.mark.rdt_supported("cqm_mbm_local", "cqm_mbm_total")
def test_pqos_mbm_tasks(self, iface):
def get_mbm(output, pid):
mbl = None
mbr = None
lines = output.split("\n")
for line in lines:
# pylint: disable=line-too-long
match = re.search(r"^\s*([0-9]*)\s*[0-9,]*\s*[0-9]*\.[0-9]*\s*[0-9]*k\s*([0-9]*\.[0-9])\s*([0-9]*\.[0-9])\s*$", line)
if match:
curr_pid = int(match.group(1))
if curr_pid == pid:
mbl = float(match.group(2))
mbr = float(match.group(3))
@PRIORITY_HIGH
@pytest.mark.iface_os
@pytest.mark.rdt_supported("cqm_occup_llc")
def test_pqos_cmt_llc_occupancy_tasks(self, iface):
def get_cmt(output, pid):
cmt = None
lines = output.split("\n")
for line in lines:
# pylint: disable=line-too-long
match = re.search(r"^\s*([0-9]*)\s*[0-9,]*\s*[0-9]*\.[0-9]*\s*[0-9]*k\s*([0-9]*\.[0-9])\s*$", line)
if match:
curr_pid = int(match.group(1))
if curr_pid == pid:
cmt = float(match.group(2))
return cmt
@PRIORITY_HIGH
@pytest.mark.iface_os
@pytest.mark.rdt_supported("cat_l2")
def test_rdtset_l3cat_set_task(self, iface):
(_, _, exitstatus) = self.run_rdtset(iface, "-t l2=0xf -c 5-6 -p 1")
assert exitstatus == 0
(stdout, _, exitstatus) = self.run_pqos(iface, "-s")
assert exitstatus == 0
last_cos = Resctrl.get_ctrl_group_count() - 1
assert ("COS{} => 1").format(last_cos) in stdout
assert ("L2CA COS{} => MASK 0xf").format(last_cos) in stdout
@PRIORITY_HIGH
@pytest.mark.rdt_supported("cat_l3")
def test_pqos_l3cat_set_negative(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-e llc:2=0xffffffff")
assert exitstatus == 1
assert "SOCKET 0 L3CA COS2 - FAILED" in stdout
assert "Allocation configuration error!" in stdout
@PRIORITY_HIGH
@pytest.mark.rdt_supported("mba")
def test_pqos_mba_set_negative(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-e mba:2=200")
assert exitstatus == 1
assert "MBA COS2 rate out of range (from 1-100)" in stdout
@PRIORITY_HIGH
@pytest.mark.rdt_supported("cdp_l3")
def test_pqos_l3cat_set_data(self, iface):
self.run_pqos(iface, "-R l3cdp-on")
default_mask = (1 << Env().get('cat', 'l3', 'ways')) - 1
(stdout, _, exitstatus) = self.run_pqos(iface, "-e llc:3d=0xf")
assert exitstatus == 0
assert ("SOCKET 0 L3CA COS3 => DATA 0xf,CODE {}").format(hex(default_mask)) in stdout
@PRIORITY_HIGH
@pytest.mark.rdt_supported("cat_l3")
def test_pqos_l3cat_set(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-e llc:1=0xf;llc:2=0xf0")
assert exitstatus == 0
assert "SOCKET 0 L3CA COS1 => MASK 0xf" in stdout
assert "SOCKET 0 L3CA COS2 => MASK 0xf0" in stdout
assert "Allocation configuration altered" in stdout
(stdout, _, exitstatus) = self.run_pqos(iface, "-s")
assert exitstatus == 0
assert "L3CA COS1 => MASK 0xf" in stdout
assert "L3CA COS2 => MASK 0xf0" in stdout
@PRIORITY_HIGH
@pytest.mark.rdt_supported("cat_l3")
def test_pqos_l3cat_reset(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-R")
assert exitstatus == 0
assert "Allocation reset successful" in stdout
@PRIORITY_HIGH
@pytest.mark.rdt_supported("cqm_occup_llc")
def test_pqos_cmt_detection(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-d")
assert exitstatus == 0
assert re.search(r"Cache Monitoring Technology \(CMT\) events:\s*LLC Occupancy", stdout)
@PRIORITY_HIGH
@pytest.mark.iface_os
@pytest.mark.rdt_supported("cat_l3")
def test_pqos_l3cat_association_tasks_negative(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-a pid:2=9999999999")
assert exitstatus == 1
assert "Task ID number or class id is out of bounds!" in stdout