Add unittest accepted/tizen_rust tizen accepted/tizen/rust/20231016.020759
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 14 Apr 2023 02:05:09 +0000 (11:05 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Sun, 16 Apr 2023 23:01:04 +0000 (08:01 +0900)
[   20s] + ./async_executor
[   20s]
[   20s] running 5 tests
[   20s] test drop_executor_and_then_drop_finished_task ... ok
[   20s] test await_task_after_dropping_executor ... ok
[   20s] test leaked_executor_leaks_everything ... ok
[   20s] test executor_cancels_everything ... ok
[   20s] test drop_finished_task_and_then_drop_executor ... ok
[   20s]
[   20s] test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

packaging/extern.patch [deleted file]
packaging/rust-async-executor.spec

diff --git a/packaging/extern.patch b/packaging/extern.patch
deleted file mode 100644 (file)
index 119357b..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-diff --git a/src/lib.rs b/src/lib.rs
-index 24fbfac..29a30d4 100644
---- a/src/lib.rs
-+++ b/src/lib.rs
-@@ -20,6 +20,13 @@
- #![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)]
-+extern crate futures_lite;
-+extern crate async_lock;
-+extern crate async_task;
-+extern crate concurrent_queue;
-+extern crate slab;
-+extern crate fastrand;
-+
- use std::future::Future;
- use std::marker::PhantomData;
- use std::panic::{RefUnwindSafe, UnwindSafe};
index def6d61370bee6a84773f3f9eca86562b36f1e55..a0a6787b58ba4fae7b39672c401788dfc4486bdf 100644 (file)
@@ -15,7 +15,6 @@ License:        Apache-2.0 OR MIT
 URL:            https://crates.io/crates/async-executor
 Source:         %{crate}-%{version}.tar.gz
 Source1:        %{name}.manifest
-Source2:        extern.patch
 
 # ==========================================================
 # BuildRequires
@@ -39,11 +38,13 @@ Requires:       rust-slab
 # ==========================================================
 # dev-dependencies
 # ==========================================================
+%if 0%{?run_tests}
 # BuildRequires:  rust-async-channel 
 # BuildRequires:  rust-async-io 
 # BuildRequires:  rust-easy-parallel 
 # BuildRequires:  rust-num_cpus 
-# BuildRequires:  rust-once_cell 
+BuildRequires:  rust-once_cell 
+%endif
 
 
 %description
@@ -52,7 +53,6 @@ Async executor.
 %prep
 %setup -q
 cp %{SOURCE1} .
-%{__patch} -p1 < %{SOURCE2}
 
 # ==========================================================
 # build section
@@ -62,6 +62,12 @@ cp %{SOURCE1} .
 %{rustc_std_build} --crate-type=dylib \
         --crate-name=%{real_crate_name} \
         %{?rustc_edition:--edition=%{rustc_edition}} \
+        %rust_dylib_extern futures_lite \
+        %rust_dylib_extern async_lock \
+        %rust_dylib_extern async_task \
+        %rust_dylib_extern concurrent_queue \
+        %rust_dylib_extern slab \
+        %rust_dylib_extern fastrand \
         ./src/lib.rs
 
 # ==========================================================
@@ -71,6 +77,24 @@ cp %{SOURCE1} .
 install -d -m 0755 %{buildroot}%{_rust_dylibdir}
 install -m 0644 lib%{real_crate_name}.so %{buildroot}/%{_rust_dylibdir}/lib%{real_crate_name}.so
 
+%check
+%if 0%{?run_tests}
+%{rustc_std_build} --test --crate-type=dylib \
+        --crate-name=%{real_crate_name} \
+        %{?rustc_edition:--edition=%{rustc_edition}} \
+        --extern %{real_crate_name}=lib%{real_crate_name}.so \
+        %rust_dylib_extern futures_lite \
+        %rust_dylib_extern async_lock \
+        %rust_dylib_extern async_task \
+        %rust_dylib_extern concurrent_queue \
+        %rust_dylib_extern slab \
+        %rust_dylib_extern fastrand \
+        %rust_dylib_extern once_cell \
+        ./tests/drop.rs
+
+./%{real_crate_name} 
+%endif
+
 %clean
 
 %post -p /sbin/ldconfig