From 2460521770e20ed3b14f9324b30fcd36dfefcbc0 Mon Sep 17 00:00:00 2001 From: fox0 <15684995+fox0@users.noreply.github.com> Date: Thu, 3 Apr 2025 20:52:20 +0700 Subject: [PATCH] Rename plib-testing v2 --- Cargo.lock | 32 +++++++++++++------ Cargo.toml | 5 ++- awk/Cargo.toml | 2 +- awk/tests/integration.rs | 2 +- calc/Cargo.toml | 2 +- calc/tests/bc/mod.rs | 2 +- calc/tests/expr/mod.rs | 2 +- datetime/Cargo.toml | 2 +- datetime/tests/time/mod.rs | 2 +- dev/Cargo.toml | 2 +- dev/tests/dev-tests.rs | 2 +- display/Cargo.toml | 2 +- display/tests/echo/mod.rs | 2 +- display/tests/more/mod.rs | 2 +- display/tests/printf/mod.rs | 2 +- file/Cargo.toml | 5 ++- file/tests/cmp/mod.rs | 2 +- file/tests/dd/mod.rs | 2 +- file/tests/file/mod.rs | 2 +- file/tests/find/mod.rs | 2 +- file/tests/od/mod.rs | 2 +- i18n/Cargo.toml | 5 ++- i18n/tests/gencat/mod.rs | 2 +- i18n/tests/iconv/mod.rs | 2 +- make/Cargo.toml | 2 +- make/tests/integration.rs | 2 +- misc/Cargo.toml | 2 +- misc/tests/false/mod.rs | 2 +- misc/tests/test/mod.rs | 2 +- misc/tests/true/mod.rs | 2 +- pathnames/Cargo.toml | 2 +- pathnames/tests/basename/mod.rs | 2 +- pathnames/tests/dirname/mod.rs | 2 +- pathnames/tests/realpath/mod.rs | 2 +- plib-testing/Cargo.toml | 16 ++++++++++ .../src/testing.rs => plib-testing/src/lib.rs | 0 plib/src/lib.rs | 1 - process/Cargo.toml | 10 +++--- process/tests/fuser/mod.rs | 2 +- process/tests/xargs/mod.rs | 2 +- sccs/Cargo.toml | 2 +- sccs/tests/what/mod.rs | 2 +- sh/Cargo.toml | 5 ++- sh/tests/integration.rs | 2 +- sys/Cargo.toml | 5 ++- sys/tests/getconf/mod.rs | 2 +- text/Cargo.toml | 3 +- text/tests/comm/mod.rs | 2 +- text/tests/csplit/mod.rs | 2 +- text/tests/cut/mod.rs | 2 +- text/tests/diff-tests.rs | 2 +- text/tests/expand/mod.rs | 2 +- text/tests/fold/mod.rs | 2 +- text/tests/grep/mod.rs | 2 +- text/tests/head/mod.rs | 4 +-- text/tests/join/mod.rs | 2 +- text/tests/nl/mod.rs | 2 +- text/tests/paste/mod.rs | 2 +- text/tests/pr/mod.rs | 2 +- text/tests/sed/mod.rs | 2 +- text/tests/sort/mod.rs | 2 +- text/tests/tail/mod.rs | 2 +- text/tests/tr/mod.rs | 2 +- text/tests/unexpand/mod.rs | 2 +- text/tests/uniq/mod.rs | 2 +- text/tests/wc/mod.rs | 2 +- tree/Cargo.toml | 5 +-- tree/tests/chgrp/mod.rs | 2 +- tree/tests/chmod/mod.rs | 2 +- tree/tests/cp/mod.rs | 2 +- tree/tests/link/mod.rs | 2 +- tree/tests/ls/mod.rs | 2 +- tree/tests/mkdir/mod.rs | 2 +- tree/tests/mv/mod.rs | 2 +- tree/tests/readlink/mod.rs | 2 +- tree/tests/rm/mod.rs | 2 +- tree/tests/rmdir/mod.rs | 2 +- tree/tests/tree-tests-umask.rs | 2 +- tree/tests/unlink/mod.rs | 2 +- users/Cargo.toml | 6 ++-- xform/Cargo.toml | 5 ++- xform/tests/cksum/mod.rs | 2 +- xform/tests/compress/mod.rs | 2 +- xform/tests/uue/mod.rs | 2 +- 84 files changed, 147 insertions(+), 98 deletions(-) create mode 100644 plib-testing/Cargo.toml rename plib/src/testing.rs => plib-testing/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 33330b4a4..b89dd7db7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1403,6 +1403,10 @@ dependencies = [ "libc", ] +[[package]] +name = "plib-testing" +version = "0.2.2" + [[package]] name = "portable-atomic" version = "1.11.0" @@ -1428,7 +1432,7 @@ dependencies = [ "libc", "pest", "pest_derive", - "plib", + "plib-testing", "rand", ] @@ -1441,7 +1445,7 @@ dependencies = [ "gettext-rs", "pest", "pest_derive", - "plib", + "plib-testing", "regex", "rustyline", ] @@ -1454,7 +1458,7 @@ dependencies = [ "clap", "gettext-rs", "libc", - "plib", + "plib-testing", ] [[package]] @@ -1466,7 +1470,7 @@ dependencies = [ "clap", "gettext-rs", "object", - "plib", + "plib-testing", ] [[package]] @@ -1476,7 +1480,7 @@ dependencies = [ "clap", "gettext-rs", "libc", - "plib", + "plib-testing", "termion", "thiserror 1.0.69", ] @@ -1489,6 +1493,7 @@ dependencies = [ "gettext-rs", "libc", "plib", + "plib-testing", "regex", "users", "walkdir", @@ -1512,6 +1517,7 @@ dependencies = [ "clap", "gettext-rs", "plib", + "plib-testing", "strum", "strum_macros", ] @@ -1542,7 +1548,7 @@ dependencies = [ "const_format", "gettext-rs", "libc", - "plib", + "plib-testing", "rowan", ] @@ -1553,7 +1559,7 @@ dependencies = [ "clap", "gettext-rs", "libc", - "plib", + "plib-testing", ] [[package]] @@ -1563,7 +1569,7 @@ dependencies = [ "clap", "gettext-rs", "libc", - "plib", + "plib-testing", ] [[package]] @@ -1578,6 +1584,7 @@ dependencies = [ "gettext-rs", "libc", "plib", + "plib-testing", "sysinfo", ] @@ -1587,7 +1594,7 @@ version = "0.2.2" dependencies = [ "clap", "gettext-rs", - "plib", + "plib-testing", ] [[package]] @@ -1608,7 +1615,7 @@ dependencies = [ "atty", "gettext-rs", "nix 0.29.0", - "plib", + "plib-testing", ] [[package]] @@ -1620,6 +1627,7 @@ dependencies = [ "gettext-rs", "libc", "plib", + "plib-testing", "uname", ] @@ -1635,6 +1643,7 @@ dependencies = [ "libc", "notify-debouncer-full", "plib", + "plib-testing", "proptest", "rand", "regex", @@ -1654,6 +1663,7 @@ dependencies = [ "gettext-rs", "libc", "plib", + "plib-testing", "regex", "tempfile", ] @@ -1669,6 +1679,7 @@ dependencies = [ "libc", "libcrypt-rs", "plib", + "plib-testing", "syslog", "thiserror 1.0.69", ] @@ -1682,6 +1693,7 @@ dependencies = [ "gettext-rs", "libc", "plib", + "plib-testing", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index d1412a65c..8e563ae2a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ members = [ "misc", "pathnames", "plib", + "plib-testing", "process", "sccs", "screen", @@ -43,6 +44,8 @@ regex = "1.10" gettext-rs = { path = "./gettext-rs" } errno = "0.3" chrono-tz = "0.10" +plib = { path = "./plib" } +plib-testing = { path = "./plib-testing" } +ftw = { path = "./ftw" } [workspace.lints] - diff --git a/awk/Cargo.toml b/awk/Cargo.toml index 6dc285a5f..480049341 100644 --- a/awk/Cargo.toml +++ b/awk/Cargo.toml @@ -16,7 +16,7 @@ lexical = { version = "6.1", features = ["format"] } rand = {version = "0.8", default-features = false, features = ["small_rng"] } [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/awk/tests/integration.rs b/awk/tests/integration.rs index 831356c88..0940017ac 100644 --- a/awk/tests/integration.rs +++ b/awk/tests/integration.rs @@ -1,4 +1,4 @@ -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; fn test_awk(args: Vec, expected_output: &str) { run_test(TestPlan { diff --git a/calc/Cargo.toml b/calc/Cargo.toml index d95b8005c..f9275daa6 100644 --- a/calc/Cargo.toml +++ b/calc/Cargo.toml @@ -16,7 +16,7 @@ bigdecimal = "0.4" rustyline = { version = "14.0", default-features = false } [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/calc/tests/bc/mod.rs b/calc/tests/bc/mod.rs index b9bf58afc..2681da41b 100644 --- a/calc/tests/bc/mod.rs +++ b/calc/tests/bc/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn test_bc(program: &str, expected_output: &str) { run_test(TestPlan { diff --git a/calc/tests/expr/mod.rs b/calc/tests/expr/mod.rs index 8cb428c21..b38f4e338 100644 --- a/calc/tests/expr/mod.rs +++ b/calc/tests/expr/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn expr_test(args: &[&str], expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/datetime/Cargo.toml b/datetime/Cargo.toml index 099fee0f2..4369c0781 100644 --- a/datetime/Cargo.toml +++ b/datetime/Cargo.toml @@ -14,7 +14,7 @@ chrono.workspace = true libc.workspace = true [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/datetime/tests/time/mod.rs b/datetime/tests/time/mod.rs index 7d4b0e4b1..86944a496 100644 --- a/datetime/tests/time/mod.rs +++ b/datetime/tests/time/mod.rs @@ -12,7 +12,7 @@ use std::{ process::{Command, Output, Stdio}, }; -use plib::testing::TestPlan; +use plib_testing::TestPlan; fn run_test_base(cmd: &str, args: &Vec, stdin_data: &[u8]) -> Output { let relpath = if cfg!(debug_assertions) { diff --git a/dev/Cargo.toml b/dev/Cargo.toml index f86abf0df..5dad6d13a 100644 --- a/dev/Cargo.toml +++ b/dev/Cargo.toml @@ -15,7 +15,7 @@ chrono.workspace = true ar = "0.9" [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/dev/tests/dev-tests.rs b/dev/tests/dev-tests.rs index 835d3f302..279fb9af0 100644 --- a/dev/tests/dev-tests.rs +++ b/dev/tests/dev-tests.rs @@ -1,5 +1,5 @@ use object::{Object, ObjectSection, ObjectSymbol}; -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; use std::fs; fn ar_compare_test( diff --git a/display/Cargo.toml b/display/Cargo.toml index a5acb137d..74b8ee4eb 100644 --- a/display/Cargo.toml +++ b/display/Cargo.toml @@ -16,7 +16,7 @@ termion = "4.0" thiserror = "1.0" [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/display/tests/echo/mod.rs b/display/tests/echo/mod.rs index 2a75891fc..164099346 100644 --- a/display/tests/echo/mod.rs +++ b/display/tests/echo/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn echo_test(args: &[&str], expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/display/tests/more/mod.rs b/display/tests/more/mod.rs index a1b3cc149..efca52fab 100644 --- a/display/tests/more/mod.rs +++ b/display/tests/more/mod.rs @@ -9,7 +9,7 @@ use std::process::Output; -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; fn test_checker_more(plan: &TestPlan, output: &Output) { let stdout = String::from_utf8_lossy(&output.stdout); diff --git a/display/tests/printf/mod.rs b/display/tests/printf/mod.rs index f04cc9602..4d69bd45f 100644 --- a/display/tests/printf/mod.rs +++ b/display/tests/printf/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; #[test] fn test_basic_string_output() { diff --git a/file/Cargo.toml b/file/Cargo.toml index 533e1630c..39c55286a 100644 --- a/file/Cargo.toml +++ b/file/Cargo.toml @@ -8,7 +8,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true libc.workspace = true @@ -16,6 +16,9 @@ regex.workspace = true walkdir = "2" users = "0.11" +[dev-dependencies] +plib-testing.workspace = true + [lints] workspace = true diff --git a/file/tests/cmp/mod.rs b/file/tests/cmp/mod.rs index badee5a37..af354d966 100644 --- a/file/tests/cmp/mod.rs +++ b/file/tests/cmp/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn run_test_helper( args: &[&str], diff --git a/file/tests/dd/mod.rs b/file/tests/dd/mod.rs index ff801e0c0..aa4f33a18 100644 --- a/file/tests/dd/mod.rs +++ b/file/tests/dd/mod.rs @@ -2,7 +2,7 @@ use std::fs::File; use std::io::Read; use std::path::PathBuf; -use plib::testing::{run_test_u8, TestPlanU8}; +use plib_testing::{run_test_u8, TestPlanU8}; fn get_test_file_path(filename: &str) -> PathBuf { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); diff --git a/file/tests/file/mod.rs b/file/tests/file/mod.rs index 5a9f7ba79..f276f6436 100644 --- a/file/tests/file/mod.rs +++ b/file/tests/file/mod.rs @@ -9,7 +9,7 @@ use std::{env, path::PathBuf}; -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn file_test(args: &[&str], expected_output: &str, expected_error: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/file/tests/find/mod.rs b/file/tests/find/mod.rs index 6d4138603..96b365aad 100644 --- a/file/tests/find/mod.rs +++ b/file/tests/find/mod.rs @@ -1,7 +1,7 @@ use std::fs::{remove_file, File}; use std::io::Write; -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn run_test_find( args: &[&str], diff --git a/file/tests/od/mod.rs b/file/tests/od/mod.rs index cdfdf6899..6d7fd0cd2 100644 --- a/file/tests/od/mod.rs +++ b/file/tests/od/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn od_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/i18n/Cargo.toml b/i18n/Cargo.toml index e4600c841..a87a6d67a 100644 --- a/i18n/Cargo.toml +++ b/i18n/Cargo.toml @@ -8,7 +8,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true bytemuck = { version = "1.17", features = ["derive"] } @@ -16,6 +16,9 @@ byteorder = "1.5" strum = "0.26" strum_macros = "0.26" +[dev-dependencies] +plib-testing.workspace = true + [lints] workspace = true diff --git a/i18n/tests/gencat/mod.rs b/i18n/tests/gencat/mod.rs index 5c4fbf0ae..b7766aa63 100644 --- a/i18n/tests/gencat/mod.rs +++ b/i18n/tests/gencat/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test_u8, TestPlanU8}; +use plib_testing::{run_test_u8, TestPlanU8}; use std::env; use std::path::PathBuf; use std::{fs::File, io::Read}; diff --git a/i18n/tests/iconv/mod.rs b/i18n/tests/iconv/mod.rs index 47b63ca70..ef4a2aa01 100644 --- a/i18n/tests/iconv/mod.rs +++ b/i18n/tests/iconv/mod.rs @@ -8,7 +8,7 @@ // #![allow(non_snake_case)] -use plib::testing::{run_test_u8, TestPlanU8}; +use plib_testing::{run_test_u8, TestPlanU8}; use std::env; use std::path::PathBuf; use std::{fs::File, io::Read}; diff --git a/make/Cargo.toml b/make/Cargo.toml index 1e16e41d2..b24ce786a 100644 --- a/make/Cargo.toml +++ b/make/Cargo.toml @@ -14,7 +14,7 @@ const_format = "0.2" rowan = "0.15" [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [[bin]] name = "make" diff --git a/make/tests/integration.rs b/make/tests/integration.rs index 9a583df0c..f5b261cfa 100644 --- a/make/tests/integration.rs +++ b/make/tests/integration.rs @@ -12,7 +12,7 @@ use std::fs::{remove_file, File}; use std::io::Write; use std::process::{Child, Command, Stdio}; -use plib::testing::{run_test, run_test_base, TestPlan}; +use plib_testing::{run_test, run_test_base, TestPlan}; use posixutils_make::error_code::ErrorCode; diff --git a/misc/Cargo.toml b/misc/Cargo.toml index cdc4ec864..006194c48 100644 --- a/misc/Cargo.toml +++ b/misc/Cargo.toml @@ -13,7 +13,7 @@ libc.workspace = true gettext-rs.workspace = true [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/misc/tests/false/mod.rs b/misc/tests/false/mod.rs index 694ded2f3..6495e776f 100644 --- a/misc/tests/false/mod.rs +++ b/misc/tests/false/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn truefalse_test(cmd: &str, expected_exit_code: i32) { run_test(TestPlan { diff --git a/misc/tests/test/mod.rs b/misc/tests/test/mod.rs index 3006e1d28..1d2299030 100644 --- a/misc/tests/test/mod.rs +++ b/misc/tests/test/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn test_test(args: &[&str], expected_code: i32) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/misc/tests/true/mod.rs b/misc/tests/true/mod.rs index 9d6972bb1..92c18eb2b 100644 --- a/misc/tests/true/mod.rs +++ b/misc/tests/true/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn truefalse_test(cmd: &str, expected_exit_code: i32) { run_test(TestPlan { diff --git a/pathnames/Cargo.toml b/pathnames/Cargo.toml index ceba04ecf..d36ffb5da 100644 --- a/pathnames/Cargo.toml +++ b/pathnames/Cargo.toml @@ -13,7 +13,7 @@ gettext-rs.workspace = true libc.workspace = true [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/pathnames/tests/basename/mod.rs b/pathnames/tests/basename/mod.rs index 6425fd03b..5c96d7f73 100644 --- a/pathnames/tests/basename/mod.rs +++ b/pathnames/tests/basename/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; #[test] fn basename_basic() { diff --git a/pathnames/tests/dirname/mod.rs b/pathnames/tests/dirname/mod.rs index 1722e0af0..af58dc8e0 100644 --- a/pathnames/tests/dirname/mod.rs +++ b/pathnames/tests/dirname/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; #[test] fn dirname_basic() { diff --git a/pathnames/tests/realpath/mod.rs b/pathnames/tests/realpath/mod.rs index db215c40a..c887d2998 100644 --- a/pathnames/tests/realpath/mod.rs +++ b/pathnames/tests/realpath/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn realpath_test(args: &[&str], stdout: &str, stderr: &str, expected_code: i32) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/plib-testing/Cargo.toml b/plib-testing/Cargo.toml new file mode 100644 index 000000000..9d3a30b90 --- /dev/null +++ b/plib-testing/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "plib-testing" +version = "0.2.2" +authors = ["Jeff Garzik"] +repository.workspace = true +license.workspace = true +edition.workspace = true +rust-version.workspace = true + +[dependencies] + +[lints] +workspace = true + +[lib] +doctest = false diff --git a/plib/src/testing.rs b/plib-testing/src/lib.rs similarity index 100% rename from plib/src/testing.rs rename to plib-testing/src/lib.rs diff --git a/plib/src/lib.rs b/plib/src/lib.rs index de06edd6c..8e710d0b2 100644 --- a/plib/src/lib.rs +++ b/plib/src/lib.rs @@ -15,7 +15,6 @@ pub mod modestr; pub mod platform; pub mod priority; pub mod sccsfile; -pub mod testing; pub mod utmpx; pub const BUFSZ: usize = 8 * 1024; diff --git a/process/Cargo.toml b/process/Cargo.toml index db18ec6d5..9884fb61d 100644 --- a/process/Cargo.toml +++ b/process/Cargo.toml @@ -8,7 +8,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true libc.workspace = true @@ -16,16 +16,16 @@ chrono.workspace = true dirs = "5.0" chrono-tz.workspace = true +[dev-dependencies] +plib-testing.workspace = true +sysinfo = "0.31" + [build-dependencies] bindgen = { version = "0.70.0", features = ["runtime"] } [lints] workspace = true -[dev-dependencies] -sysinfo = "0.31" - - [[bin]] name = "batch" path = "./batch.rs" diff --git a/process/tests/fuser/mod.rs b/process/tests/fuser/mod.rs index 85b6d82a2..f7a62eb9d 100644 --- a/process/tests/fuser/mod.rs +++ b/process/tests/fuser/mod.rs @@ -1,4 +1,4 @@ -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; use std::process::Output; mod basic; diff --git a/process/tests/xargs/mod.rs b/process/tests/xargs/mod.rs index 15ad9221e..a1d5a5198 100644 --- a/process/tests/xargs/mod.rs +++ b/process/tests/xargs/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn xargs_test(test_data: &str, expected_output: &str, args: Vec<&str>) { run_test(TestPlan { diff --git a/sccs/Cargo.toml b/sccs/Cargo.toml index caaa880a0..d3afe698d 100644 --- a/sccs/Cargo.toml +++ b/sccs/Cargo.toml @@ -12,7 +12,7 @@ clap.workspace = true gettext-rs.workspace = true [dev-dependencies] -plib = { path = "../plib" } +plib-testing.workspace = true [lints] workspace = true diff --git a/sccs/tests/what/mod.rs b/sccs/tests/what/mod.rs index ac07b259e..23c452ea0 100644 --- a/sccs/tests/what/mod.rs +++ b/sccs/tests/what/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::path::PathBuf; fn test_file_path(file_name: &str) -> PathBuf { diff --git a/sh/Cargo.toml b/sh/Cargo.toml index d13403eb9..f87f5fb58 100644 --- a/sh/Cargo.toml +++ b/sh/Cargo.toml @@ -4,11 +4,14 @@ version = "0.1.7" edition = "2021" [dependencies] -plib = { path = "../plib" } +#plib.workspace = true gettext-rs.workspace = true nix = { version = "0.29", features = ["process", "fs", "resource", "signal", "user", "term"] } atty = "0.2" +[dev-dependencies] +plib-testing.workspace = true + [[bin]] name = "sh" path = "src/main.rs" diff --git a/sh/tests/integration.rs b/sh/tests/integration.rs index 046b53278..b333747d3 100644 --- a/sh/tests/integration.rs +++ b/sh/tests/integration.rs @@ -1,4 +1,4 @@ -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; use std::path::Path; use std::process::Output; use std::sync::atomic::{AtomicBool, Ordering}; diff --git a/sys/Cargo.toml b/sys/Cargo.toml index 98a558bcd..ef7ac880d 100644 --- a/sys/Cargo.toml +++ b/sys/Cargo.toml @@ -8,13 +8,16 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true uname = "0.1" libc.workspace = true chrono.workspace = true +[dev-dependencies] +plib-testing.workspace = true + [lints] workspace = true diff --git a/sys/tests/getconf/mod.rs b/sys/tests/getconf/mod.rs index 91564bf9c..9b4a4aaa6 100644 --- a/sys/tests/getconf/mod.rs +++ b/sys/tests/getconf/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; use std::process::Output; fn run_getconf_test(args: Vec<&str>, expected_exit_code: i32, check_fn: fn(&TestPlan, &Output)) { diff --git a/text/Cargo.toml b/text/Cargo.toml index 2689da69b..1dce830b2 100644 --- a/text/Cargo.toml +++ b/text/Cargo.toml @@ -8,7 +8,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true topological-sort = "0.2" @@ -22,6 +22,7 @@ dirs = "5.0" walkdir = "2" [dev-dependencies] +plib-testing.workspace = true proptest = "1" rand = "0.8" diff --git a/text/tests/comm/mod.rs b/text/tests/comm/mod.rs index b32773824..77cbb4691 100644 --- a/text/tests/comm/mod.rs +++ b/text/tests/comm/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::fs; use std::path::PathBuf; diff --git a/text/tests/csplit/mod.rs b/text/tests/csplit/mod.rs index 6c557907c..64ffa3499 100644 --- a/text/tests/csplit/mod.rs +++ b/text/tests/csplit/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn csplit_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/text/tests/cut/mod.rs b/text/tests/cut/mod.rs index 7df519463..1790126db 100644 --- a/text/tests/cut/mod.rs +++ b/text/tests/cut/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn cut_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/text/tests/diff-tests.rs b/text/tests/diff-tests.rs index 8f159c23b..42f6c8dcf 100644 --- a/text/tests/diff-tests.rs +++ b/text/tests/diff-tests.rs @@ -12,7 +12,7 @@ mod constants; use constants::{EXIT_STATUS_DIFFERENCE, EXIT_STATUS_NO_DIFFERENCE}; -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::{collections::HashMap, path::PathBuf, process::Stdio, sync::LazyLock}; fn diff_test(args: &[&str], expected_output: &str, expected_diff_exit_status: u8) { diff --git a/text/tests/expand/mod.rs b/text/tests/expand/mod.rs index e1c4e6b67..1f5d4ab65 100644 --- a/text/tests/expand/mod.rs +++ b/text/tests/expand/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn expand_test_noargs(test_data: &str, expected_output: &str) { run_test(TestPlan { diff --git a/text/tests/fold/mod.rs b/text/tests/fold/mod.rs index 537fd19a8..9a84b6baa 100644 --- a/text/tests/fold/mod.rs +++ b/text/tests/fold/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::fs::File; use std::io::Read; use std::path::PathBuf; diff --git a/text/tests/grep/mod.rs b/text/tests/grep/mod.rs index 49ef06f6d..a06aa1ce7 100644 --- a/text/tests/grep/mod.rs +++ b/text/tests/grep/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; const LINES_INPUT: &str = "line_{1}\np_line_{2}_s\n line_{3} \nLINE_{4}\np_LINE_{5}_s\nl_{6}\nline_{70}\n"; diff --git a/text/tests/head/mod.rs b/text/tests/head/mod.rs index e739ff34d..1da3ab455 100644 --- a/text/tests/head/mod.rs +++ b/text/tests/head/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use rand::{seq::SliceRandom, thread_rng}; /* #region Normal tests */ @@ -121,7 +121,7 @@ fn test_head_c() { /* #region Property-based tests */ mod property_tests { - use plib::testing::run_test_base; + use plib_testing::run_test_base; use proptest::{prelude::TestCaseError, prop_assert, test_runner::TestRunner}; use std::{ sync::mpsc::{self, RecvTimeoutError}, diff --git a/text/tests/join/mod.rs b/text/tests/join/mod.rs index b95564ca9..bae812038 100644 --- a/text/tests/join/mod.rs +++ b/text/tests/join/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn run_test_join( args: &[&str], diff --git a/text/tests/nl/mod.rs b/text/tests/nl/mod.rs index 151423b25..43cd6d2c6 100644 --- a/text/tests/nl/mod.rs +++ b/text/tests/nl/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn nl_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/text/tests/paste/mod.rs b/text/tests/paste/mod.rs index b7883e833..a296e0f30 100644 --- a/text/tests/paste/mod.rs +++ b/text/tests/paste/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; +use plib_testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; use std::fs; use std::path::PathBuf; diff --git a/text/tests/pr/mod.rs b/text/tests/pr/mod.rs index 18ad60066..a60a2260b 100644 --- a/text/tests/pr/mod.rs +++ b/text/tests/pr/mod.rs @@ -9,7 +9,7 @@ // use chrono::{DateTime, Local}; -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; use regex::Regex; use std::fs; use std::io::Read; diff --git a/text/tests/sed/mod.rs b/text/tests/sed/mod.rs index 8f4048d51..ed2f469f6 100644 --- a/text/tests/sed/mod.rs +++ b/text/tests/sed/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn sed_test( args: &[&str], diff --git a/text/tests/sort/mod.rs b/text/tests/sort/mod.rs index 1474283e7..994a45d7c 100644 --- a/text/tests/sort/mod.rs +++ b/text/tests/sort/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn sort_test( args: &[&str], diff --git a/text/tests/tail/mod.rs b/text/tests/tail/mod.rs index 1b316c20a..6104fe831 100644 --- a/text/tests/tail/mod.rs +++ b/text/tests/tail/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; +use plib_testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; fn tail_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args = args.iter().map(|st| (*st).to_owned()).collect::>(); diff --git a/text/tests/tr/mod.rs b/text/tests/tr/mod.rs index 1dde94878..e67519a6b 100644 --- a/text/tests/tr/mod.rs +++ b/text/tests/tr/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; +use plib_testing::{run_test, run_test_u8, TestPlan, TestPlanU8}; fn tr_test_binary(args: &[&str], test_data: &[u8], expected_output: &[u8]) { let str_args = args diff --git a/text/tests/unexpand/mod.rs b/text/tests/unexpand/mod.rs index 31d40f0c1..92430fbfc 100644 --- a/text/tests/unexpand/mod.rs +++ b/text/tests/unexpand/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn unexpand_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/text/tests/uniq/mod.rs b/text/tests/uniq/mod.rs index e94d06262..391956959 100644 --- a/text/tests/uniq/mod.rs +++ b/text/tests/uniq/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn uniq_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/text/tests/wc/mod.rs b/text/tests/wc/mod.rs index 0b8a20e1f..58c6cd363 100644 --- a/text/tests/wc/mod.rs +++ b/text/tests/wc/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn wc_test(args: &[&str], test_data: &str, expected_output: &str) { let str_args: Vec = args.iter().map(|s| String::from(*s)).collect(); diff --git a/tree/Cargo.toml b/tree/Cargo.toml index 7aa734b12..395a0edff 100644 --- a/tree/Cargo.toml +++ b/tree/Cargo.toml @@ -8,8 +8,8 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } -ftw = { path = "../ftw" } +plib.workspace = true +ftw.workspace = true clap.workspace = true gettext-rs.workspace = true libc.workspace = true @@ -18,6 +18,7 @@ chrono.workspace = true errno.workspace = true [dev-dependencies] +plib-testing.workspace = true tempfile = "3.10" [features] diff --git a/tree/tests/chgrp/mod.rs b/tree/tests/chgrp/mod.rs index 67975f932..a757d1827 100644 --- a/tree/tests/chgrp/mod.rs +++ b/tree/tests/chgrp/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::{ ffi::{CStr, CString}, fs, io, diff --git a/tree/tests/chmod/mod.rs b/tree/tests/chmod/mod.rs index 7b02b6b00..31430dd8f 100644 --- a/tree/tests/chmod/mod.rs +++ b/tree/tests/chmod/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::{ fs, os::unix::{self, fs::PermissionsExt}, diff --git a/tree/tests/cp/mod.rs b/tree/tests/cp/mod.rs index 6ccc0d97a..fccb441bc 100644 --- a/tree/tests/cp/mod.rs +++ b/tree/tests/cp/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::ffi::CString; use std::io::{Read, Write}; use std::os::unix::fs::FileTypeExt; diff --git a/tree/tests/link/mod.rs b/tree/tests/link/mod.rs index 31e12ef90..54a67d0ba 100644 --- a/tree/tests/link/mod.rs +++ b/tree/tests/link/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; use std::fs; use std::io::Write; use std::path::PathBuf; diff --git a/tree/tests/ls/mod.rs b/tree/tests/ls/mod.rs index 284f18bd8..a4c1dd1ab 100644 --- a/tree/tests/ls/mod.rs +++ b/tree/tests/ls/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; use regex::Regex; use std::ffi::CString; use std::fs; diff --git a/tree/tests/mkdir/mod.rs b/tree/tests/mkdir/mod.rs index 50f964348..94d8bfd12 100644 --- a/tree/tests/mkdir/mod.rs +++ b/tree/tests/mkdir/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; use std::fs; use std::path::Path; use std::process::Output; diff --git a/tree/tests/mv/mod.rs b/tree/tests/mv/mod.rs index 01ff29b81..6d7053065 100644 --- a/tree/tests/mv/mod.rs +++ b/tree/tests/mv/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::ffi::CString; use std::fs::{self, Permissions}; use std::io::{self, Read, Write}; diff --git a/tree/tests/readlink/mod.rs b/tree/tests/readlink/mod.rs index 644b39e14..22d941f15 100644 --- a/tree/tests/readlink/mod.rs +++ b/tree/tests/readlink/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::fs::File; use std::io::Write; use std::os::unix::fs::symlink; diff --git a/tree/tests/rm/mod.rs b/tree/tests/rm/mod.rs index f8496dc39..12d8976be 100644 --- a/tree/tests/rm/mod.rs +++ b/tree/tests/rm/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; use std::ffi::CString; use std::fs; use std::io::{self, Write}; diff --git a/tree/tests/rmdir/mod.rs b/tree/tests/rmdir/mod.rs index de82ac455..84ef8b9b6 100644 --- a/tree/tests/rmdir/mod.rs +++ b/tree/tests/rmdir/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test_with_checker, TestPlan}; +use plib_testing::{run_test_with_checker, TestPlan}; use std::fs; use std::path::Path; use std::process::Output; diff --git a/tree/tests/tree-tests-umask.rs b/tree/tests/tree-tests-umask.rs index f5bd4c331..6fc30cb4c 100644 --- a/tree/tests/tree-tests-umask.rs +++ b/tree/tests/tree-tests-umask.rs @@ -11,7 +11,7 @@ //! in `tree-tests.rs`. They are located here in `tree-tests-umask.rs` so that they can have a //! different per-process umask than those in `tree-tests.rs`. -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::{ fs, os::unix::fs::{DirBuilderExt, MetadataExt, PermissionsExt}, diff --git a/tree/tests/unlink/mod.rs b/tree/tests/unlink/mod.rs index c60c96c6c..e85843369 100644 --- a/tree/tests/unlink/mod.rs +++ b/tree/tests/unlink/mod.rs @@ -8,7 +8,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, run_test_with_checker, TestPlan}; +use plib_testing::{run_test, run_test_with_checker, TestPlan}; use std::fs; use tempfile::tempdir; diff --git a/users/Cargo.toml b/users/Cargo.toml index c1a401b17..f382f60a7 100644 --- a/users/Cargo.toml +++ b/users/Cargo.toml @@ -8,7 +8,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true gettext-rs.workspace = true libc.workspace = true @@ -18,10 +18,12 @@ libcrypt-rs = "0.1" thiserror = "1.0" binrw = "0.14" +[dev-dependencies] +plib-testing.workspace = true + [lints] workspace = true - [[bin]] name = "id" path = "./id.rs" diff --git a/xform/Cargo.toml b/xform/Cargo.toml index 73ce49796..0aef8c045 100644 --- a/xform/Cargo.toml +++ b/xform/Cargo.toml @@ -8,12 +8,15 @@ edition.workspace = true rust-version.workspace = true [dependencies] -plib = { path = "../plib" } +plib.workspace = true clap.workspace = true libc.workspace = true gettext-rs.workspace = true base64 = "0.21" +[dev-dependencies] +plib-testing.workspace = true + [lints] workspace = true diff --git a/xform/tests/cksum/mod.rs b/xform/tests/cksum/mod.rs index 83cdbf5ee..7fda90bb1 100644 --- a/xform/tests/cksum/mod.rs +++ b/xform/tests/cksum/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; fn cksum_test(test_data: &str, expected_output: &str) { run_test(TestPlan { diff --git a/xform/tests/compress/mod.rs b/xform/tests/compress/mod.rs index cdd00915e..553deceb5 100644 --- a/xform/tests/compress/mod.rs +++ b/xform/tests/compress/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::{ fs::{remove_file, File}, io::Read, diff --git a/xform/tests/uue/mod.rs b/xform/tests/uue/mod.rs index 022a39bcb..ed71e1ede 100644 --- a/xform/tests/uue/mod.rs +++ b/xform/tests/uue/mod.rs @@ -7,7 +7,7 @@ // SPDX-License-Identifier: MIT // -use plib::testing::{run_test, TestPlan}; +use plib_testing::{run_test, TestPlan}; use std::{ fs::{File, Permissions}, io::Read,