summaryrefslogtreecommitdiff
path: root/tests/projects/rust
diff options
context:
space:
mode:
authorruki <[email protected]>2023-08-08 23:40:49 +0800
committerruki <[email protected]>2023-08-08 23:40:49 +0800
commit75e7ddd9d604fc4c762dbc0e187c4a0d0ae231cc (patch)
tree51e979a9672b505285343a0ef91ad52a363d3ca5 /tests/projects/rust
parentb30f8296b46a14f4ba4cec9fb0b81a6876d40d0c (diff)
add cargo without std example
Diffstat (limited to 'tests/projects/rust')
-rw-r--r--tests/projects/rust/cargo_deps_without_std/.cargo/config.toml2
-rw-r--r--tests/projects/rust/cargo_deps_without_std/Cargo.toml7
-rw-r--r--tests/projects/rust/cargo_deps_without_std/src/main.rs10
-rw-r--r--tests/projects/rust/cargo_deps_without_std/xmake.lua7
4 files changed, 26 insertions, 0 deletions
diff --git a/tests/projects/rust/cargo_deps_without_std/.cargo/config.toml b/tests/projects/rust/cargo_deps_without_std/.cargo/config.toml
new file mode 100644
index 000000000..724febaec
--- /dev/null
+++ b/tests/projects/rust/cargo_deps_without_std/.cargo/config.toml
@@ -0,0 +1,2 @@
+[build]
+target = "aarch64-unknown-none"
diff --git a/tests/projects/rust/cargo_deps_without_std/Cargo.toml b/tests/projects/rust/cargo_deps_without_std/Cargo.toml
new file mode 100644
index 000000000..6761593dc
--- /dev/null
+++ b/tests/projects/rust/cargo_deps_without_std/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "demo"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+spin = "^0.9"
diff --git a/tests/projects/rust/cargo_deps_without_std/src/main.rs b/tests/projects/rust/cargo_deps_without_std/src/main.rs
new file mode 100644
index 000000000..c7ce4ff1c
--- /dev/null
+++ b/tests/projects/rust/cargo_deps_without_std/src/main.rs
@@ -0,0 +1,10 @@
+// src/main.rs
+#![no_main]
+#![no_std]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic(_panic: &PanicInfo<'_>) -> ! {
+ loop {}
+}
diff --git a/tests/projects/rust/cargo_deps_without_std/xmake.lua b/tests/projects/rust/cargo_deps_without_std/xmake.lua
new file mode 100644
index 000000000..b9f878c13
--- /dev/null
+++ b/tests/projects/rust/cargo_deps_without_std/xmake.lua
@@ -0,0 +1,7 @@
+add_rules("mode.release", "mode.debug")
+add_requires("cargo::test", {configs = {cargo_toml = path.join(os.projectdir(), "Cargo.toml")}})
+
+target("test")
+ set_kind("binary")
+ add_files("src/main.rs")
+ add_packages("cargo::test")