f0d1f21195
TestRust and TestRustBin has been introduced at the time when there was
no cargo package infrastructure or any package using rust compiler
(Buildroot 2018.02).
Since then the ripgrep package has been introduced, initially using
the generic package infrastructure and converted later to the cargo
package infrastructure.
Due a recent change in rust/cargo removing the cargo config file [1]
the test TestRust and TestRustBin now fail to compile since they build
an hello-world crate outside of the cargo package infrastructure
without the correct environment for cross-compiling.
Replace the 'hello-world' crate by ripgrep package and check if it
can run properly in Qemu.
Fixes tests.package.test_rust.TestRustBin:
https://gitlab.com/buildroot.org/buildroot/-/jobs/2116202545
But doesn't fixes tests.package.test_rust.TestRust due another bug:
https://gitlab.com/buildroot.org/buildroot/-/jobs/2116202544
[1] b6378631c2
Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
59 lines
1.4 KiB
Python
59 lines
1.4 KiB
Python
import os
|
|
import tempfile
|
|
import subprocess
|
|
import shutil
|
|
|
|
import infra.basetest
|
|
|
|
|
|
class TestRustBase(infra.basetest.BRTest):
|
|
|
|
def login(self):
|
|
img = os.path.join(self.builddir, "images", "rootfs.cpio")
|
|
self.emulator.boot(arch="armv7",
|
|
kernel="builtin",
|
|
options=["-initrd", img])
|
|
self.emulator.login()
|
|
|
|
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_TARGET_ROOTFS_CPIO=y
|
|
# BR2_TARGET_ROOTFS_TAR is not set
|
|
BR2_PACKAGE_HOST_RUSTC=y
|
|
BR2_PACKAGE_RIPGREP=y
|
|
"""
|
|
|
|
def test_run(self):
|
|
self.login()
|
|
self.assertRunOk("rg Buildroot /etc/issue")
|
|
|
|
|
|
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_TARGET_ROOTFS_CPIO=y
|
|
# BR2_TARGET_ROOTFS_TAR is not set
|
|
BR2_PACKAGE_HOST_RUSTC=y
|
|
BR2_PACKAGE_HOST_RUST=y
|
|
BR2_PACKAGE_RIPGREP=y
|
|
"""
|
|
|
|
def test_run(self):
|
|
self.login()
|
|
self.assertRunOk("rg Buildroot /etc/issue")
|