aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-05-03 09:26:06 +0000
committerWerner Koch <[email protected]>2016-05-03 09:26:06 +0000
commit33aacc3d4bbd6a82d7e7ceca058970879741b7da (patch)
tree87d74f35156740dc845f8a5d6bfbd610f490fbf7
parentgpg: Emit status lines TOFU_STATS and TOFU_STATS_LONG. (diff)
downloadgnupg-33aacc3d4bbd6a82d7e7ceca058970879741b7da.tar.gz
gnupg-33aacc3d4bbd6a82d7e7ceca058970879741b7da.zip
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 <[email protected]>
-rw-r--r--common/t-exechelp.c21
-rw-r--r--common/t-session-env.c15
-rw-r--r--g10/test.c8
-rwxr-xr-xtests/openpgp/gpgtar.test2
-rwxr-xr-xtests/openpgp/mds.test2
-rwxr-xr-xtests/openpgp/version.test2
-rw-r--r--tools/gpg-zip.in8
7 files changed, 40 insertions, 18 deletions
diff --git a/common/t-exechelp.c b/common/t-exechelp.c
index 19079d331..3a47dc8ef 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 46c655229..c5c7b0e3b 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 39d594594..e9e2074d3 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 63bed7025..2f33f75c9 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 944f535cd..bb7331269 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 be565fb6f..9d265ad06 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 a6b423877..48c4766b1 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