diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 8 | ||||
-rw-r--r-- | tests/Makefile.am | 13 | ||||
-rw-r--r-- | tests/asschk.c | 39 | ||||
-rwxr-xr-x | tests/runtest | 1 |
4 files changed, 28 insertions, 33 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 124ff9b8f..b2e95f323 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -12,7 +12,7 @@ 2008-10-20 Werner Koch <[email protected]> * asschk.c (cmd_echo): Mark unused arg. - (cmd_send, cmd_expect_ok, cmd_expect_err, cmd_pipeserver) + (cmd_send, cmd_expect_ok, cmd_expect_err, cmd_pipeserver) (cmd_quit_if, cmd_fail_if): Ditto. 2008-09-29 Werner Koch <[email protected]> @@ -108,7 +108,7 @@ * Makefile.am: Fixes for make dist. * samplekets/Makefile.am: New. - + 2002-08-08 Werner Koch <[email protected]> * asschk.c: Added some new features. @@ -123,7 +123,7 @@ * Makefile.am, asschk.c: New. - + Copyright 2002 Free Software Foundation, Inc. This file is free software; as a special exception the author gives @@ -133,5 +133,3 @@ This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - diff --git a/tests/Makefile.am b/tests/Makefile.am index e9f3df232..70b5fe270 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,18 +1,18 @@ # Makefile.am -tests makefile for libxtime # Copyright (C) 2002 Free Software Foundation, Inc. -# +# # This file is part of GnuPG. -# +# # GnuPG 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. -# +# # GnuPG 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/>. @@ -52,10 +52,10 @@ EXTRA_DIST = runtest inittests $(testscripts) \ # write new tests based on gpg-connect-agent which has a full fledged # script language and thus makes it far easier to write tests than to # use the low--level asschk stuff. -TESTS = +TESTS = CLEANFILES = inittests.stamp x y y z out err \ - *.lock .\#lk* + *.lock .\#lk* DISTCLEANFILES = pubring.kbx~ random_seed @@ -72,4 +72,3 @@ clean-local: inittests.stamp: inittests srcdir=$(srcdir) $(TESTS_ENVIRONMENT) $(srcdir)/inittests echo timestamp >./inittests.stamp - diff --git a/tests/asschk.c b/tests/asschk.c index ec338e73d..3eb262178 100644 --- a/tests/asschk.c +++ b/tests/asschk.c @@ -19,12 +19,12 @@ /* This is a simple stand-alone Assuan server test program. We don't want to use the assuan library because we don't want to hide errors - in that library. + in that library. The script language is line based. Empty lines or lines containing only white spaces are ignored, line with a hash sign as first non white space character are treated as comments. - + A simple macro mechanism is implemnted. Macros are expanded before a line is processed but after comment processing. Macros are only expanded once and non existing macros expand to the empty string. @@ -79,7 +79,7 @@ is ignored. count-status <code> - Initialize the assigned variable to 0 and assign it as an counter for + Initialize the assigned variable to 0 and assign it as an counter for status code CODE. This command must be called with an assignment. quit @@ -252,7 +252,7 @@ writen (int fd, const char *buffer, size_t length) while (length) { int nwritten = write (fd, buffer, length); - + if (nwritten < 0) { if (errno == EINTR) @@ -306,7 +306,7 @@ read_assuan (int fd) } while (n < 0 && errno == EINTR); } - + if (opt_verbose && n >= 0 ) { int i; @@ -324,7 +324,7 @@ read_assuan (int fd) p = buf; nleft -= n; buf += n; - + for (; n && *p != '\n'; n--, p++) ; if (n) @@ -369,7 +369,7 @@ read_assuan (int fd) recv_type = LINE_END; p += 3; } - else + else die_1 ("invalid line type (%.5s)", p); return p; @@ -451,7 +451,7 @@ start_server (const char *pgmname) close (wp[1]); close (rp[0]); - execl (pgmname, arg0, "--server", NULL); + execl (pgmname, arg0, "--server", NULL); die_2 ("exec failed for `%s': %s", pgmname, strerror (errno)); } close (wp[0]); @@ -503,7 +503,7 @@ set_type_var (const char *name, const char *value, VARTYPE type) VARIABLE var; if (!name) - name = "?"; + name = "?"; for (var=variable_list; var && strcmp (var->name, name); var = var->next) ; if (!var) @@ -524,7 +524,7 @@ set_type_var (const char *name, const char *value, VARTYPE type) if (fd != -1 && fd != 0 && fd != 1 && fd != 2) close (fd); } - + var->type = type; var->count = 0; if (var->type == VARTYPE_COUNTER) @@ -598,7 +598,7 @@ expand_line (char *buffer) p = strchr (line, '$'); if (!p) return result; /* nothing more to expand */ - + if (p[1] == '$') /* quoted */ { memmove (p, p+1, strlen (p+1)+1); @@ -650,7 +650,7 @@ expand_line (char *buffer) /* Evaluate COND and return the result. */ -static int +static int eval_boolean (const char *cond) { int true = 1; @@ -687,7 +687,7 @@ cmd_send (const char *assign_to, char *arg) (void)assign_to; if (opt_verbose) fprintf (stderr, "sending `%s'\n", arg); - write_assuan (server_send_fd, arg); + write_assuan (server_send_fd, arg); } static void @@ -776,12 +776,12 @@ cmd_openfile (const char *assign_to, char *arg) int fd; char numbuf[20]; - do + do fd = open (arg, O_RDONLY); while (fd == -1 && errno == EINTR); if (fd == -1) die_2 ("error opening `%s': %s", arg, strerror (errno)); - + sprintf (numbuf, "%d", fd); set_type_var (assign_to, numbuf, VARTYPE_FD); } @@ -792,7 +792,7 @@ cmd_createfile (const char *assign_to, char *arg) int fd; char numbuf[20]; - do + do fd = open (arg, O_WRONLY|O_CREAT|O_TRUNC, 0666); while (fd == -1 && errno == EINTR); if (fd == -1) @@ -845,7 +845,7 @@ cmd_cmpfiles (const char *assign_to, char *arg) size_t nread1, nread2; int rc = 0; - set_var (assign_to, "0"); + set_var (assign_to, "0"); for (p=arg; *p && !spacep (p); p++) ; if (!*p) @@ -862,7 +862,7 @@ cmd_cmpfiles (const char *assign_to, char *arg) if (*p) die_0 ("cmpfiles: syntax error"); } - + fp1 = fopen (arg, "rb"); if (!fp1) { @@ -893,7 +893,7 @@ cmd_cmpfiles (const char *assign_to, char *arg) { if (opt_verbose) err ("files match"); - set_var (assign_to, "1"); + set_var (assign_to, "1"); } else if (!rc) err ("cmpfiles: read error: %s", strerror (errno)); @@ -1089,4 +1089,3 @@ main (int argc, char **argv) } return 0; } - diff --git a/tests/runtest b/tests/runtest index 8d5078647..5c832bdb0 100755 --- a/tests/runtest +++ b/tests/runtest @@ -1,4 +1,3 @@ #!/bin/sh [ -x "$1" ] && exec $1 $2 exec ./asschk --no-echo -DGPGSM=${GPGSM} <"$1" - |