diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 9 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/gpg/t-encrypt-sign.c | 38 | ||||
-rw-r--r-- | tests/gpg/t-encrypt.c | 38 | ||||
-rw-r--r-- | tests/gpg/t-eventloop.c | 38 | ||||
-rw-r--r-- | tests/gpgsm/t-encrypt.c | 38 | ||||
-rw-r--r-- | tests/t-engine-info.c | 92 |
7 files changed, 174 insertions, 81 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 1ca88b52..425884b9 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,12 @@ +2003-01-30 Marcus Brinkmann <[email protected]> + + * Makefile.am (TESTS): Add t-engine-info. + * t-engine-info.c: New file. + * gpg/t-encrypt.c (main): Don't print engine info. + * gpg/t-eventloop.c (main): Likewise. + * gpg/t-encrypt-sign.c (main): Likewise. + * gpgsm/t-encrypt.c (main): Likewise. + 2002-12-24 Marcus Brinkmann <[email protected]> * gpgsm/t-verify.c (main): Adjust caller of gpgme_op_verify. diff --git a/tests/Makefile.am b/tests/Makefile.am index b3679179..aa1da798 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -21,7 +21,7 @@ TESTS_ENVIRONMENT = GNUPGHOME=. -TESTS = t-version t-data +TESTS = t-version t-data t-engine-info EXTRA_DIST = t-data-1.txt t-data-2.txt diff --git a/tests/gpg/t-encrypt-sign.c b/tests/gpg/t-encrypt-sign.c index 1517db0f..dfd54bed 100644 --- a/tests/gpg/t-encrypt-sign.c +++ b/tests/gpg/t-encrypt-sign.c @@ -1,23 +1,22 @@ /* t-encrypt-sign.c - regression test - * Copyright (C) 2000 Werner Koch (dd9jn) - * Copyright (C) 2001, 2002 g10 Code GmbH - * - * This file is part of GPGME. - * - * GPGME 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 2 of the License, or - * (at your option) any later version. - * - * GPGME 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003 g10 Code GmbH + + This file is part of GPGME. + + GPGME 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 2 of the License, or + (at your option) any later version. + + GPGME 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 GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> @@ -94,7 +93,6 @@ main (int argc, char **argv ) err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); fail_if_err (err); - puts ( gpgme_get_engine_info() ); do { err = gpgme_new (&ctx); diff --git a/tests/gpg/t-encrypt.c b/tests/gpg/t-encrypt.c index 14a407d9..fa55fd6f 100644 --- a/tests/gpg/t-encrypt.c +++ b/tests/gpg/t-encrypt.c @@ -1,23 +1,22 @@ /* t-encrypt.c - regression test - * Copyright (C) 2000 Werner Koch (dd9jn) - * Copyright (C) 2001 g10 Code GmbH - * - * This file is part of GPGME. - * - * GPGME 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 2 of the License, or - * (at your option) any later version. - * - * GPGME 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003 g10 Code GmbH + + This file is part of GPGME. + + GPGME 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 2 of the License, or + (at your option) any later version. + + GPGME 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 GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> @@ -74,7 +73,6 @@ main (int argc, char **argv) err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); fail_if_err (err); - puts ( gpgme_get_engine_info() ); do { err = gpgme_new (&ctx); diff --git a/tests/gpg/t-eventloop.c b/tests/gpg/t-eventloop.c index 887de64c..71998bdb 100644 --- a/tests/gpg/t-eventloop.c +++ b/tests/gpg/t-eventloop.c @@ -1,23 +1,22 @@ /* t-eventloop.c - regression test - * Copyright (C) 2000 Werner Koch (dd9jn) - * Copyright (C) 2001, 2002 g10 Code GmbH - * - * This file is part of GPGME. - * - * GPGME 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 2 of the License, or - * (at your option) any later version. - * - * GPGME 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003 g10 Code GmbH + + This file is part of GPGME. + + GPGME 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 2 of the License, or + (at your option) any later version. + + GPGME 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 GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> @@ -205,7 +204,6 @@ main (int argc, char *argv[]) err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); fail_if_err (err); - puts (gpgme_get_engine_info ()); do { diff --git a/tests/gpgsm/t-encrypt.c b/tests/gpgsm/t-encrypt.c index 49996858..a6f80a4f 100644 --- a/tests/gpgsm/t-encrypt.c +++ b/tests/gpgsm/t-encrypt.c @@ -1,23 +1,22 @@ /* t-encrypt.c - regression test - * Copyright (C) 2000 Werner Koch (dd9jn) - * Copyright (C) 2001 g10 Code GmbH - * - * This file is part of GPGME. - * - * GPGME 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 2 of the License, or - * (at your option) any later version. - * - * GPGME 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003 g10 Code GmbH + + This file is part of GPGME. + + GPGME 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 2 of the License, or + (at your option) any later version. + + GPGME 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 GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> @@ -92,7 +91,6 @@ main (int argc, char **argv ) err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); fail_if_err (err); - puts ( gpgme_get_engine_info() ); do { err = gpgme_new (&ctx); diff --git a/tests/t-engine-info.c b/tests/t-engine-info.c new file mode 100644 index 00000000..e4d0eda9 --- /dev/null +++ b/tests/t-engine-info.c @@ -0,0 +1,92 @@ +/* t-engine-info.c - Regression test for gpgme_get_engine_info. + Copyright (C) 2003 g10 Code GmbH + + This file is part of GPGME. + + GPGME 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 2 of the License, or + (at your option) any later version. + + GPGME 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 GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + + +#define fail_if_err(err) \ + do \ + { \ + if (err) \ + { \ + fprintf (stderr, "%s:%d: GpgmeError %s\n", \ + __FILE__, __LINE__, gpgme_strerror (err)); \ + exit (1); \ + } \ + } \ + while (0) + + +void +check_engine_info (GpgmeEngineInfo info, GpgmeProtocol protocol, + const char *path, const char *req_version) +{ + if (info->protocol != protocol) + { + fprintf (stderr, "Unexpected protocol %i (expected %i instead)\n", + info->protocol, protocol); + exit (1); + } + if (strcmp (info->path, path)) + { + fprintf (stderr, "Unexpected path to executable %s (expected %s instead)", + info->path, path); + exit (1); + } + if (strcmp (info->req_version, req_version)) + { + fprintf (stderr, "Unexpected required version %s (expected %s instead)", + info->req_version, req_version); + exit (1); + } +} + + +int +main (int argc, char **argv ) +{ + GpgmeEngineInfo info; + GpgmeError err; + + err = gpgme_get_engine_info (&info); + fail_if_err (err); + + check_engine_info (info, GPGME_PROTOCOL_OpenPGP, GPG_PATH, NEED_GPG_VERSION); + + info = info->next; +#ifdef GPGSM_PATH + check_engine_info (info, GPGME_PROTOCOL_CMS, GPGSM_PATH, NEED_GPGSM_VERSION); +#else + if (info) + { + fprintf (stderr, "Unexpected engine info.\n"); + exit (1); + } +#endif + + return 0; +} |