From 524a86e4f5a2cf1145c18187d4158aec48c87640 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Sun, 17 May 2015 10:51:15 +0100 Subject: build: avoid issues with case insensitive file systems * cfg.mk (sc_case_insensitive_file_names): A new syntax-check rule. * tests/tail-2/descriptor-vs-rename.sh: Rename from tests/tail-2/f-vs-rename.sh * tests/local.mk: Reference the renamed test. Reported by Jim Meyering. --- tests/local.mk | 2 +- tests/tail-2/descriptor-vs-rename.sh | 56 ++++++++++++++++++++++++++++++++++++ tests/tail-2/f-vs-rename.sh | 56 ------------------------------------ 3 files changed, 57 insertions(+), 57 deletions(-) create mode 100755 tests/tail-2/descriptor-vs-rename.sh delete mode 100755 tests/tail-2/f-vs-rename.sh (limited to 'tests') diff --git a/tests/local.mk b/tests/local.mk index 8d01064bf..bb78796cf 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -172,7 +172,7 @@ all_tests = \ tests/tail-2/inotify-hash-abuse2.sh \ tests/tail-2/F-vs-missing.sh \ tests/tail-2/F-vs-rename.sh \ - tests/tail-2/f-vs-rename.sh \ + tests/tail-2/descriptor-vs-rename.sh \ tests/tail-2/inotify-rotate.sh \ tests/tail-2/inotify-rotate-resources.sh \ tests/chmod/no-x.sh \ diff --git a/tests/tail-2/descriptor-vs-rename.sh b/tests/tail-2/descriptor-vs-rename.sh new file mode 100755 index 000000000..083d71449 --- /dev/null +++ b/tests/tail-2/descriptor-vs-rename.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# Demonstrate that tail -f works when renaming the tailed files. +# Between coreutils 7.5 and 8.23 inclusive, 'tail -f a' would +# stop tracking additions to b after 'mv a b'. + +# Copyright (C) 2015 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 . + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src +print_ver_ tail + +check_tail_output() +{ + local delay="$1" + grep "$tail_re" out || + { sleep $delay; return 1; } +} + +# Terminate any background tail process +cleanup_() { kill $pid 2>/dev/null && wait $pid; } + +# Speedup the non inotify case +fastpoll='-s.1 --max-unchanged-stats=1' + +for mode in '' '---disable-inotify'; do + rm -f a out + touch a || framework_failure_ + + tail $mode $fastpoll -f a > out 2>&1 & pid=$! + + # Wait up to 12.7s for tail to start. + echo x > a + tail_re='^x$' retry_delay_ check_tail_output .1 7 || { cat out; fail=1; } + + mv a b || framework_failure_ + + echo y >> b + # Wait up to 12.7s for "y" to appear in the output: + tail_re='^y$' retry_delay_ check_tail_output .1 7 || { cat out; fail=1; } + + cleanup_ +done + +Exit $fail diff --git a/tests/tail-2/f-vs-rename.sh b/tests/tail-2/f-vs-rename.sh deleted file mode 100755 index 083d71449..000000000 --- a/tests/tail-2/f-vs-rename.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# Demonstrate that tail -f works when renaming the tailed files. -# Between coreutils 7.5 and 8.23 inclusive, 'tail -f a' would -# stop tracking additions to b after 'mv a b'. - -# Copyright (C) 2015 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 . - -. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -print_ver_ tail - -check_tail_output() -{ - local delay="$1" - grep "$tail_re" out || - { sleep $delay; return 1; } -} - -# Terminate any background tail process -cleanup_() { kill $pid 2>/dev/null && wait $pid; } - -# Speedup the non inotify case -fastpoll='-s.1 --max-unchanged-stats=1' - -for mode in '' '---disable-inotify'; do - rm -f a out - touch a || framework_failure_ - - tail $mode $fastpoll -f a > out 2>&1 & pid=$! - - # Wait up to 12.7s for tail to start. - echo x > a - tail_re='^x$' retry_delay_ check_tail_output .1 7 || { cat out; fail=1; } - - mv a b || framework_failure_ - - echo y >> b - # Wait up to 12.7s for "y" to appear in the output: - tail_re='^y$' retry_delay_ check_tail_output .1 7 || { cat out; fail=1; } - - cleanup_ -done - -Exit $fail -- cgit v1.2.3-54-g00ecf