[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
groups --version [was: GNU_PACKAGE vs. PACKAGE_NAME]
From: |
Eric Blake |
Subject: |
groups --version [was: GNU_PACKAGE vs. PACKAGE_NAME] |
Date: |
Fri, 31 Aug 2007 15:24:01 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Jim Meyering <jim <at> meyering.net> writes:
>
> Eric Blake-1 <ebb9 <at> byu.net> wrote:
> > Also, I think it is worth considering a testsuite addition
> > to ensure the equivalent of:
> > diff <(id --version | sed '/^$/q') \
> > <(groups --version | sed 's/^groups/id/; /^$/q')
> > succeeds, but did not do it in this patch.
>
> That'd be a fine addition.
> Patch welcome.
Here goes.
2007-08-31 Eric Blake <address@hidden>
Test yesterday's change to groups.
* tests/misc/groups-version: New test.
* tests/misc/Makefile.am (TESTS): Sort, and add new test.
In writing this, I think tests/sample-test has a bug (although I did not do
anything about it in my new test, because it would be a global search of all
existing tests). You set up t0 based on the contents of "$0", but then
call 'rm -rf $t0' in the trap; if run in a directory with spaces, you are not
doing the right thing. Shouldn't the trap use "$t0" rather than $t0?
>From 927c293e81cdb969eec26d43053ea9bd504aba03 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 31 Aug 2007 09:16:49 -0600
Subject: [PATCH] Test yesterday's change to groups.
* tests/misc/groups-version: New test.
* tests/misc/Makefile.am (TESTS): Sort, and add new test.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 6 +++++
tests/misc/Makefile.am | 27 +++++++++++++------------
tests/misc/groups-version | 48 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 68 insertions(+), 13 deletions(-)
create mode 100644 tests/misc/groups-version
diff --git a/ChangeLog b/ChangeLog
index a5b1c8b..025e789 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-08-31 Eric Blake <address@hidden>
+
+ Test yesterday's change to groups.
+ * tests/misc/groups-version: New test.
+ * tests/misc/Makefile.am (TESTS): Sort, and add new test.
+
2007-08-30 Jim Meyering <address@hidden>
Shorten the snapshot version string by removing the "g".
diff --git a/tests/misc/Makefile.am b/tests/misc/Makefile.am
index 7206b39..62eb2b2 100644
--- a/tests/misc/Makefile.am
+++ b/tests/misc/Makefile.am
@@ -42,30 +42,24 @@ TESTS_ENVIRONMENT = \
# will execute the test script rather than the standard utility.
TESTS = \
- od \
- xstrtol \
arch \
- pr \
- df-P \
- pwd-unreadable-parent \
- chcon \
- chcon-fail \
- selinux \
- cut \
- wc-files0-from \
- wc-files0 \
- cat-proc \
base64 \
basename \
+ cat-proc \
+ chcon \
+ chcon-fail \
close-stdout \
csplit \
+ cut \
date \
date-sec \
df \
+ df-P \
dirname \
expand \
false-status \
fold \
+ groups-version \
head-c \
head-elide-tail \
head-pos \
@@ -73,12 +67,16 @@ TESTS = \
nice \
nl \
nohup \
+ od \
paste-no-nl \
pathchk1 \
+ pr \
printf \
printf-hex \
pwd-long \
+ pwd-unreadable-parent \
runcon-no-reorder \
+ selinux \
sha224sum \
sha256sum \
sha384sum \
@@ -94,4 +92,7 @@ TESTS = \
stat-printf \
tac-continue \
test-diag \
- tty-eof
+ tty-eof \
+ wc-files0 \
+ wc-files0-from \
+ xstrtol
diff --git a/tests/misc/groups-version b/tests/misc/groups-version
new file mode 100644
index 0000000..3004acc
--- /dev/null
+++ b/tests/misc/groups-version
@@ -0,0 +1,48 @@
+#!/bin/sh
+# ensure groups --version output is similar to id --version
+
+# Copyright (C) 2007 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 <http://www.gnu.org/licenses/>.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ groups --version
+fi
+
+. $srcdir/../lang-default
+
+pwd=`pwd`
+t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit
$status' 0
+trap '(exit $?); exit $?' 1 2 13 15
+
+framework_failure=0
+mkdir -p $tmp || framework_failure=1
+cd $tmp || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo "$0: failure in testing framework" 1>&2
+ (exit 1); exit 1
+fi
+
+fail=0
+
+groups --version | sed -e 's/^groups/id/; /^$/q' > out || fail=1
+id --version | sed -e '/^$/q' > exp || fail=1
+
+cmp out exp || fail=1
+test $fail = 1 && diff out exp 2> /dev/null
+
+(exit $fail); exit $fail
--
1.5.2.2
Re: GNU_PACKAGE vs. PACKAGE_NAME, Jim Meyering, 2007/08/30