diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 8163d07f5cfbb..5df5d3847597a 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -9,14 +9,14 @@ license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/libc" [dependencies] +annotate-snippets = { version = "0.11.5", features = ["testing-colors"] } cfg-if = "1.0.1" libc = { path = "..", version = "1.0.0-alpha.1", default-features = false } +proc-macro2 = { version = "1.0.95", features = ["span-locations"] } +syn = { version = "2.0.104", features = ["full", "visit"] } [dev-dependencies] -syn = { version = "2.0.104", features = ["full", "visit"] } -proc-macro2 = { version = "1.0.95", features = ["span-locations"] } glob = "0.3.2" -annotate-snippets = { version = "0.11.5", features = ["testing-colors"] } [build-dependencies] cc = "1.2.29" @@ -30,79 +30,44 @@ extra_traits = ["libc/extra_traits"] [[test]] name = "main" -path = "test/main.rs" +path = "tests/main.rs" harness = false [[test]] name = "linux-fcntl" -path = "test/linux_fcntl.rs" +path = "tests/linux_fcntl.rs" harness = false [[test]] name = "linux-if-arp" -path = "test/linux_if_arp.rs" +path = "tests/linux_if_arp.rs" harness = false [[test]] name = "linux-ipv6" -path = "test/linux_ipv6.rs" +path = "tests/linux_ipv6.rs" harness = false [[test]] name = "linux-elf" -path = "test/linux_elf.rs" +path = "tests/linux_elf.rs" harness = false [[test]] name = "linux-strerror_r" -path = "test/linux_strerror_r.rs" +path = "tests/linux_strerror_r.rs" harness = false [[test]] name = "linux-termios" -path = "test/linux_termios.rs" +path = "tests/linux_termios.rs" harness = false -[[test]] -name = "cmsg" -path = "test/cmsg.rs" -harness = true - -[[test]] -name = "makedev" -path = "test/makedev.rs" -harness = true - -[[test]] -name = "errqueue" -path = "test/errqueue.rs" -harness = true - -[[test]] -name = "sigrt" -path = "test/sigrt.rs" -harness = true - [[test]] name = "semver" -path = "test/semver.rs" +path = "tests/semver.rs" harness = false -[[test]] -name = "primitive_types" -path = "test/primitive_types.rs" -harness = true - -[[test]] -name = "style" -path = "test/check_style.rs" -harness = true - -[[test]] -name = "style_tests" -path = "test/style_tests.rs" -harness = true - # FIXME(msrv): These should be moved to the root Cargo.toml as `[workspace.lints.*]` # once MSRV is above 1.64 and replaced with `[lints] workspace=true` diff --git a/libc-test/src/lib.rs b/libc-test/src/lib.rs new file mode 100644 index 0000000000000..b878bb2c484e9 --- /dev/null +++ b/libc-test/src/lib.rs @@ -0,0 +1 @@ +pub mod style; diff --git a/libc-test/test/style/mod.rs b/libc-test/src/style.rs similarity index 99% rename from libc-test/test/style/mod.rs rename to libc-test/src/style.rs index cc953d32c3aed..3822ad677b880 100644 --- a/libc-test/test/style/mod.rs +++ b/libc-test/src/style.rs @@ -37,6 +37,9 @@ use syn::spanned::Spanned; use syn::visit::{self, Visit}; use syn::Token; +#[cfg(test)] +mod tests; + const ALLOWED_REPEATED_MACROS: &[&str] = &["s", "s_no_extra_traits", "s_paren"]; pub type Error = Box; diff --git a/libc-test/test/style_tests.rs b/libc-test/src/style/tests.rs similarity index 99% rename from libc-test/test/style_tests.rs rename to libc-test/src/style/tests.rs index be8fddbccf644..5e7f506c33c7e 100644 --- a/libc-test/test/style_tests.rs +++ b/libc-test/src/style/tests.rs @@ -1,8 +1,6 @@ //! Verifies the implementation of the style checker in [style]. -use style::StyleChecker; - -pub mod style; +use super::StyleChecker; #[test] fn check_style_accept_correct_module_layout() { diff --git a/libc-test/test/cmsg.rs b/libc-test/tests/cmsg.rs similarity index 100% rename from libc-test/test/cmsg.rs rename to libc-test/tests/cmsg.rs diff --git a/libc-test/test/errqueue.rs b/libc-test/tests/errqueue.rs similarity index 100% rename from libc-test/test/errqueue.rs rename to libc-test/tests/errqueue.rs diff --git a/libc-test/test/linux_elf.rs b/libc-test/tests/linux_elf.rs similarity index 100% rename from libc-test/test/linux_elf.rs rename to libc-test/tests/linux_elf.rs diff --git a/libc-test/test/linux_fcntl.rs b/libc-test/tests/linux_fcntl.rs similarity index 100% rename from libc-test/test/linux_fcntl.rs rename to libc-test/tests/linux_fcntl.rs diff --git a/libc-test/test/linux_if_arp.rs b/libc-test/tests/linux_if_arp.rs similarity index 100% rename from libc-test/test/linux_if_arp.rs rename to libc-test/tests/linux_if_arp.rs diff --git a/libc-test/test/linux_ipv6.rs b/libc-test/tests/linux_ipv6.rs similarity index 100% rename from libc-test/test/linux_ipv6.rs rename to libc-test/tests/linux_ipv6.rs diff --git a/libc-test/test/linux_kernel_version.rs b/libc-test/tests/linux_kernel_version.rs similarity index 100% rename from libc-test/test/linux_kernel_version.rs rename to libc-test/tests/linux_kernel_version.rs diff --git a/libc-test/test/linux_strerror_r.rs b/libc-test/tests/linux_strerror_r.rs similarity index 100% rename from libc-test/test/linux_strerror_r.rs rename to libc-test/tests/linux_strerror_r.rs diff --git a/libc-test/test/linux_termios.rs b/libc-test/tests/linux_termios.rs similarity index 100% rename from libc-test/test/linux_termios.rs rename to libc-test/tests/linux_termios.rs diff --git a/libc-test/test/main.rs b/libc-test/tests/main.rs similarity index 100% rename from libc-test/test/main.rs rename to libc-test/tests/main.rs diff --git a/libc-test/test/makedev.rs b/libc-test/tests/makedev.rs similarity index 100% rename from libc-test/test/makedev.rs rename to libc-test/tests/makedev.rs diff --git a/libc-test/test/primitive_types.rs b/libc-test/tests/primitive_types.rs similarity index 100% rename from libc-test/test/primitive_types.rs rename to libc-test/tests/primitive_types.rs diff --git a/libc-test/test/semver.rs b/libc-test/tests/semver.rs similarity index 100% rename from libc-test/test/semver.rs rename to libc-test/tests/semver.rs diff --git a/libc-test/test/sigrt.rs b/libc-test/tests/sigrt.rs similarity index 100% rename from libc-test/test/sigrt.rs rename to libc-test/tests/sigrt.rs diff --git a/libc-test/test/check_style.rs b/libc-test/tests/style.rs similarity index 96% rename from libc-test/test/check_style.rs rename to libc-test/tests/style.rs index 24f793e4feb86..a088283d7330b 100644 --- a/libc-test/test/check_style.rs +++ b/libc-test/tests/style.rs @@ -9,12 +9,10 @@ //! cargo test --test style //! ``` -pub mod style; - use std::env; use std::path::Path; -use style::{Result, StyleChecker}; +use libc_test::style::{Result, StyleChecker}; /// Relative to `src/`. const SKIP_PREFIXES: &[&str] = &[