summaryrefslogtreecommitdiff
path: root/tests/find
diff options
context:
space:
mode:
authorBernhard Voelker <mail@bernhard-voelker.de>2019-01-09 00:24:34 +0100
committerBernhard Voelker <mail@bernhard-voelker.de>2019-01-09 00:24:34 +0100
commitc809ce8fa2743e4b8e5ef979a30d8781d148bac5 (patch)
tree5e2aba1bf49b12d3cdb22aa251130be208cedbef /tests/find
parent1cc45855e54b98ff5a24434999644964881e0071 (diff)
downloadfindutils-c809ce8fa2743e4b8e5ef979a30d8781d148bac5.tar.gz
tests: migrate 'printf_inode' to the new testsuite
* find/testsuite/test_inode.sh: Move to ... * tests/find/printf_inode.sh: ... this, and apply the above. Simplify. * find/testsuite/Makefile.am (tests_shell_progs): Remove the reference to this test ... * tests/local.mk (all_tests): .. and add it here.
Diffstat (limited to 'tests/find')
-rwxr-xr-xtests/find/printf_inode.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/find/printf_inode.sh b/tests/find/printf_inode.sh
new file mode 100755
index 00000000..6844268c
--- /dev/null
+++ b/tests/find/printf_inode.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+# Verify that ls -i and find -printf %i produce the same output.
+
+# Copyright (C) 2011-2019 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"
+print_ver_ find oldfind
+
+make_canonical() {
+ sed -e 's/ /_/g'
+}
+
+# Create a file.
+> file || framework_failure_
+
+# Let ls(1) create the expected output.
+ls -i file | make_canonical > exp || framework_failure_
+
+for executable in oldfind find; do
+ rm -f out out2
+ $executable file -printf '%i_%p\n' > out || fail=1
+ make_canonical < out > out2 || framework_failure_
+ compare exp out2 || fail=1
+done
+
+Exit $fail