On 13/01/16 18:30, Pádraig Brady wrote:
> On 13/01/16 17:29, Assaf Gordon wrote:
>
>> On OpenBSD 5.8:
>
>> FAIL: tests/misc/sort-debug-warn
>> ================================
>> -sort: failed to set locale; using simple byte comparison
>> +sort: using simple byte comparison
>
> Interesting. setlocale() succeeds there with LC_ALL=missing
> I'll look into whether we can test this case.
Patch attached.
>
>> freebsd101-test-suite.log
>>
>> FAIL: tests/misc/head-c
>> =======================
>>
>> + page_size=4096
>> + page_size=4
>
>> + ulimit -v 10000
>> + head -c1 /dev/null
>> Segmentation fault (core dumped)
>
> Hmm, we should also be disabling core dumps
> for this ulimit -v determination, with something like?
>
> trap '' SEGV; ulimit -c 0;
Patch attached
>
>> + ulimit -v 14004
>> + head --bytes=-9223372036854775807
>> head: memory exhausted
>
> Does the test pass when changing s/1000/2000/ on the ulimit line?
>
>> FAIL: tests/misc/kill
>
>> + SIGINVAL=32
>> + returns_ 1 env kill -l 32 0
>> LWP
>> EXIT
>> + fail=1
>
> This is a new test, and the scheme used to pick an
> invalid signal number is not general.
> I'll see if I can get sig2str() to return -1 generally.
Looking further it seems that NSIG is only for older signals on FreeBSD
and there is a newer _SIG_MAXSIG that we can add to gnulib like:
diff --git a/lib/sig2str.h b/lib/sig2str.h
index f347170..2730774 100644
--- a/lib/sig2str.h
+++ b/lib/sig2str.h
@@ -44,6 +44,8 @@ int str2sig (char const *, int *);
#if defined _sys_nsig
# define SIGNUM_BOUND (_sys_nsig - 1)
+#elif defined _SIG_MAXSIG
+# define SIGNUM_BOUND (_SIG_MAXSIG - 2) /* FreeBSD >= 7. */
#elif defined NSIG
# define SIGNUM_BOUND (NSIG - 1)
#else
As for the test to get an invalid signal number, this would be more general:
env kill -t | sort -k 1b,1 > sig.list
seq 256 | sort -k 1b,1 > all.list
invalid=$(join -v2 sig.list all.list | head -n1)
if test "$invalid"; then
...
fi
Related to this I also notice that we wrap signal specs
which doesn't seem appropriate here:
$ bash-kill -l 257
bash: kill: 257: invalid signal specification
$ util-linux-kill -l 257
kill: unknown signal: 257
$ coreutils-kill -l 257
HUP
$ coreutils-kill -l 1
HUP
>> opensuse421-test-suite.log
>>
>> FAIL: tests/df/df-symlink
>> =========================
>
>> + diff -u exp out
>> --- exp 2016-01-13 12:07:31.789282664 -0500
>> +++ out 2016-01-13 12:07:31.793282621 -0500
>> @@ -1,2 +1,2 @@
>> Filesystem Mounted on
>> -/dev/vda2 /
>> +/dev/vda2 /tmp
>> + fail=1
>
> $ df --out=source '.'
> /dev/vda2
> $ df --out=source,target /dev/vda2
> /dev/vda2 /
> $ df --out=source,target '.'
> /dev/vda2 /tmp
>
> Upon failure we really should have df tests
> output /proc/mounts and /proc/self/mountinfo if they exist
> to help debug.
>
>> FAIL: tests/mv/dup-source
>> =========================
>>
>> + diff -u exp out
>> --- exp 2016-01-13 12:07:44.597145567 -0500
>> +++ out 2016-01-13 12:07:44.593145610 -0500
>> @@ -2,4 +2,4 @@
>> mv: cannot stat 'a': No such file or directory
>> mv: cannot stat 'b': No such file or directory
>> mv: cannot move './b' to a subdirectory of itself, 'b/b'
>> -mv: warning: source directory 'b' specified more than once
>> +mv: cannot move 'b' to a subdirectory of itself, 'b/b'
>> + fail=1
>
> Interesting. The mv case is different to cp on this system.
> I can't think why off the top of my head. The "earlier_file"
> must not be found in the hash for some reason.
>
>> centos65-test-suite.log
>>
>> ERROR: tests/cp/fiemap-extents
>> ==============================
>
>> + fallocate -l 4MiB -n unwritten.withdata
>> fallocate: invalid length value specified
>> + framework_failure_
>
> It looks like IEC number suffix parsing was only added
> to fallocate recently. We can generalize that or skip on older systems.
Patch attached
cheers,
Pádraig.
From 611e7e02bff8898e622d6ad582a92f2de746b614 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Thu, 14 Jan 2016 01:17:57 +0000
Subject: [PATCH 1/3] sort: with --debug, flag setlocale() failures on OpenBSD
Locale categories are not equivalent on OpenBSD,
and LC_COLLATE only supports "C" for example.
Now LC_ALL is supported to set multiple other categories
on OpenBSD, so setlocale(LC_ALL, "") returns a string
indicating which categories were updated and which ignored.
Therefore...
* src/sort.c (main): ...Call setlocale(LC_COLLATE, "")
to explicitly check whether a specified LC_ALL or
LC_COLLATE environment variable value is supported
for the LC_COLLATE category. Also use !! to explicitly
convert to bool to support c89 systems where bool is an int,
and thus would get values > 1.
Reported by Assaf Gordon.
---
src/sort.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/sort.c b/src/sort.c
index 575877d..62acb62 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -4192,7 +4192,7 @@ main (int argc, char **argv)
initialize_main (&argc, &argv);
set_program_name (argv[0]);
- locale_ok = setlocale (LC_ALL, "");
+ locale_ok = !! setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -4667,6 +4667,10 @@ main (int argc, char **argv)
quote (setlocale (LC_COLLATE, NULL)));
else
{
+ /* OpenBSD can only set some categories with LC_ALL above,
+ so set LC_COLLATE explicitly to flag errors. */
+ if (locale_ok)
+ locale_ok = !! setlocale (LC_COLLATE, "");
error (0, 0, "%s%s", locale_ok ? "" : _("failed to set locale; "),
_("using simple byte comparison"));
}
--
2.5.0
From b4c768c42d955cf86eab25e2c613c16a9001655f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Thu, 14 Jan 2016 01:52:34 +0000
Subject: [PATCH 2/3] tests: avoid coredumps when determining memory limits
* init.cfg (get_min_ulimit_v_): Refactor ulimit call to...
(ulimit_supported_): ...here, and add calls to avoid coredumps.
---
init.cfg | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/init.cfg b/init.cfg
index e0ee1bc..630b49f 100644
--- a/init.cfg
+++ b/init.cfg
@@ -153,6 +153,23 @@ require_openat_support_()
fi
}
+# Return true if command runs with the
+# ulimit specified in the first argument
+ulimit_supported_()
+{
+ local v
+ v="$1"
+ shift
+
+ (
+ # Try to disable core dumps which may
+ # occur with memory constraints
+ trap '' SEGV; ulimit -c 0;
+
+ ulimit -v $v && "$@"
+ ) >/dev/null 2>&1
+}
+
# Determine the minimum required VM limit to run the given command.
# Output that value to stdout ... to be used by the caller.
# Return 0 in case of success, and a non-Zero value otherwise.
@@ -166,11 +183,11 @@ get_min_ulimit_v_()
page_size=$(($page_size / 1024))
for v in $( seq 5000 5000 50000 ); do
- if ( ulimit -v $v && "$@" ) >/dev/null; then
+ if ulimit_supported_ $v "$@"; then
local prev_v
prev_v=$v
for v in $( seq $(($prev_v-1000)) -1000 1000 ); do
- ( ulimit -v $v && "$@" ) >/dev/null || \
+ ulimit_supported $v "$@" ||
{
ret_v=$((prev_v + $page_size))
echo $ret_v
--
2.5.0
From 1f40f6a34ef91c618f2c6ffd427696398f10a49f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Thu, 14 Jan 2016 02:18:58 +0000
Subject: [PATCH 3/3] tests: support older fallocate number formats
* tests/cp/fiemap-extents.sh: Support RHEL6 fallocate
which doesn't support IEC suffixes like "MiB" on numbers.
Also add some extra framework_failure_ protections.
Reported by Assaf Gordon.
---
tests/cp/fiemap-extents.sh | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/cp/fiemap-extents.sh b/tests/cp/fiemap-extents.sh
index d44a741..672070e 100755
--- a/tests/cp/fiemap-extents.sh
+++ b/tests/cp/fiemap-extents.sh
@@ -21,14 +21,14 @@ print_ver_ cp
require_sparse_support_
-touch fiemap_chk
+touch fiemap_chk || framework_failure_
fiemap_capable_ fiemap_chk ||
skip_ 'this file system lacks FIEMAP support'
rm fiemap_chk
fallocate --help >/dev/null || skip_ 'The fallocate utility is required'
touch falloc.test || framework_failure_
-fallocate -l 1 -o 0 -n falloc.test ||
+fallocate -l 1 -o 1 -n falloc.test ||
skip_ 'this file system lacks FALLOCATE support'
rm falloc.test
@@ -41,6 +41,9 @@ if false; then
# which would cause failure of unrelated tests run in parallel.
require_file_system_bytes_free_ 800000000
+fallocate -l 1MiB num.test ||
+ skip_ "this fallocate doesn't support numbers with IEX suffixes"
+
fallocate -l 600MiB space.test ||
skip_ 'this test needs at least 600MiB free space'
@@ -67,14 +70,14 @@ fi
# Note the '-l 1' case is an effective noop, and just checks
# a file with a trailing hole is copied correctly.
for sparse_mode in always auto never; do
- for alloc in '-l 4MiB ' '-l 1MiB -o 4MiB' '-l 1'; do
+ for alloc in '-l 4194304' '-l 1048576 -o 4194304' '-l 1'; do
dd count=10 if=/dev/urandom iflag=fullblock of=unwritten.withdata
truncate -s 2MiB unwritten.withdata || framework_failure_
fallocate $alloc -n unwritten.withdata || framework_failure_
cp --sparse=$sparse_mode unwritten.withdata cp.test || fail=1
test $(stat -c %s unwritten.withdata) = $(stat -c %s cp.test) || fail=1
cmp unwritten.withdata cp.test || fail=1
- rm unwritten.withdata cp.test
+ rm unwritten.withdata cp.test || framework_failure_
done
done
--
2.5.0