Bump buildroot to 2019.02
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
shift
|
||||
for file in "$@"; do
|
||||
cp -f "${file}" "${TARGET_DIR}/root/"
|
||||
done
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -0,0 +1 @@
|
||||
import autobahn.wamp # noqa
|
||||
@@ -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()
|
||||
@@ -0,0 +1,6 @@
|
||||
import bitstring
|
||||
|
||||
value = bitstring.BitArray("uint:12=42")
|
||||
assert(value.hex == "02a")
|
||||
assert(value.bin == "000000101010")
|
||||
assert(value.uint == 42)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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()
|
||||
@@ -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)
|
||||
@@ -0,0 +1,3 @@
|
||||
import crossbar
|
||||
|
||||
crossbar.run(["version"])
|
||||
@@ -0,0 +1,3 @@
|
||||
from cryptography.fernet import Fernet
|
||||
key = Fernet.generate_key()
|
||||
f = Fernet(key)
|
||||
@@ -0,0 +1,3 @@
|
||||
import incremental
|
||||
v = incremental.Version("package", 1, 2, 3, release_candidate=4)
|
||||
assert(str(v) == "[package, version 1.2.3rc4]")
|
||||
@@ -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)
|
||||
@@ -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")
|
||||
@@ -0,0 +1,3 @@
|
||||
import nacl.utils
|
||||
|
||||
nonce = nacl.utils.random(16)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -0,0 +1,2 @@
|
||||
from service_identity import VerificationError # noqa
|
||||
from service_identity.pyopenssl import verify_hostname # noqa
|
||||
@@ -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)
|
||||
@@ -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()
|
||||
@@ -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()
|
||||
@@ -0,0 +1,3 @@
|
||||
import txaio
|
||||
txaio.use_asyncio()
|
||||
f0 = txaio.create_future()
|
||||
@@ -0,0 +1,3 @@
|
||||
import txaio
|
||||
txaio.use_twisted()
|
||||
f0 = txaio.create_future()
|
||||
@@ -0,0 +1 @@
|
||||
import txtorcon # noqa
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
40
bsp/buildroot/support/testing/tests/package/test_atop.py
Normal file
40
bsp/buildroot/support/testing/tests/package/test_atop.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestAtop(infra.basetest.BRTest):
|
||||
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.16.7"
|
||||
BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
|
||||
BR2_LINUX_KERNEL_DTS_SUPPORT=y
|
||||
BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
|
||||
BR2_PACKAGE_ATOP=y
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
kernel = os.path.join(self.builddir, "images", "zImage")
|
||||
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||
dtb = os.path.join(self.builddir, "images", "vexpress-v2p-ca9.dtb")
|
||||
self.emulator.boot(arch="armv7", kernel=kernel, options=["-initrd", cpio_file, "-M", "vexpress-a9", "-dtb", dtb])
|
||||
self.emulator.login()
|
||||
|
||||
cmd = "atop -V | grep '^Version'"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
cmd = "atop -a 1 2 | grep '% *atop *$'"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
@@ -0,0 +1,63 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestDockerCompose(infra.basetest.BRTest):
|
||||
config = \
|
||||
"""
|
||||
BR2_x86_64=y
|
||||
BR2_x86_core2=y
|
||||
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
|
||||
BR2_KERNEL_HEADERS_4_19=y
|
||||
BR2_SYSTEM_DHCP="eth0"
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="{}"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19"
|
||||
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="{}"
|
||||
BR2_PACKAGE_CA_CERTIFICATES=y
|
||||
BR2_PACKAGE_CGROUPFS_MOUNT=y
|
||||
BR2_PACKAGE_DOCKER_CLI=y
|
||||
BR2_PACKAGE_DOCKER_COMPOSE=y
|
||||
BR2_PACKAGE_DOCKER_ENGINE=y
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_SIZE="512M"
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
""".format(
|
||||
infra.filepath("tests/package/copy-sample-script-to-target.sh"),
|
||||
infra.filepath("conf/docker-compose.yml"),
|
||||
infra.filepath("conf/docker-compose-kernel.config"))
|
||||
|
||||
def wait_for_dockerd(self):
|
||||
# dockerd takes a while to start up
|
||||
_, _ = self.emulator.run('while [ ! -e /var/run/docker.sock ]; do sleep 1; done', 120)
|
||||
|
||||
def docker_test(self):
|
||||
# will download container if not available, which may take some time
|
||||
_, exit_code = self.emulator.run('docker run --rm busybox:latest /bin/true', 120)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
def docker_compose_test(self):
|
||||
# will download container if not available, which may take some time
|
||||
_, exit_code = self.emulator.run('docker-compose up', 120)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
def test_run(self):
|
||||
kernel = os.path.join(self.builddir, "images", "bzImage")
|
||||
rootfs = os.path.join(self.builddir, "images", "rootfs.ext2")
|
||||
self.emulator.boot(arch="x86_64",
|
||||
kernel=kernel,
|
||||
kernel_cmdline=["root=/dev/vda", "console=ttyS0"],
|
||||
options=["-cpu", "core2duo",
|
||||
"-m", "512M",
|
||||
"-device", "virtio-rng-pci",
|
||||
"-drive", "file={},format=raw,if=virtio".format(rootfs),
|
||||
"-net", "nic,model=virtio",
|
||||
"-net", "user"])
|
||||
self.emulator.login()
|
||||
self.wait_for_dockerd()
|
||||
self.docker_test()
|
||||
self.docker_compose_test()
|
||||
@@ -4,14 +4,16 @@ import infra.basetest
|
||||
|
||||
|
||||
class TestDropbear(infra.basetest.BRTest):
|
||||
passwd = "testpwd"
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_GENERIC_ROOT_PASSWD="testpwd"
|
||||
BR2_TARGET_GENERIC_ROOT_PASSWD="{}"
|
||||
BR2_SYSTEM_DHCP="eth0"
|
||||
BR2_PACKAGE_DROPBEAR=y
|
||||
BR2_PACKAGE_SSHPASS=y
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
""".format(passwd)
|
||||
|
||||
def test_run(self):
|
||||
img = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||
@@ -19,11 +21,12 @@ class TestDropbear(infra.basetest.BRTest):
|
||||
kernel="builtin",
|
||||
options=["-initrd", img,
|
||||
"-net", "nic",
|
||||
"-net", "user,hostfwd=tcp::2222-:22"])
|
||||
self.emulator.login("testpwd")
|
||||
"-net", "user"])
|
||||
self.emulator.login(self.passwd)
|
||||
cmd = "netstat -ltn 2>/dev/null | grep 0.0.0.0:22"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
# Would be useful to try to login through SSH here, through
|
||||
# localhost:2222, though it is not easy to pass the ssh
|
||||
# password on the command line.
|
||||
|
||||
cmd = "sshpass -p {} ssh -y localhost /bin/true".format(self.passwd)
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
59
bsp/buildroot/support/testing/tests/package/test_lua.py
Normal file
59
bsp/buildroot/support/testing/tests/package/test_lua.py
Normal file
@@ -0,0 +1,59 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestLuaBase(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def login(self):
|
||||
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||
self.emulator.boot(arch="armv7",
|
||||
kernel="builtin",
|
||||
options=["-initrd", cpio_file])
|
||||
self.emulator.login()
|
||||
|
||||
def version_test(self, version):
|
||||
cmd = "lua -v"
|
||||
output, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
self.assertIn(version, output[0])
|
||||
|
||||
def g_version_test(self, expected):
|
||||
cmd = "lua -e 'print(_G._VERSION)'"
|
||||
output, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
self.assertEqual(output[0], expected)
|
||||
|
||||
def module_test(self, module, script="a=1"):
|
||||
cmd = "lua -l {} -e '{}'".format(module, script)
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestLua(TestLuaBase):
|
||||
config = TestLuaBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_LUA=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.version_test('Lua 5.3')
|
||||
self.g_version_test('Lua 5.3')
|
||||
|
||||
|
||||
class TestLuajit(TestLuaBase):
|
||||
config = TestLuaBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_LUAJIT=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.version_test('LuaJIT 2')
|
||||
self.g_version_test('Lua 5.1')
|
||||
66
bsp/buildroot/support/testing/tests/package/test_perl.py
Normal file
66
bsp/buildroot/support/testing/tests/package/test_perl.py
Normal file
@@ -0,0 +1,66 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestPerlBase(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def login(self):
|
||||
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||
self.emulator.boot(arch="armv7",
|
||||
kernel="builtin",
|
||||
options=["-initrd", cpio_file])
|
||||
self.emulator.login()
|
||||
|
||||
def module_test(self, module, script="1"):
|
||||
cmd = "perl -M{} -e '{}'".format(module, script)
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestPerl(TestPerlBase):
|
||||
config = TestPerlBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PERL=y
|
||||
"""
|
||||
|
||||
def version_test(self):
|
||||
cmd = "perl -v"
|
||||
output, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
self.assertIn("This is perl 5", output[1])
|
||||
|
||||
def core_modules_test(self):
|
||||
self.module_test("Cwd")
|
||||
self.module_test("Data::Dumper")
|
||||
self.module_test("Devel::Peek")
|
||||
self.module_test("Digest::MD5")
|
||||
self.module_test("Digest::SHA")
|
||||
self.module_test("Encode")
|
||||
self.module_test("Fcntl")
|
||||
self.module_test("File::Glob")
|
||||
self.module_test("Hash::Util")
|
||||
self.module_test("I18N::Langinfo")
|
||||
self.module_test("IO::Handle")
|
||||
self.module_test("IPC::SysV")
|
||||
self.module_test("List::Util")
|
||||
self.module_test("MIME::Base64")
|
||||
self.module_test("POSIX")
|
||||
self.module_test("Socket")
|
||||
self.module_test("Storable")
|
||||
self.module_test("Sys::Hostname")
|
||||
self.module_test("Sys::Syslog")
|
||||
self.module_test("Time::HiRes")
|
||||
self.module_test("Time::Piece")
|
||||
self.module_test("Unicode::Collate")
|
||||
self.module_test("Unicode::Normalize")
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.version_test()
|
||||
self.core_modules_test()
|
||||
@@ -0,0 +1,28 @@
|
||||
from tests.package.test_perl import TestPerlBase
|
||||
|
||||
|
||||
class TestPerlClassLoad(TestPerlBase):
|
||||
"""
|
||||
package:
|
||||
Class-Load
|
||||
direct dependencies:
|
||||
Data-OptList
|
||||
Module-Implementation
|
||||
Module-Runtime
|
||||
Package-Stash
|
||||
Try-Tiny
|
||||
indirect dependencies:
|
||||
Dist-CheckConflicts
|
||||
Params-Util XS
|
||||
Sub-Install
|
||||
"""
|
||||
|
||||
config = TestPerlBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PERL=y
|
||||
BR2_PACKAGE_PERL_CLASS_LOAD=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.module_test("Class::Load")
|
||||
@@ -0,0 +1,21 @@
|
||||
from tests.package.test_perl import TestPerlBase
|
||||
|
||||
|
||||
class TestPerlDBDmysql(TestPerlBase):
|
||||
"""
|
||||
package:
|
||||
DBD-mysql XS
|
||||
direct dependencies:
|
||||
DBI XS
|
||||
"""
|
||||
|
||||
config = TestPerlBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PERL=y
|
||||
BR2_PACKAGE_PERL_DBD_MYSQL=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.module_test("DBI")
|
||||
self.module_test("DBD::mysql")
|
||||
@@ -0,0 +1,20 @@
|
||||
from tests.package.test_perl import TestPerlBase
|
||||
|
||||
|
||||
class TestPerlEncodeDetect(TestPerlBase):
|
||||
"""
|
||||
package:
|
||||
Encode-Detect XS
|
||||
direct dependencies:
|
||||
Module-Build
|
||||
"""
|
||||
|
||||
config = TestPerlBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PERL=y
|
||||
BR2_PACKAGE_PERL_ENCODE_DETECT=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.module_test("Encode::Detect")
|
||||
@@ -0,0 +1,22 @@
|
||||
from tests.package.test_perl import TestPerlBase
|
||||
|
||||
|
||||
class TestPerlGDGraph(TestPerlBase):
|
||||
"""
|
||||
package:
|
||||
GDGraph
|
||||
direct dependencies:
|
||||
GD XS
|
||||
GDTextUtil
|
||||
"""
|
||||
|
||||
config = TestPerlBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PERL=y
|
||||
BR2_PACKAGE_PERL_GDGRAPH=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.module_test("GD")
|
||||
self.module_test("GD::Graph")
|
||||
@@ -0,0 +1,21 @@
|
||||
from tests.package.test_perl import TestPerlBase
|
||||
|
||||
|
||||
class TestPerlIOSocketMulticast(TestPerlBase):
|
||||
"""
|
||||
package:
|
||||
IO-Socket-Multicast XS
|
||||
direct dependencies:
|
||||
IO-Interface XS
|
||||
"""
|
||||
|
||||
config = TestPerlBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PERL=y
|
||||
BR2_PACKAGE_PERL_IO_SOCKET_MULTICAST=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.module_test("IO::Interface")
|
||||
self.module_test("IO::Socket::Multicast")
|
||||
@@ -0,0 +1,21 @@
|
||||
from tests.package.test_perl import TestPerlBase
|
||||
|
||||
|
||||
class TestPerlIOSocketSSL(TestPerlBase):
|
||||
"""
|
||||
package:
|
||||
IO-Socket-SSL
|
||||
direct dependencies:
|
||||
Net-SSLeay XS
|
||||
"""
|
||||
|
||||
config = TestPerlBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PERL=y
|
||||
BR2_PACKAGE_PERL_IO_SOCKET_SSL=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.module_test("Net::SSLeay")
|
||||
self.module_test("IO::Socket::SSL")
|
||||
@@ -0,0 +1,41 @@
|
||||
from tests.package.test_perl import TestPerlBase
|
||||
|
||||
|
||||
class TestPerllibwwwperl(TestPerlBase):
|
||||
"""
|
||||
package:
|
||||
libwww-perl
|
||||
direct dependencies:
|
||||
Encode-Locale
|
||||
File-Listing
|
||||
HTML-Parser XS
|
||||
HTTP-Cookies
|
||||
HTTP-Daemon
|
||||
HTTP-Date
|
||||
HTTP-Message
|
||||
HTTP-Negotiate
|
||||
LWP-MediaTypes
|
||||
Net-HTTP
|
||||
Try-Tiny
|
||||
URI
|
||||
WWW-RobotRules
|
||||
indirect dependencies:
|
||||
HTML-Tagset
|
||||
IO-HTML
|
||||
"""
|
||||
|
||||
config = TestPerlBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PERL=y
|
||||
BR2_PACKAGE_PERL_LIBWWW_PERL=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.module_test("LWP")
|
||||
self.module_test("LWP::UserAgent")
|
||||
self.module_test("LWP::Authen::Basic")
|
||||
self.module_test("LWP::Authen::Digest")
|
||||
self.module_test("HTTP::Message")
|
||||
self.module_test("HTTP::Daemon")
|
||||
self.module_test("WWW::RobotRules")
|
||||
@@ -0,0 +1,28 @@
|
||||
from tests.package.test_perl import TestPerlBase
|
||||
|
||||
|
||||
class TestPerlMailDKIM(TestPerlBase):
|
||||
"""
|
||||
package:
|
||||
Mail-DKIM
|
||||
direct dependencies:
|
||||
Crypt-OpenSSL-RSA XS
|
||||
MailTools
|
||||
Net-DNS
|
||||
Net-DNS-Resolver-Mock
|
||||
YAML-LibYAML XS
|
||||
indirect dependencies:
|
||||
Crypt-OpenSSL-Random XS
|
||||
Digest-HMAC
|
||||
TimeDate
|
||||
"""
|
||||
|
||||
config = TestPerlBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PERL=y
|
||||
BR2_PACKAGE_PERL_MAIL_DKIM=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.module_test("Mail::DKIM")
|
||||
22
bsp/buildroot/support/testing/tests/package/test_perl_x10.py
Normal file
22
bsp/buildroot/support/testing/tests/package/test_perl_x10.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from tests.package.test_perl import TestPerlBase
|
||||
|
||||
|
||||
class TestPerlX10(TestPerlBase):
|
||||
"""
|
||||
package:
|
||||
X10
|
||||
direct dependencies:
|
||||
Astro-SunTime
|
||||
Device-SerialPort XS
|
||||
Time-ParseDate
|
||||
"""
|
||||
|
||||
config = TestPerlBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PERL=y
|
||||
BR2_PACKAGE_PERL_X10=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.module_test("X10")
|
||||
@@ -0,0 +1,22 @@
|
||||
from tests.package.test_perl import TestPerlBase
|
||||
|
||||
|
||||
class TestPerlXMLLibXML(TestPerlBase):
|
||||
"""
|
||||
package:
|
||||
XML-LibXML XS
|
||||
direct dependencies:
|
||||
XML-NamespaceSupport
|
||||
XML-SAX
|
||||
XML-SAX-Base
|
||||
"""
|
||||
|
||||
config = TestPerlBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PERL=y
|
||||
BR2_PACKAGE_PERL_XML_LIBXML=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.module_test("XML::LibXML")
|
||||
48
bsp/buildroot/support/testing/tests/package/test_prosody.py
Normal file
48
bsp/buildroot/support/testing/tests/package/test_prosody.py
Normal file
@@ -0,0 +1,48 @@
|
||||
from tests.package.test_lua import TestLuaBase
|
||||
|
||||
|
||||
class TestProsody(TestLuaBase):
|
||||
def lua_dependencies_test(self):
|
||||
self.module_test('bit') # luabitop
|
||||
self.module_test('lfs') # luafilesystem
|
||||
self.module_test('lxp') # luaexpat
|
||||
self.module_test('socket') # luasocket
|
||||
self.module_test('ssl') # luasec
|
||||
|
||||
def prosody_test(self):
|
||||
# prosody was launched as service
|
||||
cmd = "prosodyctl status"
|
||||
output, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
self.assertIn("Prosody is running", output[0])
|
||||
|
||||
|
||||
class TestProsodyLua51(TestProsody):
|
||||
config = TestLuaBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_LUA=y
|
||||
BR2_PACKAGE_LUA_5_1=y
|
||||
BR2_PACKAGE_PROSODY=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.version_test('Lua 5.1')
|
||||
self.g_version_test('Lua 5.1')
|
||||
self.lua_dependencies_test()
|
||||
self.prosody_test()
|
||||
|
||||
|
||||
class TestProsodyLuajit(TestProsody):
|
||||
config = TestLuaBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_LUAJIT=y
|
||||
BR2_PACKAGE_PROSODY=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.version_test('LuaJIT 2')
|
||||
self.g_version_test('Lua 5.1')
|
||||
self.lua_dependencies_test()
|
||||
self.prosody_test()
|
||||
@@ -68,3 +68,58 @@ 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):
|
||||
self.login()
|
||||
self.check_sample_scripts_exist()
|
||||
self.run_sample_scripts()
|
||||
|
||||
@@ -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
|
||||
"""
|
||||
@@ -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"]
|
||||
@@ -0,0 +1,21 @@
|
||||
from tests.package.test_python import TestPythonPackageBase
|
||||
|
||||
|
||||
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"]
|
||||
|
||||
|
||||
class TestPythonPy3Autobahn(TestPythonPackageBase):
|
||||
__test__ = True
|
||||
config = TestPythonPackageBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
BR2_PACKAGE_PYTHON_AUTOBAHN=y
|
||||
"""
|
||||
sample_scripts = ["tests/package/sample_python_autobahn.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
|
||||
@@ -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"]
|
||||
@@ -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"]
|
||||
@@ -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
|
||||
"""
|
||||
@@ -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"]
|
||||
@@ -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
|
||||
@@ -0,0 +1,23 @@
|
||||
from tests.package.test_python import TestPythonPackageBase
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
class TestPythonPy3Cryptography(TestPythonPackageBase):
|
||||
__test__ = True
|
||||
config = TestPythonPackageBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y
|
||||
"""
|
||||
sample_scripts = ["tests/package/sample_python_cryptography.py"]
|
||||
timeout = 40
|
||||
@@ -0,0 +1,23 @@
|
||||
from tests.package.test_python import TestPythonPackageBase
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
class TestPythonPy3Incremental(TestPythonPackageBase):
|
||||
__test__ = True
|
||||
config = TestPythonPackageBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
BR2_PACKAGE_PYTHON_INCREMENTAL=y
|
||||
"""
|
||||
sample_scripts = ["tests/package/sample_python_incremental.py"]
|
||||
timeout = 30
|
||||
@@ -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
|
||||
@@ -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"]
|
||||
@@ -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
|
||||
@@ -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"]
|
||||
@@ -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
|
||||
@@ -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"]
|
||||
@@ -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
|
||||
"""
|
||||
@@ -0,0 +1,39 @@
|
||||
from tests.package.test_python import TestPythonPackageBase
|
||||
|
||||
|
||||
class TestPythonTwisted(TestPythonPackageBase):
|
||||
config = TestPythonPackageBase.config
|
||||
sample_scripts = ["tests/package/sample_python_twisted.py"]
|
||||
|
||||
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 + " sample_python_twisted.py &"
|
||||
# give some time to setup the server
|
||||
cmd += "sleep 30"
|
||||
_, exit_code = self.emulator.run(cmd, timeout=35)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
cmd = "netstat -ltn 2>/dev/null | grep 0.0.0.0:1234"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestPythonPy2Twisted(TestPythonTwisted):
|
||||
__test__ = True
|
||||
config = TestPythonTwisted.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON=y
|
||||
BR2_PACKAGE_PYTHON_TWISTED=y
|
||||
"""
|
||||
|
||||
|
||||
class TestPythonPy3Twisted(TestPythonTwisted):
|
||||
__test__ = True
|
||||
config = TestPythonTwisted.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
BR2_PACKAGE_PYTHON_TWISTED=y
|
||||
"""
|
||||
@@ -0,0 +1,22 @@
|
||||
from tests.package.test_python import TestPythonPackageBase
|
||||
|
||||
|
||||
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"]
|
||||
|
||||
|
||||
class TestPythonPy3Txaio(TestPythonPackageBase):
|
||||
__test__ = True
|
||||
config = TestPythonPackageBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
BR2_PACKAGE_PYTHON_TXAIO=y
|
||||
"""
|
||||
sample_scripts = ["tests/package/sample_python_txaio_asyncio.py"]
|
||||
@@ -0,0 +1,23 @@
|
||||
from tests.package.test_python import TestPythonPackageBase
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
class TestPythonPy3Txtorcon(TestPythonPackageBase):
|
||||
__test__ = True
|
||||
config = TestPythonPackageBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
BR2_PACKAGE_PYTHON_TXTORCON=y
|
||||
"""
|
||||
sample_scripts = ["tests/package/sample_python_txtorcon.py"]
|
||||
timeout = 30
|
||||
@@ -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"]
|
||||
@@ -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()
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestSyslogNg(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
|
||||
BR2_PACKAGE_SYSLOG_NG=y
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||
self.emulator.boot(arch="armv5", kernel="builtin", options=["-initrd", cpio_file])
|
||||
self.emulator.login()
|
||||
|
||||
cmd = "grep syslog-ng /var/log/messages | grep starting"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
cmd = "logger my-message;"
|
||||
cmd += "sleep 1;"
|
||||
cmd += "grep my-message /var/log/messages"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
cmd = "syslog-ng-ctl reload;"
|
||||
cmd += "sleep 1;"
|
||||
cmd += "grep syslog-ng /var/log/messages | grep -i warning"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 1)
|
||||
Reference in New Issue
Block a user