7686729069
Extract protocol-agnostic FenceTimeline from Intel to shared src/drivers/fence.rs — atomic-based fence tracking suitable for Intel, VIRGL, and AMD drivers. Extract protocol-agnostic SyncobjManager from Intel to shared src/drivers/syncobj.rs — syncobj create/destroy/signal/reset/ wait/query and sync_file fd export/import. Wire both into VirtioDriver: - Add FenceTimeline + SyncobjManager fields - Implement all 5 GpuDriver syncobj trait methods (create, destroy, wait, export_fd, import_fd) - Track fence seqnos in virgl_submit_3d (allocate before submit, signal after completion) Intel fence.rs and syncobj.rs converted to thin re-export modules pointing at shared sources — no behavioral change for Intel driver. This gives Mesa VIRGL userspace the standard DRM syncobj API for GPU/compositor synchronization.
33 lines
983 B
Python
33 lines
983 B
Python
# coding: utf-8
|
|
|
|
import unittest
|
|
|
|
import magic
|
|
|
|
|
|
class MagicTestCase(unittest.TestCase):
|
|
|
|
filename = 'magic.py'
|
|
expected_mime_type = 'text/x-script.python'
|
|
expected_encoding = 'us-ascii'
|
|
expected_name = 'Python script, ASCII text executable'
|
|
|
|
def assert_result(self, result):
|
|
self.assertEqual(result.mime_type, self.expected_mime_type)
|
|
self.assertEqual(result.encoding, self.expected_encoding)
|
|
self.assertEqual(result.name, self.expected_name)
|
|
|
|
def test_detect_from_filename(self):
|
|
result = magic.detect_from_filename(self.filename)
|
|
self.assert_result(result)
|
|
|
|
def test_detect_from_fobj(self):
|
|
with open(self.filename, "rb") as fobj:
|
|
result = magic.detect_from_fobj(fobj)
|
|
self.assert_result(result)
|
|
|
|
def test_detect_from_content(self):
|
|
with open(self.filename, "rb") as fobj:
|
|
result = magic.detect_from_content(fobj.read(8192))
|
|
self.assert_result(result)
|