[Pkg-gnupg-commit] [gnupg2] 171/205: tests: Silence output of some tests.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed May 11 08:38:35 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gnupg2.
commit 33aacc3d4bbd6a82d7e7ceca058970879741b7da
Author: Werner Koch <wk at gnupg.org>
Date: Tue May 3 11:26:06 2016 +0200
tests: Silence output of some tests.
* common/t-exechelp.c (print_open_fds): Silence non-verbose output.
(test_close_all_fds): Ditto.
* common/t-session-env.c (show_stdnames): Indent output.
* g10/test.c (TEST): Silence non-verbose okay output.
(exit_tests): Ditto.
* tools/gpg-zip.in (tar_verbose_opt): Add option --quiet.
* tests/openpgp/gpgtar.test (GPGZIP): Pass option --quiet.
* tests/openpgp/mds.test: Indent MD5 notice.
* tests/openpgp/version.test: Indent --version output.
Signed-off-by: Werner Koch <wk at gnupg.org>
---
common/t-exechelp.c | 21 +++++++++++----------
common/t-session-env.c | 15 +++++++++++++--
g10/test.c | 8 ++++++--
tests/openpgp/gpgtar.test | 2 +-
tests/openpgp/mds.test | 2 +-
tests/openpgp/version.test | 2 +-
tools/gpg-zip.in | 8 +++++++-
7 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/common/t-exechelp.c b/common/t-exechelp.c
index 19079d3..3a47dc8 100644
--- a/common/t-exechelp.c
+++ b/common/t-exechelp.c
@@ -35,18 +35,18 @@ print_open_fds (int *array)
{
int n;
+ if (!verbose)
+ return;
+
for (n=0; array[n] != -1; n++)
;
printf ("open file descriptors: %d", n);
- if (verbose)
- {
- putchar (' ');
- putchar (' ');
- putchar ('(');
- for (n=0; array[n] != -1; n++)
- printf ("%d%s", array[n], array[n+1] == -1?"":" ");
- putchar (')');
- }
+ putchar (' ');
+ putchar (' ');
+ putchar ('(');
+ for (n=0; array[n] != -1; n++)
+ printf ("%d%s", array[n], array[n+1] == -1?"":" ");
+ putchar (')');
putchar ('\n');
}
@@ -84,7 +84,8 @@ test_close_all_fds (void)
system (buffer);
#endif
- printf ("max. file descriptors: %d\n", max_fd);
+ if (verbose)
+ printf ("max. file descriptors: %d\n", max_fd);
array = xget_all_open_fds ();
print_open_fds (array);
for (initial_count=n=0; array[n] != -1; n++)
diff --git a/common/t-session-env.c b/common/t-session-env.c
index 46c6552..c5c7b0e 100644
--- a/common/t-session-env.c
+++ b/common/t-session-env.c
@@ -55,13 +55,24 @@ show_stdnames (void)
{
const char *name, *assname;
int iterator = 0;
+ int count;
- printf ("Known envvars:");
+ printf (" > Known envvars:");
+ count = 20;
while ((name = session_env_list_stdenvnames (&iterator, &assname)))
{
+ if (count > 60)
+ {
+ printf ("\n >");
+ count = 7;
+ }
printf ( " %s", name);
+ count += strlen (name) + 1;
if (assname)
- printf ( "(%s)", assname);
+ {
+ printf ( "(%s)", assname);
+ count += strlen (assname) + 2;
+ }
}
putchar('\n');
}
diff --git a/g10/test.c b/g10/test.c
index 39d5945..e9e2074 100644
--- a/g10/test.c
+++ b/g10/test.c
@@ -74,10 +74,13 @@ static int verbose;
\
if (test_result == expected_result) \
{ \
- printf (" ok.\n"); \
+ if (verbose) printf (" ok.\n"); \
} \
else \
{ \
+ if (!verbose) \
+ printf ("%d. Checking %s...", \
+ tests, (description) ?: ""); \
printf (" failed.\n"); \
printf (" %s == %s failed.\n", \
STRINGIFY(test), \
@@ -125,7 +128,8 @@ exit_tests (int force)
{
if (tests_failed == 0)
{
- printf ("All %d tests passed.\n", tests);
+ if (verbose)
+ printf ("All %d tests passed.\n", tests);
exit (!!force);
}
else
diff --git a/tests/openpgp/gpgtar.test b/tests/openpgp/gpgtar.test
index 63bed70..2f33f75 100755
--- a/tests/openpgp/gpgtar.test
+++ b/tests/openpgp/gpgtar.test
@@ -68,7 +68,7 @@ do_test()
awk '{print $NF}' "$FILELIST" | grep "^${F}$" >/dev/null
done
- $TOOL --gpg "$GPG" --gpg-args "$GPGARGS" $EXTRACT_FLAGS \
+ $TOOL --gpg "$GPG" --gpg-args "$GPGARGS" $EXTRACT_FLAGS --quiet \
--tar-args --directory="${TESTDIR}" \
"${TESTDIR}/test.tar.pgp"
for F in $TESTFILES
diff --git a/tests/openpgp/mds.test b/tests/openpgp/mds.test
index 944f535..bb73312 100755
--- a/tests/openpgp/mds.test
+++ b/tests/openpgp/mds.test
@@ -26,7 +26,7 @@ cat /dev/null | $GPG --with-colons --print-mds >y
if have_hash_algo "MD5"; then
test_one ":1:" "D41D8CD98F00B204E9800998ECF8427E"
else
- echo "Hash algorithm MD5 is not installed (not an error)"
+ echo " > Hash algorithm MD5 is not installed (not an error)"
fi
# SHA-1
test_one ":2:" "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"
diff --git a/tests/openpgp/version.test b/tests/openpgp/version.test
index be565fb..9d265ad 100755
--- a/tests/openpgp/version.test
+++ b/tests/openpgp/version.test
@@ -105,6 +105,6 @@ $GPG_PRESET_PASSPHRASE --preset -P abc A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD
info "Printing the GPG version"
-$GPG --version
+$GPG --version | awk '{print " > " $0}'
#fixme: check that the output is as expected
diff --git a/tools/gpg-zip.in b/tools/gpg-zip.in
index a6b4238..48c4766 100644
--- a/tools/gpg-zip.in
+++ b/tools/gpg-zip.in
@@ -34,6 +34,8 @@ Usage: gpg-zip [--help] [--version] [--encrypt] [--decrypt] [--symmetric]
Encrypt or sign files into an archive."
+tar_verbose_opt="v"
+
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*)
@@ -113,6 +115,10 @@ while test $# -gt 0 ; do
shift
shift
;;
+ --quiet)
+ tar_verbose_opt=""
+ shift
+ ;;
--)
shift
break
@@ -135,7 +141,7 @@ elif test x$list = xyes ; then
cat "$1" | $GPG $gpg_args | $TAR $tar_args -tf -
elif test x$unpack = xyes ; then
# echo "cat \"$1\" | $GPG $gpg_args | $TAR $tar_args -xvf -" 1>&2
- cat "$1" | $GPG $gpg_args | $TAR $tar_args -xvf -
+ cat "$1" | $GPG $gpg_args | $TAR $tar_args -x${tar_verbose_opt}f -
else
echo "$usage" 1>&2
exit 1
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list