summaryrefslogtreecommitdiffstats
path: root/tests-integration
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2020-03-20 21:06:50 -0700
committerGitHub <noreply@github.com>2020-03-20 21:06:50 -0700
commitdd27f1a259033cc6328ccad1f73f753e52976a65 (patch)
tree266ab5d9e0a0e035da6f97e064c2c6295d8c2c98 /tests-integration
parent5fd1b8f67c4a9976ed76f304484a4213283a3d6b (diff)
rt: remove `unsafe` from shell runtime. (#2333)
Since the original shell runtime was implemented, utilities have been added to encapsulate `unsafe`. The shell runtime is now able to use those utilities and not include its own `unsafe` code.
Diffstat (limited to 'tests-integration')
-rw-r--r--tests-integration/Cargo.toml1
-rw-r--r--tests-integration/tests/rt_shell.rs32
2 files changed, 33 insertions, 0 deletions
diff --git a/tests-integration/Cargo.toml b/tests-integration/Cargo.toml
index 6f84afd9..c6dd8450 100644
--- a/tests-integration/Cargo.toml
+++ b/tests-integration/Cargo.toml
@@ -15,6 +15,7 @@ full = [
"tokio-test"
]
macros = ["tokio/macros"]
+sync = ["tokio/sync"]
rt-core = ["tokio/rt-core"]
rt-threaded = ["rt-core", "tokio/rt-threaded"]
diff --git a/tests-integration/tests/rt_shell.rs b/tests-integration/tests/rt_shell.rs
new file mode 100644
index 00000000..392c0519
--- /dev/null
+++ b/tests-integration/tests/rt_shell.rs
@@ -0,0 +1,32 @@
+#![warn(rust_2018_idioms)]
+#![cfg(feature = "sync")]
+
+use tokio::runtime;
+use tokio::sync::oneshot;
+
+use std::sync::mpsc;
+use std::thread;
+
+#[test]
+fn basic_shell_rt() {
+ let (feed_tx, feed_rx) = mpsc::channel::<oneshot::Sender<()>>();
+
+ let th = thread::spawn(move || {
+ for tx in feed_rx.iter() {
+ tx.send(()).unwrap();
+ }
+ });
+
+ for _ in 0..1_000 {
+ let mut rt = runtime::Builder::new().build().unwrap();
+
+ let (tx, rx) = oneshot::channel();
+
+ feed_tx.send(tx).unwrap();
+
+ rt.block_on(rx).unwrap();
+ }
+
+ drop(feed_tx);
+ th.join().unwrap();
+}