An EL2 monitor/hypervisor and toolchain that boots macOS 27 on the ASUS A16 (Snapdragon X2 Elite), with an Adreno Metal plug-in and IOGPU kext, and air2ir3, an AIR to Mesa ir3 shader compiler. MIT, with GPL-2.0 components listed in LICENSE and THIRD_PARTY_NOTICES.md. No Apple, Qualcomm, ASUS or Microsoft binaries are included.
24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
# SPDX-License-Identifier: MIT
|
|
"""Reject incomplete or unbound private-sync reader counters."""
|
|
from pathlib import Path
|
|
import runpy
|
|
import struct
|
|
import unittest
|
|
decode=runpy.run_path(str(Path(__file__).with_name('capture-service-profile.py')))['decode_view_table_reads']
|
|
class ViewReaderCapture(unittest.TestCase):
|
|
def test_valid(self):
|
|
row=decode(struct.pack('<6Q',100,100,1700,1700,1700,0),100)
|
|
self.assertEqual(row['tables'],1700)
|
|
def test_bad_size(self):
|
|
for n in (0,47,49):
|
|
with self.assertRaises(ValueError):decode(bytes(n),100)
|
|
def test_bad_counts(self):
|
|
for index in range(6):
|
|
row=[100,100,1700,1700,1700,0];row[index]+=1
|
|
with self.assertRaises(ValueError):decode(struct.pack('<6Q',*row),100)
|
|
def test_bounds(self):
|
|
for tables in (0,99,12801):
|
|
with self.assertRaises(ValueError):decode(struct.pack('<6Q',100,100,tables,tables,tables,0),100)
|
|
with self.assertRaises(ValueError):decode(bytes(48),0)
|
|
if __name__=='__main__':unittest.main()
|