aboutsummaryrefslogtreecommitdiff
path: root/support/testing
diff options
context:
space:
mode:
Diffstat (limited to 'support/testing')
-rwxr-xr-xsupport/testing/tests/package/copy-sample-script-to-target.sh7
-rw-r--r--support/testing/tests/package/sample_python_argh.py10
-rw-r--r--support/testing/tests/package/sample_python_attrs.py15
-rw-r--r--support/testing/tests/package/sample_python_autobahn.py1
-rw-r--r--support/testing/tests/package/sample_python_automat.py27
-rw-r--r--support/testing/tests/package/sample_python_bitstring.py6
-rw-r--r--support/testing/tests/package/sample_python_cbor_dec.py10
-rw-r--r--support/testing/tests/package/sample_python_cbor_enc.py14
-rw-r--r--support/testing/tests/package/sample_python_click.py12
-rw-r--r--support/testing/tests/package/sample_python_constantly.py19
-rw-r--r--support/testing/tests/package/sample_python_crossbar.py3
-rw-r--r--support/testing/tests/package/sample_python_cryptography.py3
-rw-r--r--support/testing/tests/package/sample_python_incremental.py3
-rw-r--r--support/testing/tests/package/sample_python_passlib.py5
-rw-r--r--support/testing/tests/package/sample_python_pexpect.py8
-rw-r--r--support/testing/tests/package/sample_python_pynacl.py3
-rw-r--r--support/testing/tests/package/sample_python_pyyaml_dec.py10
-rw-r--r--support/testing/tests/package/sample_python_pyyaml_enc.py14
-rw-r--r--support/testing/tests/package/sample_python_service_identity.py2
-rw-r--r--support/testing/tests/package/sample_python_subprocess32.py6
-rw-r--r--support/testing/tests/package/sample_python_treq.py16
-rw-r--r--support/testing/tests/package/sample_python_twisted.py9
-rw-r--r--support/testing/tests/package/sample_python_txaio_asyncio.py3
-rw-r--r--support/testing/tests/package/sample_python_txaio_twisted.py3
-rw-r--r--support/testing/tests/package/sample_python_txtorcon.py1
-rw-r--r--support/testing/tests/package/sample_python_ubjson_dec.py10
-rw-r--r--support/testing/tests/package/sample_python_ubjson_enc.py14
-rw-r--r--support/testing/tests/package/test_python.py56
-rw-r--r--support/testing/tests/package/test_python_argh.py45
-rw-r--r--support/testing/tests/package/test_python_attrs.py21
-rw-r--r--support/testing/tests/package/test_python_autobahn.py29
-rw-r--r--support/testing/tests/package/test_python_automat.py23
-rw-r--r--support/testing/tests/package/test_python_bitstring.py21
-rw-r--r--support/testing/tests/package/test_python_cbor.py23
-rw-r--r--support/testing/tests/package/test_python_click.py44
-rw-r--r--support/testing/tests/package/test_python_constantly.py21
-rw-r--r--support/testing/tests/package/test_python_crossbar.py14
-rw-r--r--support/testing/tests/package/test_python_cryptography.py33
-rw-r--r--support/testing/tests/package/test_python_incremental.py33
-rw-r--r--support/testing/tests/package/test_python_passlib.py23
-rw-r--r--support/testing/tests/package/test_python_pexpect.py21
-rw-r--r--support/testing/tests/package/test_python_pynacl.py27
-rw-r--r--support/testing/tests/package/test_python_pyyaml.py23
-rw-r--r--support/testing/tests/package/test_python_service_identity.py23
-rw-r--r--support/testing/tests/package/test_python_subprocess32.py11
-rw-r--r--support/testing/tests/package/test_python_treq.py29
-rw-r--r--support/testing/tests/package/test_python_twisted.py35
-rw-r--r--support/testing/tests/package/test_python_txaio.py30
-rw-r--r--support/testing/tests/package/test_python_txtorcon.py31
-rw-r--r--support/testing/tests/package/test_python_ubjson.py23
-rw-r--r--support/testing/tests/package/test_rust.py78
51 files changed, 782 insertions, 169 deletions
diff --git a/support/testing/tests/package/copy-sample-script-to-target.sh b/support/testing/tests/package/copy-sample-script-to-target.sh
new file mode 100755
index 0000000000..6448a80d6d
--- /dev/null
+++ b/support/testing/tests/package/copy-sample-script-to-target.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+
+shift
+for file in "$@"; do
+ cp -f "${file}" "${TARGET_DIR}/root/"
+done
diff --git a/support/testing/tests/package/sample_python_argh.py b/support/testing/tests/package/sample_python_argh.py
new file mode 100644
index 0000000000..48247bf604
--- /dev/null
+++ b/support/testing/tests/package/sample_python_argh.py
@@ -0,0 +1,10 @@
+import argh
+
+
+@argh.arg("foo", help="help for foo")
+@argh.arg("--bar", help="help for bar")
+def main(foo, bar=False):
+ print("{}, {}".format(foo, bar))
+
+
+argh.dispatch_command(main)
diff --git a/support/testing/tests/package/sample_python_attrs.py b/support/testing/tests/package/sample_python_attrs.py
new file mode 100644
index 0000000000..f224944914
--- /dev/null
+++ b/support/testing/tests/package/sample_python_attrs.py
@@ -0,0 +1,15 @@
+import attr
+
+
+@attr.s
+class Obj(object):
+ x = attr.ib()
+ y = attr.ib(default=1)
+
+
+obj1 = Obj(2)
+assert(obj1.x == 2)
+assert(obj1.y == 1)
+obj2 = Obj(3, 4)
+assert(obj2.x == 3)
+assert(obj2.y == 4)
diff --git a/support/testing/tests/package/sample_python_autobahn.py b/support/testing/tests/package/sample_python_autobahn.py
new file mode 100644
index 0000000000..8189b6a6b3
--- /dev/null
+++ b/support/testing/tests/package/sample_python_autobahn.py
@@ -0,0 +1 @@
+import autobahn.wamp # noqa
diff --git a/support/testing/tests/package/sample_python_automat.py b/support/testing/tests/package/sample_python_automat.py
new file mode 100644
index 0000000000..baf536f993
--- /dev/null
+++ b/support/testing/tests/package/sample_python_automat.py
@@ -0,0 +1,27 @@
+from automat import MethodicalMachine
+
+
+class Led(object):
+ _machine = MethodicalMachine()
+
+ @_machine.state()
+ def led_on(self):
+ "led is on"
+
+ @_machine.state(initial=True)
+ def led_off(self):
+ "led is off"
+
+ @_machine.input()
+ def turn_on(self):
+ "turn the led on"
+
+ @_machine.output()
+ def _light(self):
+ print("light")
+
+ led_off.upon(turn_on, enter=led_on, outputs=[_light])
+
+
+led = Led()
+led.turn_on()
diff --git a/support/testing/tests/package/sample_python_bitstring.py b/support/testing/tests/package/sample_python_bitstring.py
new file mode 100644
index 0000000000..2cc10dba65
--- /dev/null
+++ b/support/testing/tests/package/sample_python_bitstring.py
@@ -0,0 +1,6 @@
+import bitstring
+
+value = bitstring.BitArray("uint:12=42")
+assert(value.hex == "02a")
+assert(value.bin == "000000101010")
+assert(value.uint == 42)
diff --git a/support/testing/tests/package/sample_python_cbor_dec.py b/support/testing/tests/package/sample_python_cbor_dec.py
new file mode 100644
index 0000000000..5ca5e3aa7c
--- /dev/null
+++ b/support/testing/tests/package/sample_python_cbor_dec.py
@@ -0,0 +1,10 @@
+import cbor
+
+with open("/tmp/data.cbor", "rb") as f:
+ serialized = f.read()
+data = cbor.loads(serialized)
+print(data)
+assert(data["name"] == "python-cbor")
+assert(data["versions"] == ["1", "2"])
+assert(data["group"]["is_a_package"] is True)
+assert(data["group"]["value"] == 42)
diff --git a/support/testing/tests/package/sample_python_cbor_enc.py b/support/testing/tests/package/sample_python_cbor_enc.py
new file mode 100644
index 0000000000..1bde92bb9f
--- /dev/null
+++ b/support/testing/tests/package/sample_python_cbor_enc.py
@@ -0,0 +1,14 @@
+import cbor
+
+data = {
+ "name": "python-cbor",
+ "versions": ["1", "2"],
+ "group": {
+ "is_a_package": True,
+ "value": 42
+ }
+}
+serialized = cbor.dumps(data)
+print(serialized)
+with open("/tmp/data.cbor", "wb") as f:
+ f.write(serialized)
diff --git a/support/testing/tests/package/sample_python_click.py b/support/testing/tests/package/sample_python_click.py
new file mode 100644
index 0000000000..759868d087
--- /dev/null
+++ b/support/testing/tests/package/sample_python_click.py
@@ -0,0 +1,12 @@
+import click
+
+
+@click.command()
+@click.argument("foo")
+@click.option("--bar", is_flag=True, help="help for bar")
+def main(foo, bar):
+ click.echo("{}, {}".format(foo, bar))
+
+
+if __name__ == '__main__':
+ main()
diff --git a/support/testing/tests/package/sample_python_constantly.py b/support/testing/tests/package/sample_python_constantly.py
new file mode 100644
index 0000000000..570cf85b23
--- /dev/null
+++ b/support/testing/tests/package/sample_python_constantly.py
@@ -0,0 +1,19 @@
+from constantly import ValueConstant, Values
+
+
+class RESULT(Values):
+ OK = ValueConstant(0)
+ FAIL = ValueConstant(-1)
+
+ @classmethod
+ def get(cls, rc):
+ if rc == 0:
+ return cls.OK
+ else:
+ return cls.FAIL
+
+
+print(list(RESULT.iterconstants()))
+assert(RESULT.OK < RESULT.FAIL)
+assert(RESULT.OK.value > RESULT.FAIL.value)
+assert(RESULT.get(-5) == RESULT.FAIL)
diff --git a/support/testing/tests/package/sample_python_crossbar.py b/support/testing/tests/package/sample_python_crossbar.py
new file mode 100644
index 0000000000..3695fe92c0
--- /dev/null
+++ b/support/testing/tests/package/sample_python_crossbar.py
@@ -0,0 +1,3 @@
+import crossbar
+
+crossbar.run(["version"])
diff --git a/support/testing/tests/package/sample_python_cryptography.py b/support/testing/tests/package/sample_python_cryptography.py
new file mode 100644
index 0000000000..ec9883dc64
--- /dev/null
+++ b/support/testing/tests/package/sample_python_cryptography.py
@@ -0,0 +1,3 @@
+from cryptography.fernet import Fernet
+key = Fernet.generate_key()
+f = Fernet(key)
diff --git a/support/testing/tests/package/sample_python_incremental.py b/support/testing/tests/package/sample_python_incremental.py
new file mode 100644
index 0000000000..b6e2aa803c
--- /dev/null
+++ b/support/testing/tests/package/sample_python_incremental.py
@@ -0,0 +1,3 @@
+import incremental
+v = incremental.Version("package", 1, 2, 3, release_candidate=4)
+assert(str(v) == "[package, version 1.2.3rc4]")
diff --git a/support/testing/tests/package/sample_python_passlib.py b/support/testing/tests/package/sample_python_passlib.py
new file mode 100644
index 0000000000..3ab348b9e4
--- /dev/null
+++ b/support/testing/tests/package/sample_python_passlib.py
@@ -0,0 +1,5 @@
+from passlib.hash import pbkdf2_sha256
+
+hash = pbkdf2_sha256.hash("password")
+assert(pbkdf2_sha256.verify("passWord", hash) is False)
+assert(pbkdf2_sha256.verify("password", hash) is True)
diff --git a/support/testing/tests/package/sample_python_pexpect.py b/support/testing/tests/package/sample_python_pexpect.py
new file mode 100644
index 0000000000..cfe395fc29
--- /dev/null
+++ b/support/testing/tests/package/sample_python_pexpect.py
@@ -0,0 +1,8 @@
+import pexpect
+
+p = pexpect.spawn(["login"])
+p.expect("login:")
+p.sendline("wrong")
+p.expect("Password:")
+p.sendline("wrong")
+p.expect("Login incorrect")
diff --git a/support/testing/tests/package/sample_python_pynacl.py b/support/testing/tests/package/sample_python_pynacl.py
new file mode 100644
index 0000000000..d17c50ebe5
--- /dev/null
+++ b/support/testing/tests/package/sample_python_pynacl.py
@@ -0,0 +1,3 @@
+import nacl.utils
+
+nonce = nacl.utils.random(16)
diff --git a/support/testing/tests/package/sample_python_pyyaml_dec.py b/support/testing/tests/package/sample_python_pyyaml_dec.py
new file mode 100644
index 0000000000..9ab8931197
--- /dev/null
+++ b/support/testing/tests/package/sample_python_pyyaml_dec.py
@@ -0,0 +1,10 @@
+import yaml
+
+with open("/tmp/data.yml", "rb") as f:
+ serialized = f.read()
+data = yaml.load(serialized)
+print(data)
+assert(data["name"] == "python-pyyaml")
+assert(data["versions"] == ["1", "2"])
+assert(data["group"]["is_a_package"] is True)
+assert(data["group"]["value"] == 42)
diff --git a/support/testing/tests/package/sample_python_pyyaml_enc.py b/support/testing/tests/package/sample_python_pyyaml_enc.py
new file mode 100644
index 0000000000..30759949e2
--- /dev/null
+++ b/support/testing/tests/package/sample_python_pyyaml_enc.py
@@ -0,0 +1,14 @@
+import yaml
+
+data = {
+ "name": "python-pyyaml",
+ "versions": ["1", "2"],
+ "group": {
+ "is_a_package": True,
+ "value": 42
+ }
+}
+serialized = yaml.dump(data, default_flow_style=False)
+print(serialized)
+with open("/tmp/data.yml", "w") as f:
+ f.write(serialized)
diff --git a/support/testing/tests/package/sample_python_service_identity.py b/support/testing/tests/package/sample_python_service_identity.py
new file mode 100644
index 0000000000..3184b6c580
--- /dev/null
+++ b/support/testing/tests/package/sample_python_service_identity.py
@@ -0,0 +1,2 @@
+from service_identity import VerificationError # noqa
+from service_identity.pyopenssl import verify_hostname # noqa
diff --git a/support/testing/tests/package/sample_python_subprocess32.py b/support/testing/tests/package/sample_python_subprocess32.py
new file mode 100644
index 0000000000..8579745cc8
--- /dev/null
+++ b/support/testing/tests/package/sample_python_subprocess32.py
@@ -0,0 +1,6 @@
+import subprocess32
+
+output = subprocess32.check_output(["ls", "-l", "/dev/null"])
+print(output)
+assert("/dev/null" in output)
+assert("No such" not in output)
diff --git a/support/testing/tests/package/sample_python_treq.py b/support/testing/tests/package/sample_python_treq.py
new file mode 100644
index 0000000000..974fdcd8e1
--- /dev/null
+++ b/support/testing/tests/package/sample_python_treq.py
@@ -0,0 +1,16 @@
+from twisted.internet import reactor
+import treq
+
+
+def done(response):
+ print(response.code)
+ reactor.stop()
+
+
+def err(fail):
+ print(fail.value)
+ reactor.stop()
+
+
+treq.get("https://localhost").addCallback(done).addErrback(err)
+reactor.run()
diff --git a/support/testing/tests/package/sample_python_twisted.py b/support/testing/tests/package/sample_python_twisted.py
new file mode 100644
index 0000000000..47d6c5debc
--- /dev/null
+++ b/support/testing/tests/package/sample_python_twisted.py
@@ -0,0 +1,9 @@
+from twisted.internet import protocol, reactor, endpoints
+
+
+class F(protocol.Factory):
+ pass
+
+
+endpoints.serverFromString(reactor, "tcp:1234").listen(F())
+reactor.run()
diff --git a/support/testing/tests/package/sample_python_txaio_asyncio.py b/support/testing/tests/package/sample_python_txaio_asyncio.py
new file mode 100644
index 0000000000..77f11ed807
--- /dev/null
+++ b/support/testing/tests/package/sample_python_txaio_asyncio.py
@@ -0,0 +1,3 @@
+import txaio
+txaio.use_asyncio()
+f0 = txaio.create_future()
diff --git a/support/testing/tests/package/sample_python_txaio_twisted.py b/support/testing/tests/package/sample_python_txaio_twisted.py
new file mode 100644
index 0000000000..13ea82a961
--- /dev/null
+++ b/support/testing/tests/package/sample_python_txaio_twisted.py
@@ -0,0 +1,3 @@
+import txaio
+txaio.use_twisted()
+f0 = txaio.create_future()
diff --git a/support/testing/tests/package/sample_python_txtorcon.py b/support/testing/tests/package/sample_python_txtorcon.py
new file mode 100644
index 0000000000..c4a2ae6f5b
--- /dev/null
+++ b/support/testing/tests/package/sample_python_txtorcon.py
@@ -0,0 +1 @@
+import txtorcon # noqa
diff --git a/support/testing/tests/package/sample_python_ubjson_dec.py b/support/testing/tests/package/sample_python_ubjson_dec.py
new file mode 100644
index 0000000000..12ccdfd587
--- /dev/null
+++ b/support/testing/tests/package/sample_python_ubjson_dec.py
@@ -0,0 +1,10 @@
+import ubjson
+
+with open("/tmp/data.json", "rb") as f:
+ serialized = f.read()
+data = ubjson.loadb(serialized)
+print(data)
+assert(data["name"] == "python-ubjson")
+assert(data["versions"] == ["1", "2"])
+assert(data["group"]["is_a_package"] is True)
+assert(data["group"]["value"] == 42)
diff --git a/support/testing/tests/package/sample_python_ubjson_enc.py b/support/testing/tests/package/sample_python_ubjson_enc.py
new file mode 100644
index 0000000000..9a2140ef85
--- /dev/null
+++ b/support/testing/tests/package/sample_python_ubjson_enc.py
@@ -0,0 +1,14 @@
+import ubjson
+
+data = {
+ "name": "python-ubjson",
+ "versions": ["1", "2"],
+ "group": {
+ "is_a_package": True,
+ "value": 42
+ }
+}
+serialized = ubjson.dumpb(data)
+print(serialized)
+with open("/tmp/data.json", "wb") as f:
+ f.write(serialized)
diff --git a/support/testing/tests/package/test_python.py b/support/testing/tests/package/test_python.py
index 26cf49947b..c422bdbf50 100644
--- a/support/testing/tests/package/test_python.py
+++ b/support/testing/tests/package/test_python.py
@@ -68,3 +68,59 @@ class TestPython3(TestPythonBase):
self.math_floor_test()
self.libc_time_test()
self.zlib_test()
+
+
+class TestPythonPackageBase(TestPythonBase):
+ """Common class to test a python package.
+
+ Build an image containing the scripts listed in sample_scripts, start the
+ emulator, login to it and for each sample script in the image run the python
+ interpreter passing the name of the script and check the status code is 0.
+
+ Each test case that inherits from this class must have:
+ __test__ = True - to let nose2 know that it is a test case
+ config - defconfig fragment with the packages to run the test
+ It also can have:
+ sample_scripts - list of scripts to add to the image and run on the target
+ timeout - timeout to the script to run when the default from the
+ test infra is not enough
+ When custom commands need be issued on the target the method
+ run_sample_scripts can be overridden.
+ """
+
+ __test__ = False
+ config_sample_scripts = \
+ """
+ BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
+ BR2_ROOTFS_POST_SCRIPT_ARGS="{}"
+ """.format(infra.filepath("tests/package/copy-sample-script-to-target.sh"),
+ "{sample_scripts}")
+ sample_scripts = None
+ timeout = -1
+
+ def __init__(self, names):
+ """Add the scripts to the target in build time."""
+ super(TestPythonPackageBase, self).__init__(names)
+ if self.sample_scripts:
+ scripts = [infra.filepath(s) for s in self.sample_scripts]
+ self.config += self.config_sample_scripts.format(sample_scripts=" ".join(scripts))
+
+ def check_sample_scripts_exist(self):
+ """Check the scripts were really added to the image."""
+ scripts = [os.path.basename(s) for s in self.sample_scripts]
+ cmd = "md5sum " + " ".join(scripts)
+ _, exit_code = self.emulator.run(cmd)
+ self.assertEqual(exit_code, 0)
+
+ def run_sample_scripts(self):
+ """Run each script previously added to the image."""
+ for script in self.sample_scripts:
+ cmd = self.interpreter + " " + os.path.basename(script)
+ _, exit_code = self.emulator.run(cmd, timeout=self.timeout)
+ self.assertEqual(exit_code, 0)
+
+ def test_run(self):
+ """Test a python package."""
+ self.login()
+ self.check_sample_scripts_exist()
+ self.run_sample_scripts()
diff --git a/support/testing/tests/package/test_python_argh.py b/support/testing/tests/package/test_python_argh.py
new file mode 100644
index 0000000000..de4b4cbe74
--- /dev/null
+++ b/support/testing/tests/package/test_python_argh.py
@@ -0,0 +1,45 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonArgh(TestPythonPackageBase):
+ config = TestPythonPackageBase.config
+ sample_scripts = ["tests/package/sample_python_argh.py"]
+
+ def run_sample_scripts(self):
+ cmd = self.interpreter + " sample_python_argh.py -h"
+ output, exit_code = self.emulator.run(cmd)
+ self.assertIn("usage:", output[0])
+ self.assertEqual(exit_code, 0)
+
+ cmd = self.interpreter + " sample_python_argh.py 123"
+ output, exit_code = self.emulator.run(cmd)
+ self.assertEqual(output[0], "123, False")
+ self.assertEqual(exit_code, 0)
+
+ cmd = self.interpreter + " sample_python_argh.py --bar 456"
+ output, exit_code = self.emulator.run(cmd)
+ self.assertEqual(output[0], "456, True")
+ self.assertEqual(exit_code, 0)
+
+ cmd = self.interpreter + " sample_python_argh.py"
+ output, exit_code = self.emulator.run(cmd)
+ self.assertIn("usage:", output[0])
+ self.assertEqual(exit_code, 2)
+
+
+class TestPythonPy2Argh(TestPythonArgh):
+ __test__ = True
+ config = TestPythonArgh.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_ARGH=y
+ """
+
+
+class TestPythonPy3Argh(TestPythonArgh):
+ __test__ = True
+ config = TestPythonArgh.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_ARGH=y
+ """
diff --git a/support/testing/tests/package/test_python_attrs.py b/support/testing/tests/package/test_python_attrs.py
new file mode 100644
index 0000000000..9f597034ae
--- /dev/null
+++ b/support/testing/tests/package/test_python_attrs.py
@@ -0,0 +1,21 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Attrs(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_ATTRS=y
+ """
+ sample_scripts = ["tests/package/sample_python_attrs.py"]
+
+
+class TestPythonPy3Attrs(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_ATTRS=y
+ """
+ sample_scripts = ["tests/package/sample_python_attrs.py"]
diff --git a/support/testing/tests/package/test_python_autobahn.py b/support/testing/tests/package/test_python_autobahn.py
index 2bc0f0cccf..af1f617d6d 100644
--- a/support/testing/tests/package/test_python_autobahn.py
+++ b/support/testing/tests/package/test_python_autobahn.py
@@ -1,32 +1,21 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonPackageBase
-class TestPythonAutobahn(TestPythonBase):
- def import_test(self):
- cmd = self.interpreter + " -c 'import autobahn.wamp'"
- _, exit_code = self.emulator.run(cmd)
- self.assertEqual(exit_code, 0)
-
-
-class TestPythonPy2Autobahn(TestPythonAutobahn):
- config = TestPythonBase.config + \
+class TestPythonPy2Autobahn(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_AUTOBAHN=y
"""
+ sample_scripts = ["tests/package/sample_python_autobahn.py"]
- def test_run(self):
- self.login()
- self.import_test()
-
-class TestPythonPy3Autobahn(TestPythonAutobahn):
- config = TestPythonBase.config + \
+class TestPythonPy3Autobahn(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_AUTOBAHN=y
"""
-
- def test_run(self):
- self.login()
- self.import_test()
+ sample_scripts = ["tests/package/sample_python_autobahn.py"]
diff --git a/support/testing/tests/package/test_python_automat.py b/support/testing/tests/package/test_python_automat.py
new file mode 100644
index 0000000000..00a7ed6526
--- /dev/null
+++ b/support/testing/tests/package/test_python_automat.py
@@ -0,0 +1,23 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Automat(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_AUTOMAT=y
+ """
+ sample_scripts = ["tests/package/sample_python_automat.py"]
+ timeout = 30
+
+
+class TestPythonPy3Automat(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_AUTOMAT=y
+ """
+ sample_scripts = ["tests/package/sample_python_automat.py"]
+ timeout = 30
diff --git a/support/testing/tests/package/test_python_bitstring.py b/support/testing/tests/package/test_python_bitstring.py
new file mode 100644
index 0000000000..63b3fdb69c
--- /dev/null
+++ b/support/testing/tests/package/test_python_bitstring.py
@@ -0,0 +1,21 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Bitstring(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_BITSTRING=y
+ """
+ sample_scripts = ["tests/package/sample_python_bitstring.py"]
+
+
+class TestPythonPy3Bitstring(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_BITSTRING=y
+ """
+ sample_scripts = ["tests/package/sample_python_bitstring.py"]
diff --git a/support/testing/tests/package/test_python_cbor.py b/support/testing/tests/package/test_python_cbor.py
new file mode 100644
index 0000000000..9da3503763
--- /dev/null
+++ b/support/testing/tests/package/test_python_cbor.py
@@ -0,0 +1,23 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Cbor(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_CBOR=y
+ """
+ sample_scripts = ["tests/package/sample_python_cbor_enc.py",
+ "tests/package/sample_python_cbor_dec.py"]
+
+
+class TestPythonPy3Cbor(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_CBOR=y
+ """
+ sample_scripts = ["tests/package/sample_python_cbor_enc.py",
+ "tests/package/sample_python_cbor_dec.py"]
diff --git a/support/testing/tests/package/test_python_click.py b/support/testing/tests/package/test_python_click.py
new file mode 100644
index 0000000000..db57d3aa9f
--- /dev/null
+++ b/support/testing/tests/package/test_python_click.py
@@ -0,0 +1,44 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonClick(TestPythonPackageBase):
+ sample_scripts = ["tests/package/sample_python_click.py"]
+
+ def run_sample_scripts(self):
+ cmd = self.interpreter + " sample_python_click.py --help"
+ output, exit_code = self.emulator.run(cmd)
+ self.assertIn("Usage:", output[0])
+ self.assertEqual(exit_code, 0)
+
+ cmd = self.interpreter + " sample_python_click.py 123"
+ output, exit_code = self.emulator.run(cmd)
+ self.assertEqual(output[0], "123, False")
+ self.assertEqual(exit_code, 0)
+
+ cmd = self.interpreter + " sample_python_click.py --bar 456"
+ output, exit_code = self.emulator.run(cmd)
+ self.assertEqual(output[0], "456, True")
+ self.assertEqual(exit_code, 0)
+
+ cmd = self.interpreter + " sample_python_click.py"
+ output, exit_code = self.emulator.run(cmd)
+ self.assertIn("Usage:", output[0])
+ self.assertEqual(exit_code, 2)
+
+
+class TestPythonPy2Click(TestPythonClick):
+ __test__ = True
+ config = TestPythonClick.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_CLICK=y
+ """
+
+
+class TestPythonPy3Click(TestPythonClick):
+ __test__ = True
+ config = TestPythonClick.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_CLICK=y
+ """
diff --git a/support/testing/tests/package/test_python_constantly.py b/support/testing/tests/package/test_python_constantly.py
new file mode 100644
index 0000000000..5be01c4f8c
--- /dev/null
+++ b/support/testing/tests/package/test_python_constantly.py
@@ -0,0 +1,21 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Constantly(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_CONSTANTLY=y
+ """
+ sample_scripts = ["tests/package/sample_python_constantly.py"]
+
+
+class TestPythonPy3Constantly(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_CONSTANTLY=y
+ """
+ sample_scripts = ["tests/package/sample_python_constantly.py"]
diff --git a/support/testing/tests/package/test_python_crossbar.py b/support/testing/tests/package/test_python_crossbar.py
new file mode 100644
index 0000000000..2d7b739b5c
--- /dev/null
+++ b/support/testing/tests/package/test_python_crossbar.py
@@ -0,0 +1,14 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3Crossbar(TestPythonPackageBase):
+ __test__ = True
+ # use haveged to generate enough entropy so crossbar -> pynacl -> libsodium don't hang waiting for /dev/random
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_CROSSBAR=y
+ BR2_PACKAGE_HAVEGED=y
+ """
+ sample_scripts = ["tests/package/sample_python_crossbar.py"]
+ timeout = 60
diff --git a/support/testing/tests/package/test_python_cryptography.py b/support/testing/tests/package/test_python_cryptography.py
index 78c3ef55b3..14515fcd2d 100644
--- a/support/testing/tests/package/test_python_cryptography.py
+++ b/support/testing/tests/package/test_python_cryptography.py
@@ -1,34 +1,23 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonPackageBase
-class TestPythonCryptography(TestPythonBase):
- def fernet_test(self, timeout=-1):
- cmd = self.interpreter + " -c 'from cryptography.fernet import Fernet;"
- cmd += "key = Fernet.generate_key();"
- cmd += "f = Fernet(key)'"
- _, exit_code = self.emulator.run(cmd, timeout)
- self.assertEqual(exit_code, 0)
-
-
-class TestPythonPy2Cryptography(TestPythonCryptography):
- config = TestPythonBase.config + \
+class TestPythonPy2Cryptography(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y
"""
+ sample_scripts = ["tests/package/sample_python_cryptography.py"]
+ timeout = 40
- def test_run(self):
- self.login()
- self.fernet_test(40)
-
-class TestPythonPy3Cryptography(TestPythonCryptography):
- config = TestPythonBase.config + \
+class TestPythonPy3Cryptography(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y
"""
-
- def test_run(self):
- self.login()
- self.fernet_test(40)
+ sample_scripts = ["tests/package/sample_python_cryptography.py"]
+ timeout = 40
diff --git a/support/testing/tests/package/test_python_incremental.py b/support/testing/tests/package/test_python_incremental.py
index acf743cdd2..49800d8937 100644
--- a/support/testing/tests/package/test_python_incremental.py
+++ b/support/testing/tests/package/test_python_incremental.py
@@ -1,34 +1,23 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonPackageBase
-class TestPythonIncremental(TestPythonBase):
- def str_test(self):
- cmd = self.interpreter + " -c 'import incremental;"
- cmd += "v = incremental.Version(\"package\", 1, 2, 3, release_candidate=4);"
- cmd += "assert(str(v) == \"[package, version 1.2.3rc4]\")'"
- _, exit_code = self.emulator.run(cmd, timeout=30)
- self.assertEqual(exit_code, 0)
-
-
-class TestPythonPy2Incremental(TestPythonIncremental):
- config = TestPythonBase.config + \
+class TestPythonPy2Incremental(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_INCREMENTAL=y
"""
+ sample_scripts = ["tests/package/sample_python_incremental.py"]
+ timeout = 30
- def test_run(self):
- self.login()
- self.str_test()
-
-class TestPythonPy3Incremental(TestPythonIncremental):
- config = TestPythonBase.config + \
+class TestPythonPy3Incremental(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_INCREMENTAL=y
"""
-
- def test_run(self):
- self.login()
- self.str_test()
+ sample_scripts = ["tests/package/sample_python_incremental.py"]
+ timeout = 30
diff --git a/support/testing/tests/package/test_python_passlib.py b/support/testing/tests/package/test_python_passlib.py
new file mode 100644
index 0000000000..7c85882bf8
--- /dev/null
+++ b/support/testing/tests/package/test_python_passlib.py
@@ -0,0 +1,23 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Passlib(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_PASSLIB=y
+ """
+ sample_scripts = ["tests/package/sample_python_passlib.py"]
+ timeout = 30
+
+
+class TestPythonPy3Passlib(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_PASSLIB=y
+ """
+ sample_scripts = ["tests/package/sample_python_passlib.py"]
+ timeout = 30
diff --git a/support/testing/tests/package/test_python_pexpect.py b/support/testing/tests/package/test_python_pexpect.py
new file mode 100644
index 0000000000..ba31cdbdbe
--- /dev/null
+++ b/support/testing/tests/package/test_python_pexpect.py
@@ -0,0 +1,21 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Pexpect(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_PEXPECT=y
+ """
+ sample_scripts = ["tests/package/sample_python_pexpect.py"]
+
+
+class TestPythonPy3Pexpect(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_PEXPECT=y
+ """
+ sample_scripts = ["tests/package/sample_python_pexpect.py"]
diff --git a/support/testing/tests/package/test_python_pynacl.py b/support/testing/tests/package/test_python_pynacl.py
new file mode 100644
index 0000000000..729a887552
--- /dev/null
+++ b/support/testing/tests/package/test_python_pynacl.py
@@ -0,0 +1,27 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Pynacl(TestPythonPackageBase):
+ __test__ = True
+ # use haveged to generate enough entropy so pynacl -> libsodium don't hang waiting for /dev/random
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_PYNACL=y
+ BR2_PACKAGE_HAVEGED=y
+ """
+ sample_scripts = ["tests/package/sample_python_pynacl.py"]
+ timeout = 10
+
+
+class TestPythonPy3Pynacl(TestPythonPackageBase):
+ __test__ = True
+ # use haveged to generate enough entropy so pynacl -> libsodium don't hang waiting for /dev/random
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_PYNACL=y
+ BR2_PACKAGE_HAVEGED=y
+ """
+ sample_scripts = ["tests/package/sample_python_pynacl.py"]
+ timeout = 10
diff --git a/support/testing/tests/package/test_python_pyyaml.py b/support/testing/tests/package/test_python_pyyaml.py
new file mode 100644
index 0000000000..cd45a57b86
--- /dev/null
+++ b/support/testing/tests/package/test_python_pyyaml.py
@@ -0,0 +1,23 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Pyyaml(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_PYYAML=y
+ """
+ sample_scripts = ["tests/package/sample_python_pyyaml_enc.py",
+ "tests/package/sample_python_pyyaml_dec.py"]
+
+
+class TestPythonPy3Pyyaml(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_PYYAML=y
+ """
+ sample_scripts = ["tests/package/sample_python_pyyaml_enc.py",
+ "tests/package/sample_python_pyyaml_dec.py"]
diff --git a/support/testing/tests/package/test_python_service_identity.py b/support/testing/tests/package/test_python_service_identity.py
new file mode 100644
index 0000000000..6aeb77de8c
--- /dev/null
+++ b/support/testing/tests/package/test_python_service_identity.py
@@ -0,0 +1,23 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2ServiceIdentity(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_SERVICE_IDENTITY=y
+ """
+ sample_scripts = ["tests/package/sample_python_service_identity.py"]
+ timeout = 30
+
+
+class TestPythonPy3ServiceIdentity(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_SERVICE_IDENTITY=y
+ """
+ sample_scripts = ["tests/package/sample_python_service_identity.py"]
+ timeout = 30
diff --git a/support/testing/tests/package/test_python_subprocess32.py b/support/testing/tests/package/test_python_subprocess32.py
new file mode 100644
index 0000000000..d2878046d1
--- /dev/null
+++ b/support/testing/tests/package/test_python_subprocess32.py
@@ -0,0 +1,11 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Subprocess32(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_SUBPROCESS32=y
+ """
+ sample_scripts = ["tests/package/sample_python_subprocess32.py"]
diff --git a/support/testing/tests/package/test_python_treq.py b/support/testing/tests/package/test_python_treq.py
new file mode 100644
index 0000000000..7108b95696
--- /dev/null
+++ b/support/testing/tests/package/test_python_treq.py
@@ -0,0 +1,29 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonTreq(TestPythonPackageBase):
+ sample_scripts = ["tests/package/sample_python_treq.py"]
+
+ def run_sample_scripts(self):
+ cmd = self.interpreter + " sample_python_treq.py"
+ output, exit_code = self.emulator.run(cmd, timeout=20)
+ self.assertIn("Connection refused", output[0])
+ self.assertEqual(exit_code, 0)
+
+
+class TestPythonPy2Treq(TestPythonTreq):
+ __test__ = True
+ config = TestPythonTreq.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_TREQ=y
+ """
+
+
+class TestPythonPy3Treq(TestPythonTreq):
+ __test__ = True
+ config = TestPythonTreq.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_TREQ=y
+ """
diff --git a/support/testing/tests/package/test_python_twisted.py b/support/testing/tests/package/test_python_twisted.py
index ccee07d61d..a458ee45dd 100644
--- a/support/testing/tests/package/test_python_twisted.py
+++ b/support/testing/tests/package/test_python_twisted.py
@@ -1,25 +1,16 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonPackageBase
-TEST_SCRIPT = """
-from twisted.internet import protocol, reactor, endpoints
-class F(protocol.Factory):
- pass
-endpoints.serverFromString(reactor, "tcp:1234").listen(F())
-reactor.run()
-"""
+class TestPythonTwisted(TestPythonPackageBase):
+ config = TestPythonPackageBase.config
+ sample_scripts = ["tests/package/sample_python_twisted.py"]
-class TestPythonTwisted(TestPythonBase):
- def import_test(self):
- cmd = "printf '{}' > test.py".format(TEST_SCRIPT)
- _, exit_code = self.emulator.run(cmd)
- self.assertEqual(exit_code, 0)
-
+ def run_sample_scripts(self):
cmd = "netstat -ltn 2>/dev/null | grep 0.0.0.0:1234"
_, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 1)
- cmd = self.interpreter + " test.py &"
+ cmd = self.interpreter + " sample_python_twisted.py &"
# give some time to setup the server
cmd += "sleep 30"
_, exit_code = self.emulator.run(cmd, timeout=35)
@@ -31,24 +22,18 @@ class TestPythonTwisted(TestPythonBase):
class TestPythonPy2Twisted(TestPythonTwisted):
- config = TestPythonBase.config + \
+ __test__ = True
+ config = TestPythonTwisted.config + \
"""
BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_TWISTED=y
"""
- def test_run(self):
- self.login()
- self.import_test()
-
class TestPythonPy3Twisted(TestPythonTwisted):
- config = TestPythonBase.config + \
+ __test__ = True
+ config = TestPythonTwisted.config + \
"""
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_TWISTED=y
"""
-
- def test_run(self):
- self.login()
- self.import_test()
diff --git a/support/testing/tests/package/test_python_txaio.py b/support/testing/tests/package/test_python_txaio.py
index af93e031b5..7bff1bc23c 100644
--- a/support/testing/tests/package/test_python_txaio.py
+++ b/support/testing/tests/package/test_python_txaio.py
@@ -1,34 +1,22 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonPackageBase
-class TestPythonPy2Txaio(TestPythonBase):
- config = TestPythonBase.config + \
+class TestPythonPy2Txaio(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_TXAIO=y
BR2_PACKAGE_PYTHON_TWISTED=y
"""
+ sample_scripts = ["tests/package/sample_python_txaio_twisted.py"]
- def test_run(self):
- self.login()
- cmd = self.interpreter + " -c 'import txaio;"
- cmd += "txaio.use_twisted();"
- cmd += "f0 = txaio.create_future()'"
- _, exit_code = self.emulator.run(cmd)
- self.assertEqual(exit_code, 0)
-
-class TestPythonPy3Txaio(TestPythonBase):
- config = TestPythonBase.config + \
+class TestPythonPy3Txaio(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_TXAIO=y
"""
-
- def test_run(self):
- self.login()
- cmd = self.interpreter + " -c 'import txaio;"
- cmd += "txaio.use_asyncio();"
- cmd += "f0 = txaio.create_future()'"
- _, exit_code = self.emulator.run(cmd)
- self.assertEqual(exit_code, 0)
+ sample_scripts = ["tests/package/sample_python_txaio_asyncio.py"]
diff --git a/support/testing/tests/package/test_python_txtorcon.py b/support/testing/tests/package/test_python_txtorcon.py
index 352ff67825..1ac2f6919a 100644
--- a/support/testing/tests/package/test_python_txtorcon.py
+++ b/support/testing/tests/package/test_python_txtorcon.py
@@ -1,32 +1,23 @@
-from tests.package.test_python import TestPythonBase
+from tests.package.test_python import TestPythonPackageBase
-class TestPythonTxtorcon(TestPythonBase):
- def import_test(self):
- cmd = self.interpreter + " -c 'import txtorcon'"
- _, exit_code = self.emulator.run(cmd, timeout=30)
- self.assertEqual(exit_code, 0)
-
-
-class TestPythonPy2Txtorcon(TestPythonTxtorcon):
- config = TestPythonBase.config + \
+class TestPythonPy2Txtorcon(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_TXTORCON=y
"""
+ sample_scripts = ["tests/package/sample_python_txtorcon.py"]
+ timeout = 30
- def test_run(self):
- self.login()
- self.import_test()
-
-class TestPythonPy3Txtorcon(TestPythonTxtorcon):
- config = TestPythonBase.config + \
+class TestPythonPy3Txtorcon(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_TXTORCON=y
"""
-
- def test_run(self):
- self.login()
- self.import_test()
+ sample_scripts = ["tests/package/sample_python_txtorcon.py"]
+ timeout = 30
diff --git a/support/testing/tests/package/test_python_ubjson.py b/support/testing/tests/package/test_python_ubjson.py
new file mode 100644
index 0000000000..85c707e292
--- /dev/null
+++ b/support/testing/tests/package/test_python_ubjson.py
@@ -0,0 +1,23 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Ubjson(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON=y
+ BR2_PACKAGE_PYTHON_UBJSON=y
+ """
+ sample_scripts = ["tests/package/sample_python_ubjson_enc.py",
+ "tests/package/sample_python_ubjson_dec.py"]
+
+
+class TestPythonPy3Ubjson(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_UBJSON=y
+ """
+ sample_scripts = ["tests/package/sample_python_ubjson_enc.py",
+ "tests/package/sample_python_ubjson_dec.py"]
diff --git a/support/testing/tests/package/test_rust.py b/support/testing/tests/package/test_rust.py
index 2dc814f99d..9854c3692e 100644
--- a/support/testing/tests/package/test_rust.py
+++ b/support/testing/tests/package/test_rust.py
@@ -57,25 +57,25 @@ class TestRustBase(infra.basetest.BRTest):
class TestRustBin(TestRustBase):
config = \
- """
- BR2_arm=y
- BR2_cortex_a9=y
- BR2_ARM_ENABLE_NEON=y
- BR2_ARM_ENABLE_VFP=y
- BR2_TOOLCHAIN_EXTERNAL=y
- BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
- BR2_SYSTEM_DHCP="eth0"
- BR2_LINUX_KERNEL=y
- BR2_LINUX_KERNEL_CUSTOM_VERSION=y
- BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11.3"
- BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
- BR2_LINUX_KERNEL_DTS_SUPPORT=y
- BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
- BR2_TARGET_ROOTFS_CPIO=y
- # BR2_TARGET_ROOTFS_TAR is not set
- BR2_PACKAGE_HOST_CARGO=y
- BR2_PACKAGE_HOST_RUSTC=y
- """
+ """
+ BR2_arm=y
+ BR2_cortex_a9=y
+ BR2_ARM_ENABLE_NEON=y
+ BR2_ARM_ENABLE_VFP=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+ BR2_SYSTEM_DHCP="eth0"
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11.3"
+ BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
+ BR2_LINUX_KERNEL_DTS_SUPPORT=y
+ BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
+ BR2_TARGET_ROOTFS_CPIO=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ BR2_PACKAGE_HOST_CARGO=y
+ BR2_PACKAGE_HOST_RUSTC=y
+ """
def test_run(self):
self.build_test_prog()
@@ -86,26 +86,26 @@ class TestRustBin(TestRustBase):
class TestRust(TestRustBase):
config = \
- """
- BR2_arm=y
- BR2_cortex_a9=y
- BR2_ARM_ENABLE_NEON=y
- BR2_ARM_ENABLE_VFP=y
- BR2_TOOLCHAIN_EXTERNAL=y
- BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
- BR2_SYSTEM_DHCP="eth0"
- BR2_LINUX_KERNEL=y
- BR2_LINUX_KERNEL_CUSTOM_VERSION=y
- BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11.3"
- BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
- BR2_LINUX_KERNEL_DTS_SUPPORT=y
- BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
- BR2_TARGET_ROOTFS_CPIO=y
- # BR2_TARGET_ROOTFS_TAR is not set
- BR2_PACKAGE_HOST_CARGO=y
- BR2_PACKAGE_HOST_RUSTC=y
- BR2_PACKAGE_HOST_RUST=y
- """
+ """
+ BR2_arm=y
+ BR2_cortex_a9=y
+ BR2_ARM_ENABLE_NEON=y
+ BR2_ARM_ENABLE_VFP=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+ BR2_SYSTEM_DHCP="eth0"
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11.3"
+ BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
+ BR2_LINUX_KERNEL_DTS_SUPPORT=y
+ BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
+ BR2_TARGET_ROOTFS_CPIO=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ BR2_PACKAGE_HOST_CARGO=y
+ BR2_PACKAGE_HOST_RUSTC=y
+ BR2_PACKAGE_HOST_RUST=y
+ """
def test_run(self):
self.build_test_prog()