Skip to content

Commit

Permalink
Fix compat issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-mc committed Dec 13, 2024
1 parent 3ee9070 commit 7c8f4ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tests.benchmark import benchmark_ASM


@unittest.skipUnless(platform.win32_edition() is not None, "ASM only support Windows now.")
@unittest.skipUnless(platform.system() == "Windows", "ASM only support Windows now.")
class TestASM(unittest.TestCase):
@classmethod
def setUpClass(cls):
Expand Down
7 changes: 7 additions & 0 deletions tests/test_unsafe.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ctypes
import platform
import struct
import sys
import unittest
Expand Down Expand Up @@ -60,6 +61,7 @@ def test_set_and_get(self):
self.assertEqual(result, 3)
unsafe.free(ptr)

@unittest.skipUnless(platform.system() == "Windows", "ASM only support Windows now.")
def test_callVoid(self):
with ASM() as asm, Unsafe() as unsafe:
voidFunc = asm.makeFunction(self.ks.asm("ret", as_bytes=True)[0])
Expand All @@ -68,6 +70,7 @@ def test_callVoid(self):

asm.freeFunction(voidFunc)

@unittest.skipUnless(platform.system() == "Windows", "ASM only support Windows now.")
def test_callInt(self):
with ASM() as asm, Unsafe() as unsafe:
func = asm.makeFunction(self.ks.asm("mov eax, 123456; ret", as_bytes=True)[0])
Expand All @@ -76,6 +79,7 @@ def test_callInt(self):

asm.freeFunction(func)

@unittest.skipUnless(platform.system() == "Windows", "ASM only support Windows now.")
def test_callLongLong(self):
with ASM() as asm, Unsafe() as unsafe:
func = asm.makeFunction(self.ks.asm("mov rax, 12345678910; ret", as_bytes=True)[0])
Expand All @@ -84,6 +88,7 @@ def test_callLongLong(self):

asm.freeFunction(func)

@unittest.skipUnless(platform.system() == "Windows", "ASM only support Windows now.")
def test_callCall(self):
with ASM() as asm, Unsafe() as unsafe:
func = asm.makeFunction(self.ks.asm("mov rax, 12345678910; ret", as_bytes=True)[0])
Expand All @@ -95,6 +100,7 @@ def test_callCall(self):

asm.freeFunction(func)

@unittest.skipUnless(platform.system() == "Windows", "ASM only support Windows now.")
def test_call_16bytes(self):
with ASM() as asm, Unsafe() as unsafe:
funcRet16Bytes = asm.makeFunction(self.ks.asm("""
Expand All @@ -116,6 +122,7 @@ def test_call_16bytes(self):
asm.freeFunction(funcRet16Bytes)
asm.freeFunction(funcProxy)

@unittest.skipUnless(platform.system() == "Windows", "ASM only support Windows now.")
def test_call_size_zero(self):
with ASM() as asm, Unsafe() as unsafe:
voidFunc = asm.makeFunction(self.ks.asm("ret", as_bytes=True)[0])
Expand Down

0 comments on commit 7c8f4ee

Please sign in to comment.