summaryrefslogtreecommitdiffstats
path: root/debian/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:39 +0000
commita5cb27bed2202818ee204db23f8488a7794d6ec3 (patch)
tree4a38fb6c257e5031269038e525d11a7c2f0fdb1b /debian/tests
parentMerging upstream version 1.70.0+dfsg2. (diff)
downloadrustc-a5cb27bed2202818ee204db23f8488a7794d6ec3.tar.xz
rustc-a5cb27bed2202818ee204db23f8488a7794d6ec3.zip
Adding debian version 1.70.0+dfsg2-1.debian/1.70.0+dfsg2-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests')
-rw-r--r--debian/tests/control7
-rwxr-xr-xdebian/tests/create-and-build-crate39
2 files changed, 46 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 000000000..2cffafdb8
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,7 @@
+#Test-Command: ./debian/rules build
+#Depends: @builddeps@
+#Restrictions: rw-build-tree, allow-stderr
+#
+Tests: create-and-build-crate
+Restrictions: rw-build-tree, allow-stderr, needs-internet
+Depends: cargo, ca-certificates
diff --git a/debian/tests/create-and-build-crate b/debian/tests/create-and-build-crate
new file mode 100755
index 000000000..46cc2a034
--- /dev/null
+++ b/debian/tests/create-and-build-crate
@@ -0,0 +1,39 @@
+#!/bin/bash
+set -euo pipefail
+
+tmpdir=$(mktemp -d)
+cd "$tmpdir"
+
+cargo new hello
+cd hello
+
+cat <<EOF > src/main.rs
+use anyhow::Result;
+
+fn main() -> Result<()> {
+ println!("Hello, World!");
+ Ok(())
+}
+
+#[test]
+fn test() {
+ assert_eq!(1 + 1, 2);
+}
+EOF
+
+cargo add 'anyhow@^1'
+cargo vendor
+
+mkdir -p .cargo
+cat <<EOF > .cargo/config.toml
+[source.crates-io]
+replace-with = "vendored-sources"
+
+[source.vendored-sources]
+directory = "vendor"
+EOF
+
+cargo check
+cargo build
+cargo test
+cargo run