From 63108425b44fa71aa11c5b1e5057e822f2c3c5a7 Mon Sep 17 00:00:00 2001 From: Woohyun Jung Date: Tue, 25 Apr 2023 10:41:59 +0900 Subject: [PATCH] Add unittest [ 76s] + ./nix [ 76s] [ 76s] running 66 tests [ 76s] test features::os::test_parsing_kernel_version ... ok [ 76s] test ifaddrs::tests::test_getifaddrs ... ok [ 76s] test ifaddrs::tests::test_getifaddrs_netmask_correct ... ok [ 76s] test sys::aio::t::casting ... ok [ 76s] test sys::select::tests::fdset_clear ... ok [ 76s] test sys::select::tests::fdset_fds ... ok [ 76s] test sys::select::tests::fdset_highest ... ok [ 76s] test sys::resource::test::test_self_cpu_time ... ok [ 76s] test sys::select::tests::fdset_insert ... ok [ 76s] test sys::select::tests::fdset_remove ... ok [ 76s] test sys::select::tests::test_select ... ok [ 76s] test sys::select::tests::test_select_nfds ... ok [ 76s] test sys::signal::tests::test_clear ... ok [ 76s] test sys::select::tests::test_select_nfds2 ... ok [ 76s] test sys::signal::tests::test_contains ... ok [ 76s] test sys::signal::tests::test_extend ... ok [ 76s] test sys::signal::tests::test_from_and_into_iterator ... ok [ 76s] test sys::signal::tests::test_from_sigset_t_unchecked ... ok [ 76s] test sys::signal::tests::test_from_str_invalid_value ... ok [ 76s] test sys::signal::tests::test_from_str_round_trips ... ok [ 76s] test sys::signal::tests::test_sigaction ... ok [ 76s] test sys::signalfd::tests::create_signalfd ... ok [ 76s] test sys::signal::tests::test_sigwait ... ok [ 76s] test sys::signalfd::tests::create_signalfd_with_opts ... ok [ 76s] test sys::signal::tests::test_thread_signal_swap ... ok [ 76s] test sys::signal::tests::test_thread_signal_set_mask ... ok [ 76s] test sys::signal::tests::test_thread_signal_block ... ok [ 76s] test sys::signalfd::tests::read_empty_signalfd ... ok [ 76s] test sys::signal::tests::test_thread_signal_unblock ... ok [ 76s] test sys::socket::addr::tests::link::linux_loopback ... ok [ 76s] test sys::socket::addr::tests::link::size ... ok [ 76s] test sys::socket::addr::tests::sockaddr_in6::size ... ok [ 76s] test sys::socket::addr::tests::sockaddr_in6::display ... ok [ 76s] test sys::socket::addr::tests::sockaddr_in6::to_and_from ... ok [ 76s] test sys::socket::addr::tests::sockaddr_in::display ... ok [ 76s] test sys::socket::addr::tests::sockaddr_in::size ... ok [ 76s] test sys::socket::addr::tests::sockaddr_storage::from_sockaddr_un_abstract_named ... ok [ 76s] test sys::socket::addr::tests::sockaddr_storage::from_sockaddr_un_abstract_unnamed ... ok [ 76s] test sys::socket::addr::tests::sockaddr_storage::from_sockaddr_un_named ... ok [ 76s] test sys::socket::addr::tests::types::test_ipv4addr_to_libc ... ok [ 76s] test sys::socket::addr::tests::unixaddr::abstract_sun_path ... ok [ 76s] test sys::socket::addr::tests::types::test_ipv6addr_to_libc ... ok [ 76s] test sys::socket::addr::tests::unixaddr::size ... ok [ 76s] test sys::socket::sockopt::test::can_get_listen_on_tcp_socket ... ok [ 76s] test sys::socket::sockopt::test::can_get_peercred_on_unix_socket ... ok [ 76s] test sys::socket::sockopt::test::is_socket_type_dgram ... ok [ 76s] test sys::socket::sockopt::test::is_socket_type_unix ... ok [ 76s] test sys::socket::test::test_recvmm2 ... FAILED [ 76s] test sys::socket::tests::can_use_cmsg_space ... ok [ 76s] test sys::statfs::test::fstatfs_call_strict ... ignored [ 76s] test sys::statfs::test::fstatfs_call ... ok [ 76s] test sys::statfs::test::statfs_call_strict ... ignored [ 76s] test sys::statvfs::test::fstatvfs_call ... ok [ 76s] test sys::statfs::test::statfs_call ... ok [ 76s] test sys::statvfs::test::statvfs_call ... ok [ 76s] test sys::termios::test::try_from ... ok [ 76s] test sys::time::test::test_timespec ... ok [ 76s] test sys::time::test::test_timespec_fmt ... ok [ 76s] test sys::time::test::test_timespec_neg ... ok [ 76s] test sys::time::test::test_timespec_from ... ok [ 76s] test sys::time::test::test_timeval ... ok [ 76s] test sys::time::test::test_timespec_ord ... ok [ 76s] test sys::time::test::test_timeval_fmt ... ok [ 76s] test sys::time::test::test_timeval_neg ... ok [ 76s] test sys::time::test::test_timeval_ord ... ok [ 76s] test sys::utsname::test::test_uname_linux ... ok [ 76s] [ 76s] failures: [ 76s] [ 76s] ---- sys::socket::test::test_recvmm2 stdout ---- [ 76s] Error: ENOPROTOOPT [ 76s] [ 76s] [ 76s] failures: [ 76s] sys::socket::test::test_recvmm2 [ 76s] [ 76s] test result: FAILED. 63 passed; 1 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.08s --- packaging/rust-nix.spec | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/packaging/rust-nix.spec b/packaging/rust-nix.spec index 19c9ca0..8e81fb6 100644 --- a/packaging/rust-nix.spec +++ b/packaging/rust-nix.spec @@ -102,6 +102,54 @@ cp %{SOURCE1} . %rust_dylib_extern static_assertions \ ./src/lib.rs +%check +%if 0%{?run_tests} + %{rustc_std_build} --test --crate-type=dylib \ + --crate-name=%{real_crate_name} \ + %{?rustc_edition:--edition=%{rustc_edition}} \ + --cfg='feature="acct"' \ + --cfg='feature="aio"' \ + --cfg='feature="dir"' \ + --cfg='feature="env"' \ + --cfg='feature="event"' \ + --cfg='feature="feature"' \ + --cfg='feature="fs"' \ + --cfg='feature="hostname"' \ + --cfg='feature="inotify"' \ + --cfg='feature="ioctl"' \ + --cfg='feature="kmod"' \ + --cfg='feature="mman"' \ + --cfg='feature="mount"' \ + --cfg='feature="mqueue"' \ + --cfg='feature="net"' \ + --cfg='feature="personality"' \ + --cfg='feature="poll"' \ + --cfg='feature="process"' \ + --cfg='feature="pthread"' \ + --cfg='feature="ptrace"' \ + --cfg='feature="quota"' \ + --cfg='feature="reboot"' \ + --cfg='feature="resource"' \ + --cfg='feature="sched"' \ + --cfg='feature="signal"' \ + --cfg='feature="socket"' \ + --cfg='feature="term"' \ + --cfg='feature="time"' \ + --cfg='feature="ucontext"' \ + --cfg='feature="uio"' \ + --cfg='feature="user"' \ + --cfg='feature="zerocopy"' \ + %rust_dylib_extern libc \ + %rust_dylib_extern cfg_if \ + %rust_dylib_extern bitflags \ + %rust_dylib_extern memoffset \ + %rust_dylib_extern pin_utils \ + %rust_dylib_extern static_assertions \ + ./src/lib.rs + +./%{real_crate_name} +%endif + # ========================================================== # install section # ========================================================== -- 2.7.4