[packages/coreutils] - fix tests that can be fixed (realpath is also a shell builtin, RANDOM env var changes with each

baggins baggins at pld-linux.org
Tue Dec 3 13:27:59 CET 2013


commit 389abdcdaaa7d494f9a705aa9a4a313b88b28ae0
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Tue Dec 3 13:26:51 2013 +0100

    - fix tests that can be fixed (realpath is also a shell builtin, RANDOM
      env var changes with each shell invocation)
    - disable tests that can't be fixed
    - rel 2

 coreutils.spec |  17 +++++++-
 tests.patch    | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 137 insertions(+), 2 deletions(-)
---
diff --git a/coreutils.spec b/coreutils.spec
index 896882a..0d4a971 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -7,7 +7,7 @@ Summary:	GNU Core-utils - basic command line utilities
 Summary(pl.UTF-8):	GNU Core-utils - podstawowe narzędzia działające z linii poleceń
 Name:		coreutils
 Version:	8.21
-Release:	1
+Release:	2
 License:	GPL v3+
 Group:		Applications/System
 Source0:	http://ftp.gnu.org/gnu/coreutils/%{name}-%{version}.tar.xz
@@ -30,6 +30,7 @@ Patch8:		%{name}-pl.po-update.patch
 # from http://www.beatex.org/web/advancedcopy.html, edited by shadzik
 Patch9:		%{name}-advcopy.patch
 Patch10:	format-security.patch
+Patch11:	tests.patch
 URL:		http://www.gnu.org/software/coreutils/
 BuildRequires:	acl-devel
 BuildRequires:	attr-devel
@@ -118,6 +119,7 @@ Programy zawarte w tym pakiecie to:
 %patch9 -p1
 %endif
 %patch10 -p1
+%patch11 -p1
 
 %{__perl} -pi -e 's at GNU/Linux at PLD Linux@' m4/host-os.m4
 
@@ -142,6 +144,17 @@ Programy zawarte w tym pakiecie to:
 %{__rm} tests/ls/stat-free-color.sh
 %{__sed} -i -e '/ls\/stat-free-color/d' tests/local.mk
 
+# filesystem layout dependant (fails on some xfs fs)
+%{__rm} tests/dd/sparse.sh
+%{__sed} -i -e '/dd\/sparse/d' tests/local.mk
+
+# mksh is too smart for those, won't let programs fail on ulimit
+# would need bash here
+%{__rm} tests/misc/sort-merge-fdlimit.sh
+%{__sed} -i -e '/misc\/sort-merge-fdlimit/d' tests/local.mk
+%{__rm} tests/split/r-chunk.sh
+%{__sed} -i -e '/split\/r-chunk/d' tests/local.mk
+
 %build
 build-aux/gen-lists-of-programs.sh --autoconf > m4/cu-progs.m4
 build-aux/gen-lists-of-programs.sh --automake > src/cu-progs.mk
@@ -161,7 +174,7 @@ build-aux/gen-lists-of-programs.sh --automake > src/cu-progs.mk
 
 %if %{with tests}
 sed -i -e 's#COLUMNS##g' tests/envvar-check
-%{__make} -j1 tests check
+LC_ALL=C LANG=C %{__make} -j1 tests check
 %endif
 
 %install
diff --git a/tests.patch b/tests.patch
new file mode 100644
index 0000000..d22f8a8
--- /dev/null
+++ b/tests.patch
@@ -0,0 +1,122 @@
+--- coreutils-8.21/tests/misc/printenv.sh~	2013-01-31 01:46:24.000000000 +0100
++++ coreutils-8.21/tests/misc/printenv.sh	2013-12-03 12:25:51.949012868 +0100
+@@ -23,8 +23,8 @@
+ # printenv as a builtin, so we must invoke it via "env".
+ # But beware of $_, set by many shells to the last command run.
+ # Also, filter out LD_PRELOAD, which is set when running under valgrind.
+-env | grep -Ev '^(_|LD_PRELOAD=)' > exp || framework_failure_
+-env -- printenv | grep -Ev '^(_|LD_PRELOAD=)' > out || fail=1
++env | grep -Ev '^(_|LD_PRELOAD=|RANDOM=)' > exp || framework_failure_
++env -- printenv | grep -Ev '^(_|LD_PRELOAD=|RANDOM=)' > out || fail=1
+ compare exp out || fail=1
+ 
+ # POSIX is clear that environ may, but need not be, sorted.
+--- coreutils-8.21/tests/misc/realpath.sh.orig	2013-12-03 12:36:46.105079823 +0100
++++ coreutils-8.21/tests/misc/realpath.sh	2013-12-03 12:46:44.854069134 +0100
+@@ -16,8 +16,8 @@
+ # You should have received a copy of the GNU General Public License
+ # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ 
+-. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+-print_ver_ realpath
++. "${srcdir=.}/tests/init.sh"; path_prepend_ $initial_cwd_/src
++print_ver_ $initial_cwd_/src/realpath
+ 
+ stat_single=$(stat -c %d:%i /) || framework_failure_
+ stat_double=$(stat -c %d:%i //) || framework_failure_
+@@ -40,68 +40,68 @@
+ ln -s /// three || framework_failure_
+ 
+ # Basic operation
+-realpath -Pqz . >/dev/null || fail=1
++$initial_cwd_/src/realpath -Pqz . >/dev/null || fail=1
+ # Operand is required
+-realpath >/dev/null && fail=1
+-realpath --relative-base . --relative-to . && fail=1
+-realpath --relative-base . && fail=1
++$initial_cwd_/src/realpath >/dev/null && fail=1
++$initial_cwd_/src/realpath --relative-base . --relative-to . && fail=1
++$initial_cwd_/src/realpath --relative-base . && fail=1
+ 
+ # -e --relative-* require directories
+-realpath -e --relative-to=dir1/f --relative-base=. . && fail=1
+-realpath -e --relative-to=dir1/  --relative-base=. . || fail=1
++$initial_cwd_/src/realpath -e --relative-to=dir1/f --relative-base=. . && fail=1
++$initial_cwd_/src/realpath -e --relative-to=dir1/  --relative-base=. . || fail=1
+ 
+ # Note NUL params are unconditionally rejected by canonicalize_filename_mode
+-realpath -m '' && fail=1
+-realpath --relative-base= --relative-to=. . && fail=1
++$initial_cwd_/src/realpath -m '' && fail=1
++$initial_cwd_/src/realpath --relative-base= --relative-to=. . && fail=1
+ 
+ # symlink resolution
+-this=$(realpath .)
+-test "$(realpath ldir2/..)" = "$this/dir1" || fail=1
+-test "$(realpath -L ldir2/..)" = "$this" || fail=1
+-test "$(realpath -s ldir2)" = "$this/ldir2" || fail=1
++this=$($initial_cwd_/src/realpath .)
++test "$($initial_cwd_/src/realpath ldir2/..)" = "$this/dir1" || fail=1
++test "$($initial_cwd_/src/realpath -L ldir2/..)" = "$this" || fail=1
++test "$($initial_cwd_/src/realpath -s ldir2)" = "$this/ldir2" || fail=1
+ 
+ # relative string handling
+-test $(realpath -m --relative-to=prefix prefixed/1) = '../prefixed/1' || fail=1
+-test $(realpath -m --relative-to=prefixed prefix/1) = '../prefix/1' || fail=1
+-test $(realpath -m --relative-to=prefixed prefixed/1) = '1' || fail=1
++test $($initial_cwd_/src/realpath -m --relative-to=prefix prefixed/1) = '../prefixed/1' || fail=1
++test $($initial_cwd_/src/realpath -m --relative-to=prefixed prefix/1) = '../prefix/1' || fail=1
++test $($initial_cwd_/src/realpath -m --relative-to=prefixed prefixed/1) = '1' || fail=1
+ 
+ # Ensure no redundant trailing '/' present, as was the case in v8.15
+-test $(realpath -sm --relative-to=/usr /) = '..' || fail=1
++test $($initial_cwd_/src/realpath -sm --relative-to=/usr /) = '..' || fail=1
+ # Ensure no redundant leading '../' present, as was the case in v8.15
+-test $(realpath -sm --relative-to=/ /usr) = 'usr' || fail=1
++test $($initial_cwd_/src/realpath -sm --relative-to=/ /usr) = 'usr' || fail=1
+ 
+ # Ensure --relative-base works
+-out=$(realpath -sm --relative-base=/usr --relative-to=/usr /tmp /usr) || fail=1
++out=$($initial_cwd_/src/realpath -sm --relative-base=/usr --relative-to=/usr /tmp /usr) || fail=1
+ test "$out" = "/tmp$nl." || fail=1
+-out=$(realpath -sm --relative-base=/ --relative-to=/ / /usr) || fail=1
++out=$($initial_cwd_/src/realpath -sm --relative-base=/ --relative-to=/ / /usr) || fail=1
+ test "$out" = ".${nl}usr" || fail=1
+ # --relative-to defaults to the value of --relative-base
+-out=$(realpath -sm --relative-base=/usr /tmp /usr) || fail=1
++out=$($initial_cwd_/src/realpath -sm --relative-base=/usr /tmp /usr) || fail=1
+ test "$out" = "/tmp$nl." || fail=1
+-out=$(realpath -sm --relative-base=/ / /usr) || fail=1
++out=$($initial_cwd_/src/realpath -sm --relative-base=/ / /usr) || fail=1
+ test "$out" = ".${nl}usr" || fail=1
+ # For now, --relative-base must be a prefix of --relative-to, or all output
+ # will be absolute (compare to MacOS 'relpath -d dir start end').
+-out=$(realpath -sm --relative-base=/usr/local --relative-to=/usr \
++out=$($initial_cwd_/src/realpath -sm --relative-base=/usr/local --relative-to=/usr \
+     /usr /usr/local) || fail=1
+ test "$out" = "/usr${nl}/usr/local" || fail=1
+ 
+ # Ensure // is handled correctly.
+-test "$(realpath / // ///)" = "/$nl$double_slash$nl/" || fail=1
+-test "$(realpath one two three)" = "/$nl$double_slash$nl/" || fail=1
+-out=$(realpath -sm --relative-to=/ / // /dev //dev) || fail=1
++test "$($initial_cwd_/src/realpath / // ///)" = "/$nl$double_slash$nl/" || fail=1
++test "$($initial_cwd_/src/realpath one two three)" = "/$nl$double_slash$nl/" || fail=1
++out=$($initial_cwd_/src/realpath -sm --relative-to=/ / // /dev //dev) || fail=1
+ if test $double_slash = //; then
+   test "$out" = ".$nl//${nl}dev$nl//dev" || fail=1
+ else
+   test "$out" = ".$nl.${nl}dev${nl}dev" || fail=1
+ fi
+-out=$(realpath -sm --relative-to=// / // /dev //dev) || fail=1
++out=$($initial_cwd_/src/realpath -sm --relative-to=// / // /dev //dev) || fail=1
+ if test $double_slash = //; then
+   test "$out" = "/$nl.$nl/dev${nl}dev" || fail=1
+ else
+   test "$out" = ".$nl.${nl}dev${nl}dev" || fail=1
+ fi
+-out=$(realpath --relative-base=/ --relative-to=// / //) || fail=1
++out=$($initial_cwd_/src/realpath --relative-base=/ --relative-to=// / //) || fail=1
+ if test $double_slash = //; then
+   test "$out" = "/$nl//" || fail=1
+ else
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/coreutils.git/commitdiff/389abdcdaaa7d494f9a705aa9a4a313b88b28ae0



More information about the pld-cvs-commit mailing list