1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-05-29 21:58:04 +02:00

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@gnupg.org>
This commit is contained in:
Werner Koch 2016-05-03 11:26:06 +02:00
parent 83865be35c
commit 33aacc3d4b
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
7 changed files with 40 additions and 18 deletions

View File

@ -35,18 +35,18 @@ print_open_fds (int *array)
{ {
int n; int n;
if (!verbose)
return;
for (n=0; array[n] != -1; n++) for (n=0; array[n] != -1; n++)
; ;
printf ("open file descriptors: %d", n); printf ("open file descriptors: %d", n);
if (verbose) putchar (' ');
{ putchar (' ');
putchar (' '); putchar ('(');
putchar (' '); for (n=0; array[n] != -1; n++)
putchar ('('); printf ("%d%s", array[n], array[n+1] == -1?"":" ");
for (n=0; array[n] != -1; n++) putchar (')');
printf ("%d%s", array[n], array[n+1] == -1?"":" ");
putchar (')');
}
putchar ('\n'); putchar ('\n');
} }
@ -84,7 +84,8 @@ test_close_all_fds (void)
system (buffer); system (buffer);
#endif #endif
printf ("max. file descriptors: %d\n", max_fd); if (verbose)
printf ("max. file descriptors: %d\n", max_fd);
array = xget_all_open_fds (); array = xget_all_open_fds ();
print_open_fds (array); print_open_fds (array);
for (initial_count=n=0; array[n] != -1; n++) for (initial_count=n=0; array[n] != -1; n++)

View File

@ -55,13 +55,24 @@ show_stdnames (void)
{ {
const char *name, *assname; const char *name, *assname;
int iterator = 0; int iterator = 0;
int count;
printf ("Known envvars:"); printf (" > Known envvars:");
count = 20;
while ((name = session_env_list_stdenvnames (&iterator, &assname))) while ((name = session_env_list_stdenvnames (&iterator, &assname)))
{ {
if (count > 60)
{
printf ("\n >");
count = 7;
}
printf ( " %s", name); printf ( " %s", name);
count += strlen (name) + 1;
if (assname) if (assname)
printf ( "(%s)", assname); {
printf ( "(%s)", assname);
count += strlen (assname) + 2;
}
} }
putchar('\n'); putchar('\n');
} }

View File

@ -74,10 +74,13 @@ static int verbose;
\ \
if (test_result == expected_result) \ if (test_result == expected_result) \
{ \ { \
printf (" ok.\n"); \ if (verbose) printf (" ok.\n"); \
} \ } \
else \ else \
{ \ { \
if (!verbose) \
printf ("%d. Checking %s...", \
tests, (description) ?: ""); \
printf (" failed.\n"); \ printf (" failed.\n"); \
printf (" %s == %s failed.\n", \ printf (" %s == %s failed.\n", \
STRINGIFY(test), \ STRINGIFY(test), \
@ -125,7 +128,8 @@ exit_tests (int force)
{ {
if (tests_failed == 0) if (tests_failed == 0)
{ {
printf ("All %d tests passed.\n", tests); if (verbose)
printf ("All %d tests passed.\n", tests);
exit (!!force); exit (!!force);
} }
else else

View File

@ -68,7 +68,7 @@ do_test()
awk '{print $NF}' "$FILELIST" | grep "^${F}$" >/dev/null awk '{print $NF}' "$FILELIST" | grep "^${F}$" >/dev/null
done done
$TOOL --gpg "$GPG" --gpg-args "$GPGARGS" $EXTRACT_FLAGS \ $TOOL --gpg "$GPG" --gpg-args "$GPGARGS" $EXTRACT_FLAGS --quiet \
--tar-args --directory="${TESTDIR}" \ --tar-args --directory="${TESTDIR}" \
"${TESTDIR}/test.tar.pgp" "${TESTDIR}/test.tar.pgp"
for F in $TESTFILES for F in $TESTFILES

View File

@ -26,7 +26,7 @@ cat /dev/null | $GPG --with-colons --print-mds >y
if have_hash_algo "MD5"; then if have_hash_algo "MD5"; then
test_one ":1:" "D41D8CD98F00B204E9800998ECF8427E" test_one ":1:" "D41D8CD98F00B204E9800998ECF8427E"
else else
echo "Hash algorithm MD5 is not installed (not an error)" echo " > Hash algorithm MD5 is not installed (not an error)"
fi fi
# SHA-1 # SHA-1
test_one ":2:" "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709" test_one ":2:" "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"

View File

@ -105,6 +105,6 @@ $GPG_PRESET_PASSPHRASE --preset -P abc A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD
info "Printing the GPG version" info "Printing the GPG version"
$GPG --version $GPG --version | awk '{print " > " $0}'
#fixme: check that the output is as expected #fixme: check that the output is as expected

View File

@ -34,6 +34,8 @@ Usage: gpg-zip [--help] [--version] [--encrypt] [--decrypt] [--symmetric]
Encrypt or sign files into an archive." Encrypt or sign files into an archive."
tar_verbose_opt="v"
while test $# -gt 0 ; do while test $# -gt 0 ; do
case $1 in case $1 in
-h | --help | --h*) -h | --help | --h*)
@ -113,6 +115,10 @@ while test $# -gt 0 ; do
shift shift
shift shift
;; ;;
--quiet)
tar_verbose_opt=""
shift
;;
--) --)
shift shift
break break
@ -135,7 +141,7 @@ elif test x$list = xyes ; then
cat "$1" | $GPG $gpg_args | $TAR $tar_args -tf - cat "$1" | $GPG $gpg_args | $TAR $tar_args -tf -
elif test x$unpack = xyes ; then elif test x$unpack = xyes ; then
# echo "cat \"$1\" | $GPG $gpg_args | $TAR $tar_args -xvf -" 1>&2 # 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 else
echo "$usage" 1>&2 echo "$usage" 1>&2
exit 1 exit 1