support/testing: add smmap2 test
authorAdam Duskett <Aduskett@gmail.com>
Fri, 29 Nov 2019 20:38:41 +0000 (12:38 -0800)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Mon, 16 Dec 2019 22:28:08 +0000 (23:28 +0100)
Add a simple test case that imports the module and instantiates a new
SlidingWindowMapManager class.

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
.gitlab-ci.yml
support/testing/tests/package/sample_python_smmap2.py [new file with mode: 0644]
support/testing/tests/package/test_python_smmap2.py [new file with mode: 0644]

index cf3382732ffbd5bd2130ff22a345305b78002f06..2337eff472cb0e96584ee3647f6043664744aac1 100644 (file)
@@ -463,6 +463,8 @@ tests.package.test_python_pyyaml.TestPythonPy2Pyyaml: { extends: .runtime_test }
 tests.package.test_python_pyyaml.TestPythonPy3Pyyaml: { extends: .runtime_test }
 tests.package.test_python_service_identity.TestPythonPy2ServiceIdentity: { extends: .runtime_test }
 tests.package.test_python_service_identity.TestPythonPy3ServiceIdentity: { extends: .runtime_test }
+tests.package.test_python_smmap2.TestPythonPy2Smmap2: { extends: .runtime_test }
+tests.package.test_python_smmap2.TestPythonPy3Smmap2: { extends: .runtime_test }
 tests.package.test_python_subprocess32.TestPythonPy2Subprocess32: { extends: .runtime_test }
 tests.package.test_python_treq.TestPythonPy2Treq: { extends: .runtime_test }
 tests.package.test_python_treq.TestPythonPy3Treq: { extends: .runtime_test }
diff --git a/support/testing/tests/package/sample_python_smmap2.py b/support/testing/tests/package/sample_python_smmap2.py
new file mode 100644 (file)
index 0000000..494fc26
--- /dev/null
@@ -0,0 +1,6 @@
+# Taken from smmap/test/test_tutorial.py
+
+import smmap
+mman = smmap.SlidingWindowMapManager()
+assert mman.num_file_handles() == 0
+assert mman.mapped_memory_size() == 0
diff --git a/support/testing/tests/package/test_python_smmap2.py b/support/testing/tests/package/test_python_smmap2.py
new file mode 100644 (file)
index 0000000..07c0e66
--- /dev/null
@@ -0,0 +1,21 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Smmap2(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON=y
+        BR2_PACKAGE_PYTHON_SMMAP2=y
+        """
+    sample_scripts = ["tests/package/sample_python_smmap2.py"]
+
+
+class TestPythonPy3Smmap2(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_SMMAP2=y
+        """
+    sample_scripts = ["tests/package/sample_python_smmap2.py"]