aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/tests/compiletest.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <bors[bot]@users.noreply.github.com> 2018-09-06 00:44:19 +0000
committerGravatar bors[bot] <bors[bot]@users.noreply.github.com> 2018-09-06 00:44:19 +0000
commit7854e96f69f98570504c701ae860175efc7a25d9 (patch)
treeeaf897d43263606e24b6cca9f5f6620498648dc6 /cortex-m-rt/tests/compiletest.rs
parent0fb051055a0340ad6c5b59d18183c260468e455f (diff)
parent31713aba3f4a4aacd55d12b8a3435334ae61986a (diff)
downloadcortex-m-7854e96f69f98570504c701ae860175efc7a25d9.tar.gz
cortex-m-7854e96f69f98570504c701ae860175efc7a25d9.tar.zst
cortex-m-7854e96f69f98570504c701ae860175efc7a25d9.zip
Merge #90
90: turn macros into attributes r=adamgreig a=japaric This is a PoC implementation of RFC #82. Assuming that we are OK with this implementation we should add some compile fail tests (e.g. using a function with the wrong signature as the entry point) before landing this. Look at the diff of the examples to get an overview of the changes. cc @rust-embedded/cortex-m Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Diffstat (limited to 'cortex-m-rt/tests/compiletest.rs')
-rw-r--r--cortex-m-rt/tests/compiletest.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/cortex-m-rt/tests/compiletest.rs b/cortex-m-rt/tests/compiletest.rs
new file mode 100644
index 0000000..6cea3ac
--- /dev/null
+++ b/cortex-m-rt/tests/compiletest.rs
@@ -0,0 +1,21 @@
+extern crate compiletest_rs as compiletest;
+
+use std::path::PathBuf;
+
+fn run_mode(mode: &'static str) {
+ let mut config = compiletest::Config::default();
+
+ config.mode = mode.parse().expect("Invalid mode");
+ config.src_base = PathBuf::from(format!("tests/{}", mode));
+ // config.link_deps(); // Populate config.target_rustcflags with dependencies on the path
+ config.target_rustcflags =
+ Some("-L target/debug -L target/debug/deps -C panic=abort".to_owned());
+ // config.clean_rmeta(); // If your tests import the parent crate, this helps with E0464
+
+ compiletest::run_tests(&config);
+}
+
+#[test]
+fn compile_test() {
+ run_mode("compile-fail");
+}