From 2561756313fd94ca49b819e16a4345b8671f9f0f Mon Sep 17 00:00:00 2001 From: Drew Short Date: Fri, 8 Jan 2016 11:33:15 -0600 Subject: [PATCH] Updating the ffi py test to work on windows --- FFI-tests/ffi_test.py | 28 ++++++++++++++++++---------- FFI-tests/test_images | 1 - 2 files changed, 18 insertions(+), 11 deletions(-) delete mode 120000 FFI-tests/test_images diff --git a/FFI-tests/ffi_test.py b/FFI-tests/ffi_test.py index 382f9d7..c7c9f76 100755 --- a/FFI-tests/ffi_test.py +++ b/FFI-tests/ffi_test.py @@ -1,18 +1,19 @@ #!/usr/bin/env python3 from ctypes import * +import os -large_image1_path = "test_images/sample_01_large.jpg".encode(encoding="utf-8") -medium_image1_path = "test_images/sample_01_medium.jpg".encode(encoding="utf-8") -small_image1_path = "test_images/sample_01_small.jpg".encode(encoding="utf-8") +large_image1_path = "../test_images/sample_01_large.jpg".encode(encoding="utf-8") +medium_image1_path = "../test_images/sample_01_medium.jpg".encode(encoding="utf-8") +small_image1_path = "../test_images/sample_01_small.jpg".encode(encoding="utf-8") -large_image2_path = "test_images/sample_02_large.jpg".encode(encoding="utf-8") -medium_image2_path = "test_images/sample_02_medium.jpg".encode(encoding="utf-8") -small_image2_path = "test_images/sample_02_small.jpg".encode(encoding="utf-8") +large_image2_path = "../test_images/sample_02_large.jpg".encode(encoding="utf-8") +medium_image2_path = "../test_images/sample_02_medium.jpg".encode(encoding="utf-8") +small_image2_path = "../test_images/sample_02_small.jpg".encode(encoding="utf-8") -large_image3_path = "test_images/sample_03_large.jpg".encode(encoding="utf-8") -medium_image3_path = "test_images/sample_03_medium.jpg".encode(encoding="utf-8") -small_image3_path = "test_images/sample_03_small.jpg".encode(encoding="utf-8") +large_image3_path = "../test_images/sample_03_large.jpg".encode(encoding="utf-8") +medium_image3_path = "../test_images/sample_03_medium.jpg".encode(encoding="utf-8") +small_image3_path = "../test_images/sample_03_small.jpg".encode(encoding="utf-8") test_images=[large_image1_path, medium_image1_path, small_image1_path,large_image2_path, medium_image2_path, small_image2_path,large_image3_path, medium_image3_path, small_image3_path] @@ -22,7 +23,14 @@ def unsigned64(number): print("starting ffi test") # Load the shared library -lib = cdll.LoadLibrary("libpihash.so") +lib = None +if os.name == 'nt': + path = os.path.dirname(__file__) + "\\pihash.dll" + print(path) + lib = CDLL(path) +else: + lib = cdll.LoadLibrary("libpihash.so") + # Setting the ctypes return type references for the foreign functions lib.ext_get_ahash.restype = c_ulonglong diff --git a/FFI-tests/test_images b/FFI-tests/test_images deleted file mode 120000 index 5d6c29c..0000000 --- a/FFI-tests/test_images +++ /dev/null @@ -1 +0,0 @@ -../test_images \ No newline at end of file