aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJitendra Bhati <bhatijitendra2022@gmail.com>2026-06-04 17:04:51 +0000
committerAlan Somers <asomers@FreeBSD.org>2026-06-05 15:16:20 +0000
commitc606eb37135d3e9cfea4d34c147699e0713dd5d2 (patch)
tree6f2ff547c393655b5861159994bbe79f8505aea9
parentf4424a2733867ec5f12ecd196011ce8df096f522 (diff)
fts: address post-merge feedback on fts_children_test.c
- Remove fts_check_debug() which is only needed by test cases that use the fts_test() helper; fts_children_test.c does not call fts_test() - Remove fts_lexical_compar where traversal order does not matter for the test result - Drop fts_test.h and copy fts_lexical_compar locally - Pull up NULL argument onto same line as fts_open Fixes: e624417db8a1 ("lib/libc/tests/gen: add fts_children() tests") Sponsored by: Google LLC (GSoC 2026) Reviewed by: des, asomers MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/2260
-rw-r--r--lib/libc/tests/gen/fts_children_test.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libc/tests/gen/fts_children_test.c b/lib/libc/tests/gen/fts_children_test.c
index 171b1227104c..c5b0383c0d25 100644
--- a/lib/libc/tests/gen/fts_children_test.c
+++ b/lib/libc/tests/gen/fts_children_test.c
@@ -21,7 +21,11 @@
#include <atf-c.h>
-#include "fts_test.h"
+static int
+fts_lexical_compar(const FTSENT * const *a, const FTSENT * const *b)
+{
+ return (strcmp((*a)->fts_name, (*b)->fts_name));
+}
/*
* fts_children() before fts_read() returns the list of root entries.
@@ -164,8 +168,7 @@ ATF_TC_BODY(called_twice, tc)
ATF_REQUIRE_EQ(0, close(creat("dir/x", 0644)));
ATF_REQUIRE_EQ(0, close(creat("dir/y", 0644)));
- ATF_REQUIRE((fts = fts_open(paths, FTS_PHYSICAL,
- fts_lexical_compar)) != NULL);
+ ATF_REQUIRE((fts = fts_open(paths, FTS_PHYSICAL, NULL)) != NULL);
ent = fts_read(fts);
ATF_REQUIRE(ent != NULL);
@@ -218,8 +221,7 @@ ATF_TC_BODY(nameonly, tc)
ATF_REQUIRE_EQ(0, close(creat("dir/f1", 0644)));
ATF_REQUIRE_EQ(0, close(creat("dir/f2", 0644)));
- ATF_REQUIRE((fts = fts_open(paths, FTS_PHYSICAL,
- fts_lexical_compar)) != NULL);
+ ATF_REQUIRE((fts = fts_open(paths, FTS_PHYSICAL, NULL)) != NULL);
ent = fts_read(fts);
ATF_REQUIRE(ent != NULL);
@@ -266,8 +268,7 @@ ATF_TC_BODY(nondirectory, tc)
ATF_REQUIRE_EQ(0, mkdir("dir", 0755));
ATF_REQUIRE_EQ(0, close(creat("dir/file", 0644)));
- ATF_REQUIRE((fts = fts_open(paths, FTS_PHYSICAL,
- fts_lexical_compar)) != NULL);
+ ATF_REQUIRE((fts = fts_open(paths, FTS_PHYSICAL, NULL)) != NULL);
ent = fts_read(fts); /* FTS_D dir */
ATF_REQUIRE(ent != NULL);
@@ -310,7 +311,6 @@ ATF_TC_BODY(invalid_options, tc)
ATF_TP_ADD_TCS(tp)
{
- fts_check_debug();
ATF_TP_ADD_TC(tp, before_read);
ATF_TP_ADD_TC(tp, empty_dir);
ATF_TP_ADD_TC(tp, nonempty_dir);