Skip to contentSkip to conversation

Add rust runtime tests

PATCH New Alex Kiernan 1 participant 13 messages Dec 28, 2022

lore
Share & tools
lore
#0 lore raw

v5 cover Add rust runtime tests

This series adds runtime tests for rust and cargo, merges (most of) the include files into the base recipes and fixes target cargo builds.

Also add SDK_TOOLCHAIN_LANGS for selection of target toolchains as part of packagegroup-core-sdk.

Changes in v5:
- Switch from cargo patching to bitbake patching (https://github.com/rust-lang/rust/issues/98185)

Changes in v4:
- Fixup __stack_chk_fail_local in musl-x86
- Add crossbeam atomics fixes for ppc/mips

Changes in v3:
- Switch to packagegroup-core-sdk driven from TARGET_TOOLCHAIN_LANGS (which defaults to SDK_TOOLCHAIN_LANGS)

Changes in v2:
- Drop rust.inc/rust.bb merge, not actually made use of in the change set
- Reorder so cargo test goes after build fixes

Alex Kiernan (12):
rust-llvm: Merge .inc into .bb
rust-llvm: Update LLVM_VERSION to match embedded version packagegroup-rust-sdk-target: Add Rust SDK target packagegroup
packagegroup-core-sdk: Add SDK toolchain language selection support
rust: Merge .inc into .bb
rust: Move musl-x86 fix for __stack_chk_fail_local to rust-source
cargo: Merge .inc into .bb
cargo: Extend DEBUG_PREFIX_MAP to cover vendor
cargo: Include crossbeam-utils patch
cargo: Drop exclude from world packagegroup-rust-sdk-target: Add cargo oeqa/runtime/rust: Add cargo test

 meta/lib/oeqa/runtime/cases/rust.py           |  17 ++
 .../packagegroups/packagegroup-core-sdk.bb    |  10 +-
 .../packagegroup-rust-sdk-target.bb           |  14 ++
 meta/recipes-devtools/cargo/cargo_1.66.0.bb   |   5 -
 .../{cargo/cargo.inc => rust/cargo_1.66.0.bb} |  13 +-
 .../{rust => files}/crossbeam_atomic.patch    |   0
 meta/recipes-devtools/rust/rust-llvm.inc      |  78 ------
 .../recipes-devtools/rust/rust-llvm_1.66.0.bb |  82 ++++++-
 meta/recipes-devtools/rust/rust-source.inc    |   5 +
 meta/recipes-devtools/rust/rust-target.inc    |  10 -
 meta/recipes-devtools/rust/rust.inc           | 223 ------------------
 meta/recipes-devtools/rust/rust_1.66.0.bb     | 223 +++++++++++++++++-
 12 files changed, 353 insertions(+), 327 deletions(-)
 create mode 100644 meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb
 delete mode 100644 meta/recipes-devtools/cargo/cargo_1.66.0.bb
 rename meta/recipes-devtools/{cargo/cargo.inc => rust/cargo_1.66.0.bb} (88%)
 rename meta/recipes-devtools/rust/{rust => files}/crossbeam_atomic.patch (100%)
 delete mode 100644 meta/recipes-devtools/rust/rust-llvm.inc
 delete mode 100644 meta/recipes-devtools/rust/rust-target.inc
 delete mode 100644 meta/recipes-devtools/rust/rust.inc
Signature · 1 line
2.39.0
#1 lore raw

PATCH v5 1/12 rust-llvm: Merge .inc into .bb

---

(no changes since v2)

Changes in v2:
- Drop rust.inc/rust.bb merge, not actually made use of in the change set
- Reorder so cargo test goes after build fixes

 meta/recipes-devtools/rust/rust-llvm.inc      | 78 ------------------
 .../recipes-devtools/rust/rust-llvm_1.66.0.bb | 80 ++++++++++++++++++-
 2 files changed, 79 insertions(+), 79 deletions(-)
 delete mode 100644 meta/recipes-devtools/rust/rust-llvm.inc
meta/recipes-devtools/rust/rust-llvm.inc deleted +0 -78
deleted file mode 100644
index 625eb5704166..000000000000
@@ -1,78 +0,0 @@
-SUMMARY = "LLVM compiler framework (packaged with rust)"
-LICENSE ?= "Apache-2.0-with-LLVM-exception"
-HOMEPAGE = "http://www.rust-lang.org"
-
-SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \
-            file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \
-	    file://0003-llvm-fix-include-benchmarks.patch;striplevel=2"
-
-S = "${RUSTSRC}/src/llvm-project/llvm"
-
-LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe"
-
-inherit cmake python3native
-
-DEPENDS += "ninja-native rust-llvm-native"
-
-ARM_INSTRUCTION_SET:armv5 = "arm"
-ARM_INSTRUCTION_SET:armv4t = "arm"
-
-# rustc_llvm with debug info is not recognized as a valid crate that's
-# generated by rust-llvm-native.
-CFLAGS:remove = "-g"
-CXXFLAGS:remove = "-g"
-
-LLVM_DIR = "llvm${LLVM_RELEASE}"
-
-EXTRA_OECMAKE = " \
-    -DCMAKE_BUILD_TYPE=Release \
-    -DLLVM_TARGETS_TO_BUILD='ARM;AArch64;Mips;PowerPC;RISCV;X86' \
-    -DLLVM_BUILD_DOCS=OFF \
-    -DLLVM_ENABLE_TERMINFO=OFF \
-    -DLLVM_ENABLE_ZLIB=OFF \
-    -DLLVM_ENABLE_LIBXML2=OFF \
-    -DLLVM_ENABLE_FFI=OFF \
-    -DLLVM_INSTALL_UTILS=ON \
-    -DLLVM_BUILD_EXAMPLES=OFF \
-    -DLLVM_INCLUDE_EXAMPLES=OFF \
-    -DLLVM_BUILD_TESTS=OFF \
-    -DLLVM_INCLUDE_TESTS=OFF \
-    -DLLVM_TARGET_ARCH=${TARGET_ARCH} \
-    -DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \
-"
-EXTRA_OECMAKE:append:class-target = "\
-    -DCMAKE_CROSSCOMPILING:BOOL=ON \
-    -DLLVM_BUILD_TOOLS=OFF \
-    -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \
-    -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \
-"
-
-EXTRA_OECMAKE:append:class-nativesdk = "\
-    -DCMAKE_CROSSCOMPILING:BOOL=ON \
-    -DLLVM_BUILD_TOOLS=OFF \
-    -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \
-    -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \
-"
-
-# The debug symbols are huge here (>2GB) so suppress them since they
-# provide almost no value. If you really need them then override this
-INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
-
-export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config"
-
-do_install:append () {
-    # we don't need any of this stuff to build Rust
-    rm -rf "${D}/usr/lib/cmake"
-}
-
-PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto"
-
-# Add the extra locations to avoid the complaints about unpackaged files
-FILES:${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so"
-FILES:${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so"
-FILES:${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*"
-FILES:${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a"
-FILES:${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin"
-FILES:${PN}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake"
-
-BBCLASSEXTEND = "native nativesdk"
meta/recipes-devtools/rust/rust-llvm_1.66.0.bb +79 -1

85 lines not on this page · raw message

Signature · 1 line
2.39.0
#2 lore raw

PATCH v5 2/12 rust-llvm: Update LLVM_VERSION to match embedded version

In reply to Alex Kiernan

---

(no changes since v1)

 meta/recipes-devtools/rust/rust-llvm_1.66.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/rust/rust-llvm_1.66.0.bb +1 -1
index e1baeb78574f..4cf244bb67f5 100644
@@ -4,7 +4,7 @@ HOMEPAGE = "http://www.rust-lang.org"
 
 # check src/llvm-project/llvm/CMakeLists.txt for llvm version in use
 #
-LLVM_RELEASE = "14.0.5"
+LLVM_RELEASE = "15.0.2"
 
 require rust-source.inc
 
Signature · 1 line
2.39.0
#3 lore raw

PATCH v5 3/12 packagegroup-rust-sdk-target: Add Rust SDK target packagegroup

In reply to Alex Kiernan

---

(no changes since v1)

 .../packagegroups/packagegroup-rust-sdk-target.bb   | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb
meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb new file +13 -0
new file mode 100644
index 000000000000..334b24900b4b
@@ -0,0 +1,13 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+SUMMARY = "Target packages for the Rust SDK"
+
+inherit packagegroup
+
+RDEPENDS:${PN} = " \
+    rust \
+"
Signature · 1 line
2.39.0
#4 lore raw

PATCH v5 4/12 packagegroup-core-sdk: Add SDK toolchain language selection support

In reply to Alex Kiernan

Use SDK_TOOLCHAIN_LANGS to allow different language support to be selected within SDKs. Initially supported options are rust and go.

---

(no changes since v3)

Changes in v3:
- Switch to packagegroup-core-sdk driven from TARGET_TOOLCHAIN_LANGS (which defaults to SDK_TOOLCHAIN_LANGS)

 .../packagegroups/packagegroup-core-sdk.bb             | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +9 -1
index d70aff22c725..104f3549d593 100644
@@ -11,6 +11,11 @@ inherit packagegroup
 
 #PACKAGEFUNCS =+ 'generate_sdk_pkgs'
 
+TARGET_TOOLCHAIN_LANGS ??= "${SDK_TOOLCHAIN_LANGS}"
+TARGET_TOOLCHAIN_LANGS:remove:sdkmingw32 = "rust"
+# libstd-rs doesn't build for mips n32 with compiler constraint errors
+TARGET_TOOLCHAIN_LANGS:remove:mipsarchn32 = "rust"
+
 RDEPENDS:packagegroup-core-sdk = "\
     packagegroup-core-buildessential \
     coreutils \
@@ -23,7 +28,10 @@ RDEPENDS:packagegroup-core-sdk = "\
     less \
     ldd \
     file \
-    tcl"
+    tcl \
+    ${@bb.utils.contains('TARGET_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-sdk-target', '', d)} \
+    ${@bb.utils.contains('TARGET_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-sdk-target', '', d)} \
+"
 
 SANITIZERS = "libasan-dev libubsan-dev"
 SANITIZERS:arc = ""
Signature · 1 line
2.39.0
#5 lore raw

PATCH v5 5/12 rust: Merge .inc into .bb

In reply to Alex Kiernan

---

(no changes since v1)

 meta/recipes-devtools/rust/rust-target.inc |  10 -
 meta/recipes-devtools/rust/rust.inc        | 223 ---------------------
 meta/recipes-devtools/rust/rust_1.66.0.bb  | 218 +++++++++++++++++++-
 3 files changed, 217 insertions(+), 234 deletions(-)
 delete mode 100644 meta/recipes-devtools/rust/rust-target.inc
 delete mode 100644 meta/recipes-devtools/rust/rust.inc
meta/recipes-devtools/rust/rust-target.inc deleted +0 -10
deleted file mode 100644
index dce2b47517b5..000000000000
@@ -1,10 +0,0 @@
-require rust.inc
-
-DEPENDS += "rust-llvm (=${PV})"
-
-# Otherwise we'll depend on what we provide
-INHIBIT_DEFAULT_RUST_DEPS:class-native = "1"
-# We don't need to depend on gcc-native because yocto assumes it exists
-PROVIDES:class-native = "virtual/${TARGET_PREFIX}rust"
-
-BBCLASSEXTEND = "native nativesdk"
meta/recipes-devtools/rust/rust.inc deleted +0 -223

223 lines not on this page · raw message

meta/recipes-devtools/rust/rust_1.66.0.bb +217 -1

230 lines not on this page · raw message

Signature · 1 line
2.39.0
#6 lore raw

PATCH v5 6/12 rust: Move musl-x86 fix for `__stack_chk_fail_local` to rust-source

In reply to Alex Kiernan

Any consumer of rust-source (potentially) needs this, so move to rust-source.inc

---

(no changes since v4)

Changes in v4:
- Fixup __stack_chk_fail_local in musl-x86

 meta/recipes-devtools/rust/rust-source.inc | 5 +++++
 meta/recipes-devtools/rust/rust_1.66.0.bb  | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)
meta/recipes-devtools/rust/rust-source.inc +5 -0
index 91a6c5a942ae..b63e18ac95d2 100644
@@ -11,3 +11,8 @@ RUSTSRC = "${WORKDIR}/rustc-${RUST_VERSION}-src"
 
 UPSTREAM_CHECK_URI = "https://forge.rust-lang.org/infra/other-installation-methods.html"
 UPSTREAM_CHECK_REGEX = "rustc-(?P<pver>\d+(\.\d+)+)-src"
+
+# see recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
+# we need to link with ssp_nonshared on musl to avoid "undefined reference to `__stack_chk_fail_local'"
+# when building MACHINE=qemux86 for musl
+WRAPPER_TARGET_EXTRALD:libc-musl = "-lssp_nonshared"
meta/recipes-devtools/rust/rust_1.66.0.bb +0 -5
index 5192ec2ee11a..f1ec769aef48 100644
@@ -292,11 +292,6 @@ rust_do_install:class-target() {
     rm ${D}${libdir}/rustlib/manifest*
 }
 
-# see recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
-# we need to link with ssp_nonshared on musl to avoid "undefined reference to `__stack_chk_fail_local'"
-# when building MACHINE=qemux86 for musl
-WRAPPER_TARGET_EXTRALD:libc-musl = "-lssp_nonshared"
-
 RUSTLIB_DEP:class-nativesdk = ""
 
 # musl builds include libunwind.a
Signature · 1 line
2.39.0
#7 lore raw

PATCH v5 7/12 cargo: Merge .inc into .bb

In reply to Alex Kiernan

---

(no changes since v1)

 meta/recipes-devtools/cargo/cargo.inc       | 69 --------------------
 meta/recipes-devtools/cargo/cargo_1.66.0.bb | 71 ++++++++++++++++++++-
 2 files changed, 69 insertions(+), 71 deletions(-)
 delete mode 100644 meta/recipes-devtools/cargo/cargo.inc
meta/recipes-devtools/cargo/cargo.inc deleted +0 -69
deleted file mode 100644
index 40421df4f76d..000000000000
@@ -1,69 +0,0 @@
-SUMMARY ?= "Cargo, a package manager for Rust."
-HOMEPAGE = "https://crates.io"
-LICENSE = "MIT | Apache-2.0"
-SECTION = "devel"
-
-DEPENDS = "openssl zlib curl ca-certificates libssh2"
-
-LIC_FILES_CHKSUM = " \
-    file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d \
-    file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \
-    file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \
-"
-
-
-S = "${RUSTSRC}/src/tools/cargo"
-CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
-EXCLUDE_FROM_WORLD = "1"
-
-inherit cargo pkgconfig
-
-do_cargo_setup_snapshot () {
-	${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
-	# Need to use uninative's loader if enabled/present since the library paths
-	# are used internally by rust and result in symbol mismatches if we don't
-	if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then
-		patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER}
-	fi
-}
-
-addtask cargo_setup_snapshot after do_unpack before do_configure
-do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}"
-do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER"
-
-
-do_compile:prepend () {
-	export RUSTC_BOOTSTRAP="1"
-}
-
-do_install () {
-	install -d "${D}${bindir}"
-	install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}"
-}
-
-do_install:append:class-nativesdk() {
-	# To quote the cargo docs, "Cargo also sets the dynamic library path when compiling
-	# and running binaries with commands like `cargo run` and `cargo test`". Sadly it
-	# sets to libdir but not base_libdir leading to symbol mismatches depending on the
-	# host OS. Fully set LD_LIBRARY_PATH to contain both to avoid this.
-	create_wrapper ${D}/${bindir}/cargo LD_LIBRARY_PATH=${libdir}:${base_libdir}
-}
-
-# Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1)
-# as shipped by Yocto Dunfell.
-# According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between
-# libgit2-sys and arbitrary system libgit2 versions, so better keep this turned off.
-#export LIBGIT2_SYS_USE_PKG_CONFIG = "1"
-
-# Needed for pkg-config to be used
-export LIBSSH2_SYS_USE_PKG_CONFIG = "1"
-
-# When building cargo-native we don't have cargo-native to use and depend on,
-# so we must use the locally set up snapshot to bootstrap the build.
-BASEDEPENDS:remove:class-native = "cargo-native"
-CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"
-
-DEPENDS:append:class-nativesdk = " nativesdk-rust"
-RUSTLIB:append:class-nativesdk = " -L ${STAGING_DIR_HOST}/${SDKPATHNATIVE}/usr/lib/rustlib/${RUST_HOST_SYS}/lib"
-
-
meta/recipes-devtools/cargo/cargo_1.66.0.bb +69 -2

75 lines not on this page · raw message

Signature · 1 line
2.39.0
#8 lore raw

PATCH v5 8/12 cargo: Extend DEBUG_PREFIX_MAP to cover vendor

In reply to Alex Kiernan

The cargo build builds vendored libgit and curl, but these exist outside ${S} which DEBUG_PREFIX_MAP covers.

---

(no changes since v1)

 meta/recipes-devtools/cargo/cargo_1.66.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/cargo/cargo_1.66.0.bb +2 -0
index 6c167c0c5f0b..fe8049b68c9b 100644
@@ -20,6 +20,8 @@ EXCLUDE_FROM_WORLD = "1"
 
 inherit cargo pkgconfig
 
+DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
+
 do_cargo_setup_snapshot () {
 	${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
 	# Need to use uninative's loader if enabled/present since the library paths
Signature · 1 line
2.39.0
#9 lore raw

PATCH v5 9/12 cargo: Include crossbeam-utils patch

In reply to Alex Kiernan

We need patched crossbeam-utils in cargo as well as rust, move cargo alongside rust so they can both use the same patch.

---

Changes in v5:
- Switch from cargo patching to bitbake patching (https://github.com/rust-lang/rust/issues/98185)

Changes in v4:
- Add crossbeam atomics fixes for ppc/mips

 meta/recipes-devtools/{cargo => rust}/cargo_1.66.0.bb    | 9 +++++++--
 .../rust/{rust => files}/crossbeam_atomic.patch          | 0
 2 files changed, 7 insertions(+), 2 deletions(-)
 rename meta/recipes-devtools/{cargo => rust}/cargo_1.66.0.bb (93%)
 rename meta/recipes-devtools/rust/{rust => files}/crossbeam_atomic.patch (100%)
meta/recipes-devtools/rust/cargo_1.66.0.bb renamed from meta/recipes-devtools/cargo/cargo_1.66.0.bb +7 -2
similarity index 93%
rename from meta/recipes-devtools/cargo/cargo_1.66.0.bb
rename to meta/recipes-devtools/rust/cargo_1.66.0.bb
index fe8049b68c9b..f00c67bef5e5 100644
@@ -11,8 +11,13 @@ LIC_FILES_CHKSUM = " \
     file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \
 "
 
-require recipes-devtools/rust/rust-source.inc
-require recipes-devtools/rust/rust-snapshot.inc
+require rust-source.inc
+require rust-snapshot.inc
+
+SRC_URI:append:class-target = " file://crossbeam_atomic.patch;patchdir=${RUSTSRC}"
+
+# Used by crossbeam_atomic.patch
+export TARGET_VENDOR
 
 S = "${RUSTSRC}/src/tools/cargo"
 CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
meta/recipes-devtools/rust/files/crossbeam_atomic.patch renamed from meta/recipes-devtools/rust/rust/crossbeam_atomic.patch +0 -0
similarity index 100%
rename from meta/recipes-devtools/rust/rust/crossbeam_atomic.patch
rename to meta/recipes-devtools/rust/files/crossbeam_atomic.patch
Signature · 1 line
2.39.0
#10 lore raw

PATCH v5 10/12 cargo: Drop exclude from world

In reply to Alex Kiernan

On-target cargo now builds/runs.

---

(no changes since v1)

 meta/recipes-devtools/rust/cargo_1.66.0.bb | 1 -
 1 file changed, 1 deletion(-)
meta/recipes-devtools/rust/cargo_1.66.0.bb +0 -1
index f00c67bef5e5..37e0123ee3d0 100644
@@ -21,7 +21,6 @@ export TARGET_VENDOR
 
 S = "${RUSTSRC}/src/tools/cargo"
 CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
-EXCLUDE_FROM_WORLD = "1"
 
 inherit cargo pkgconfig
 
Signature · 1 line
2.39.0
#11 lore raw

PATCH v5 11/12 packagegroup-rust-sdk-target: Add cargo

In reply to Alex Kiernan

---

(no changes since v1)

 meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb +1 -0
index 334b24900b4b..59874c4c2c81 100644
@@ -10,4 +10,5 @@ inherit packagegroup
 
 RDEPENDS:${PN} = " \
     rust \
+    cargo \
 "
Signature · 1 line
2.39.0
#12 lore raw

PATCH v5 12/12 oeqa/runtime/rust: Add cargo test

In reply to Alex Kiernan

---

(no changes since v1)

 meta/lib/oeqa/runtime/cases/rust.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
meta/lib/oeqa/runtime/cases/rust.py +17 -0
index 186bb0d79e15..c9c60e16fd2b 100644
@@ -20,6 +20,8 @@ class RustCompileTest(OERuntimeTestCase):
     def tearDown(cls):
         files = '/tmp/test.rs /tmp/test'
         cls.tc.target.run('rm %s' % files)
+        dirs = '/tmp/hello'
+        cls.tc.target.run('rm -r %s' % dirs)
 
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     @OEHasPackage(['rust'])
@@ -32,6 +34,21 @@ class RustCompileTest(OERuntimeTestCase):
         msg = 'running compiled file failed, output: %s' % output
         self.assertEqual(status, 0, msg=msg)
 
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    @OEHasPackage(['cargo'])
+    def test_cargo_compile(self):
+        status, output = self.target.run('cargo new /tmp/hello')
+        msg = 'cargo new failed, output: %s' % output
+        self.assertEqual(status, 0, msg=msg)
+
+        status, output = self.target.run('cargo build --manifest-path=/tmp/hello/Cargo.toml')
+        msg = 'cargo build failed, output: %s' % output
+        self.assertEqual(status, 0, msg=msg)
+
+        status, output = self.target.run('cargo run --manifest-path=/tmp/hello/Cargo.toml')
+        msg = 'running compiled file failed, output: %s' % output
+        self.assertEqual(status, 0, msg=msg)
+
 class RustHelloworldTest(OERuntimeTestCase):
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     @OEHasPackage(['rust-hello-world'])
Signature · 1 line
2.39.0