LCOV - code coverage report
Current view: top level - tests/gpg - t-wait.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 17 19 89.5 %
Date: 2016-12-01 18:45:36 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /* t-wait.c - Regression test.
       2             :    Copyright (C) 2000 Werner Koch (dd9jn)
       3             :    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 g10 Code GmbH
       4             : 
       5             :    This file is part of GPGME.
       6             : 
       7             :    GPGME is free software; you can redistribute it and/or modify it
       8             :    under the terms of the GNU Lesser General Public License as
       9             :    published by the Free Software Foundation; either version 2.1 of
      10             :    the License, or (at your option) any later version.
      11             : 
      12             :    GPGME is distributed in the hope that it will be useful, but
      13             :    WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15             :    Lesser General Public License for more details.
      16             : 
      17             :    You should have received a copy of the GNU Lesser General Public
      18             :    License along with this program; if not, write to the Free Software
      19             :    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
      20             :    02111-1307, USA.  */
      21             : 
      22             : /* We need to include config.h so that we know whether we are building
      23             :    with large file system (LFS) support. */
      24             : #ifdef HAVE_CONFIG_H
      25             : #include <config.h>
      26             : #endif
      27             : 
      28             : #include <stdlib.h>
      29             : #include <stdio.h>
      30             : #include <string.h>
      31             : 
      32             : #ifdef HAVE_W32_SYSTEM
      33             : #define sleep _sleep
      34             : #endif
      35             : 
      36             : #include <gpgme.h>
      37             : 
      38             : #include "t-support.h"
      39             : 
      40             : 
      41             : int
      42           1 : main (void)
      43             : {
      44             :   gpgme_ctx_t ctx;
      45             :   gpgme_error_t err;
      46             :   gpgme_data_t sig, text;
      47             : 
      48           1 :   init_gpgme (GPGME_PROTOCOL_OpenPGP);
      49             : 
      50           1 :   err = gpgme_new (&ctx);
      51           1 :   fail_if_err (err);
      52             : 
      53             :   /* Checking a message without a signature.  */
      54           1 :   err = gpgme_data_new_from_mem (&sig, "foo\n", 4, 0);
      55           1 :   fail_if_err (err);
      56           1 :   err = gpgme_data_new (&text);
      57           1 :   fail_if_err (err);
      58           1 :   err = gpgme_op_verify_start (ctx, sig, NULL, text);
      59           1 :   fail_if_err (err);
      60             : 
      61           4 :   while (gpgme_wait (ctx, &err, 0) == NULL && err == 0)
      62           2 :     sleep(1);
      63             : 
      64           1 :   if (gpgme_err_code (err) != GPG_ERR_NO_DATA)
      65             :     {
      66           0 :       fprintf (stderr, "%s:%d: %s: %s\n",
      67             :                __FILE__, __LINE__, gpgme_strsource (err),
      68             :                gpgme_strerror (err));
      69           0 :       exit (1);
      70             :     }
      71             : 
      72           1 :   gpgme_data_release (sig);
      73           1 :   gpgme_data_release (text);
      74           1 :   gpgme_release (ctx);
      75           1 :   return 0;
      76             : }

Generated by: LCOV version 1.11