Commit Graph

453 Commits

Author SHA1 Message Date
Ingo Klöcker
0ac3679a74 core: Support all components with dirinfo()
* src/dirinfo.c (WANT_KEYBOXD_NAME, WANT_AGENT_NAME, WANT_SCDAEMON_NAME,
WANT_DIRMNGR_NAME, WANT_PINENTRY_NAME): New.
(dirinfo): Add fields keyboxd_name, agent_name, scdaemon_name,
dirmngr_name, pinentry_name.
(parse_output): Support "keyboxd", "gpg-agent", "scdaemon", "dirmngr",
"pinentry".
(get_gpgconf_item): Return new components.

tests/t-engine-info.c (main): Add new components to the output.
--

GnuPG-bug-id: 5727
2021-12-10 12:04:05 +01:00
Werner Koch
43de18a292
tests: Silence libtool warning on Windows.
* tests/Makefile.am (AM_LDFLAGS): Use --no-fast-install on Windows.
2021-11-25 11:43:33 +01:00
Werner Koch
eb37d6469e
core: Support dirinfo("socketdir")
* src/dirinfo.c (WANT_SOCKETDIR): New.
(dirinfo): Add field socketdir.
(parse_output): Support "socketdir".
(get_gpgconf_item): Return socketdir.

* tests/t-engine-info.c (main): Add socketdir to the output.

* src/w32-util.c (_gpgme_create_process_utf8): Fix indentation.
--

GnuPG-bug-id: 5613

This is not strictly necessary because we could deduce this from one
of the other socket info items but it is more clean to have a
dedicated info item.  The socketdir item is available for 5 years now
(GnuPG commit 8e3fa5a4b205c534de2142e5d071712f957cf06a)
2021-11-25 11:40:59 +01:00
NIIBE Yutaka
8148237cb4 posix: Use poll instead, when available, removing use of select.
* configure.ac (HAVE_POLL_H): Add the check.
* src/ath.c [!HAVE_POLL_H] (ath_select): Enable conditionally.
* src/posix-io.c [HAVE_POLL_H] (_gpgme_io_select_poll): Use poll.
* tests/gpg/t-cancel.c [HAVE_POLL_H] (do_select): Use poll.
* tests/gpg/t-eventloop.c [HAVE_POLL_H] (do_select): Use poll.

--

GnuPG-bug-id: 2385
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2021-11-25 11:13:17 +09:00
NIIBE Yutaka
1cedac2bba tests: Build using GPG_ERROR_MT_LIBS for thread use.
* tests/gpg/Makefile.am (WITH_THREAD_CPPFLAGS): New.
(WITH_THREAD_LDADD): New.
(t_thread1_CPPFLAGS, t_thread_keylist_CPPFLAGS)
(t_thread_keylist_verify_CPPFLAGS)
(t_cancel_CPPFLAGS): Use WITH_THREAD_CPPFLAGS.
(t_thread1_LDADD, t_thread_keylist_LDADD)
(t_thread_keylist_verify_LDADD)
(t_cancel_LDADD): Use WITH_THREAD_LDADD.

--

For library dependency at runtime, it's not 100% right to use
GPG_ERROR_MT_LIBS here, because those test programs don't use
libgpg-error directly at runtime.  But, it's OK, because these are
test programs, which don't need specifying minimum library dependency.

It would be too much for configure of gpgme, to check how threaded
application should be built, just for these test programs.

Co-authored-by: Ben Kibbey <bjk@luxsci.net>
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2021-11-12 10:22:21 +09:00
NIIBE Yutaka
8cd2fe7b3d tests: Use GPG_ERROR_MT_LIBS for a test with threads.
* tests/Makefile.am (run_threaded_CPPFLAGS): New.
(run_threaded_LDADD): Replace GPG_ERROR_LIBS to GPG_ERROR_MT_LIBS.

--

Reported-by: Ben Kibbey <bjk@luxsci.net>
Fixes-commit: d0402f886b
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2021-11-11 10:08:59 +09:00
Werner Koch
aaf448b1e8
build: Fix make distcheck problem.
* tests/start-stop-agent: Use -f with rm.  Also use cat instead of cp.
--

Also shorted some lines.
2021-08-27 14:13:36 +02:00
Andre Heinecke
bc774104bb
Add missing files for distribution
* lang/qt/src/Makefile.am (private_qgpgme_headers): Add job_p.h
* tests/gpg/Makefile.am (EXTRA_DIST): Add gpg.conf.in
2021-08-27 12:58:27 +02:00
Ingo Klöcker
a5662a801f core: Ensure gpg.conf for tests is recreated if necessary
* tests/gpg/gpg.conf.in: New.
* tests/gpg/Makefile.am (gpg.conf): Copy gpg.conf.in instead of using
echo to fill gpg.conf.
--

This change ensures that gpg.conf is updated whenever new options are
added for some tests.
2021-07-08 12:18:45 +02:00
Ingo Klöcker
81a33ea5e1 core: Fix use-after-free issue in test
* tests/gpg/t-edit-sign.c (sign_key, verify_key_signature): New.
(main): Factored out signing and verifying the result.
--

Factoring the two steps of the test into different functions fixes the
use-after-free issue that was caused by accidentaly using a variable
of the first step in the second step.

GnuPG-bug-id: 5509
2021-06-26 18:03:37 +02:00
Ingo Klöcker
34d9defc42 core: Allow specifying an expiration date for key signatures
* src/context.h (struct gpgme_context): Add 'cert_expire'.
* src/engine-gpg.c (append_args_from_cert_expire): New.
(gpg_edit): Set option according to the new flag.
* src/gpgme.c (gpgme_release): Free 'cert_expire'.
(gpgme_set_ctx_flag, gpgme_get_ctx_flag): Add "cert-expire".

* tests/gpg/Makefile.am (c_tests): Add new test.
(gpg.conf): Write "allow-weak-key-signatures" to gpg.conf.
* tests/gpg/t-edit-sign.c: New.
--

The new context flag "cert-expire" allows setting the expiration date
for key signatures created with gpgme_op_interact.

GnuPG-bug-id: 5336, 5505
2021-06-22 16:35:03 +02:00
Werner Koch
fde20940b5
core: New data flags "io-buffer-size" and "sensitive".
* src/data.c (_gpgme_data_release): Free buffers.
(gpgme_data_seek): Adjust from renamed fields.
(gpgme_data_set_flag): Implement new flags.
(_gpgme_data_inbound_handler): Allow the use of a malloced buffer.
(_gpgme_data_outbound_handler): Ditto.
* src/data.h (BUFFER_SIZE): Move out of the struct definition.
(struct gpgme_data): Remove pending filed and introduce inbound and
outbound fields.

* src/conversion.c (_gpgme_wipememory): New.  Taken from GnuPG.
* src/cJSON.c (wipememory): Use this here too.

* tests/run-decrypt.c (main): Add options "--large-buffers" and
"--sensitive".
--

GnuPG-bug-id: 5478
Signed-off-by: Werner Koch <wk@gnupg.org>
2021-06-14 19:51:28 +02:00
Werner Koch
31eb45f016
tests: Improve the output of the run-keylist helper.
* tests/run-keylist.c (main): Print all infos from the primary key.
--

The test tool printed only the computed infos for the key and not the
detailed one fro the primary key.  The new output better reflects the
data structure.

Related to
GnuPG-bug-id: 5454
2021-05-28 18:31:43 +02:00
Werner Koch
aa98081356
core: Allow for older compilers.
* tests/run-verify.c (main): Remove C99-only syntax.
* tests/run-threaded.c (start_keylistings): Ditto.
--

Older gcc's do not grok this and there is no real need for it.

  run-verify.c:324: error: ‘for’ loop initial declarations are only
  allowed in C99 mode
  run-verify.c:324: note: use option -std=c99 or -std=gnu99 to compile
  your code

Reported-by: Lars Hecking
2021-05-12 08:50:04 +02:00
Ingo Klöcker
276187f6b6 core: Extend gpgme_key_sig_t with trust signature members.
* src/gpgme.h.in (struct _gpgme_key_sig): Add fields 'trust_depth',
'trust_value', and 'trust_scope'.
* src/key.c (gpgme_key_unref): Free trust_scope.
* src/keylist.c (keylist_colon_handler): Set the fields.
* tests/run-keylist.c (main): Print the fields.
--

The trust signature values are part of gpg's output since the year 2003.
This now adds support to gpgme.

GnuPG-bug-id: 5245, 5419
2021-05-05 19:23:48 +02:00
Werner Koch
0821e2b149
core: New flag GPGME_KEYSIGN_FORCE.
* src/gpgme.h.in (GPGME_KEYSIGN_FORCE): New.
* src/engine-gpg.c (gpg_keysign): Implement.

* tests/run-keysign.c (show_usage): Add option --force
--

GnuPG-bug-id: 4584
2021-03-11 11:49:07 +01:00
Ingo Klöcker
5137d7fc21 core: Make listing of signatures work if only secret keys are listed
* src/engine-gpg.c (gpg_keylist_build_options): Add "--with-sig-check"
argument if signatures shall be listed.
* tests/gpg/t-keylist-secret-sig.c: New.
* tests/gpg/Makefile.am (c_tests): Add new test.
--

GnuPG-bug-id: 3580
2021-01-05 17:44:16 +01:00
Ingo Klöcker
f3407d0ee4 core: New function gpgme_op_revsig.
* src/gpgme.h.in (gpgme_op_revsig_start, gpgme_op_revsig): New.
(GPGME_REVSIG_LFSEP): New.
* src/context.h (ctx_op_data_id_t): Add OPDATA_REVSIG.
* src/revsig.c: New.
* src/Makefile.am (main_sources): Add revsig.
* src/libgpgme.vers, src/gpgme.def: Add gpgme_op_revsig and
gpgme_op_revsig_start.
* src/engine.h, src/engine.c: (_gpgme_engine_op_revsig): New.
* src/engine-backend.h (engine_ops): Add 'revsig' and adjust all
engine initializers.
* src/engine-gpg.c (gpg_revsig): New.
(_gpgme_engine_ops_gpg): Set revsig to gpg_revsig.
* doc/gpgme.texi: Document new functions.
* tests/run-keysign.c: Add option --revoke.
--

This extends GPGME to support the --quick-revoke-sig command
added by GnuPG 2.2.24. This allows revoking key signatures.

GnuPG-bug-id: 5094
2020-10-29 12:57:10 +01:00
Werner Koch
25e2d717f4
tests: Fix gcc incompatibility
* tests/json/t-json.c: Remove var definitions inside a for statement.
--

This useful C99 feature seems to work only in recent gcc versions.  We
can't use it; see gnupg/doc/HACKING.

GnuPG-bug-id: 5088
2020-10-03 19:54:00 +02:00
Werner Koch
e4ee706e27
core: Fully implement the inquire callback for assuan_transact
* src/engine-assuan.c (inquire_cb): Implement returning data.

* tests/opassuan/t-command.c (inq_cb): Send some test data.
--

The old code only allowed to send an empty response which was good
enough for scdaemon's KNOWNCARDP inquire but not to send actual data.
A quick test using a test smartcard might be

 ./t-command 'scd setattr --inquire PRIVATE-DO-1'

and then reading the data back using

  gpg-connect-agent 'scd getattr PRIVATE-DO-1' /bye

Signed-off-by: Werner Koch <wk@gnupg.org>
2020-09-09 12:13:20 +02:00
Ingo Klöcker
db82e99a8a core: New function gpgme_op_setexpire.
* src/gpgme.h.in (gpgme_op_setexpire_start, gpgme_op_setexpire): New.
* src/libgpgme.vers, src/gpgme.def: Add new functions.
* src/genkey.c (setexpire): New.
(gpgme_op_setexpire_start, gpgme_op_setexpire): New.
* src/engine.h, src/engine.c: (_gpgme_engine_op_setexpire): New.
* src/engine-backend.h (engine_ops): Add 'setexpire' and adjust all
engine initializers.
* src/engine-gpg.c (gpg_setexpire): New.
(_gpgme_engine_ops_gpg): Set setexpire to gpg_setexpire.
* doc/gpgme.texi: Document new functions.
* tests/run-genkey.c: Add option --setexpire.
--

This extends GPGME to support the --quick-set-expire command
added by GnuPG 2.1.22. This allows changing subkeys expiry
date without going through the editinteractor interface.

Co-authored-by: Andre Heinecke <aheinecke@gnupg.org>
GnuPG-bug-id: 4999
2020-08-04 16:51:56 +02:00
Werner Koch
7f9e0ca57b
core: New export mode to export as OpenSSH public key.
* src/gpgme.h.in (GPGME_EXPORT_MODE_SSH): New.
* src/export.c (export_ext_start): Allow for new mode.
* src/engine-gpg.c (export_common): Implement.
* tests/run-export.c (status_cb): New.
(main): New options --status and --ssh.
--

GnuPG-bug-id: 4310
Signed-off-by: Werner Koch <wk@gnupg.org>
2020-07-16 12:00:46 +02:00
Werner Koch
8589091682
core: Deprecate the non-working trustlist functions.
* src/gpgme.h.in: Clarify that the trustlist function should not be
used.
* src/engine.c (_gpgme_engine_op_trustlist): Always return an error.
* src/engine-backend.h (struct engine_ops): Remove trustlist member.
* src/engine-gpg.c (gpg_trustlist): Remove.
(struct engine_ops): Remove that member.  Also in all other engines.
* tests/gpg/t-trustlist.c: Remove.
* lang/python/tests/t-trustlist.py: Remove.
--

This never worked in reality because the required feature has been
removed from GnuPG version 1.3.2 soon after introduction of this
feature in gpgme - 17 years ago.  It was anyway marked as
experimental.  We keep the API and ABI, though.

GnuPG-bug-id: 4834
Signed-off-by: Werner Koch <wk@gnupg.org>
2020-07-15 16:34:24 +02:00
NIIBE Yutaka
0cc040e82f tests: Remove/change tests for GnuPG 2.3 with no gpg.keyserver.
* lang/qt/tests/t-config.cpp (testKeyserver): Remove.
* tests/gpg/t-gpgconf.c (main): Test with dirmngr.keyserver.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2020-05-11 14:20:48 +09:00
Andre Heinecke
5c0d1c7f76
tests, json: Do not check for keygrip of pubkeys
* tests/json/t-keylist-secret.out.json: Do not check for keygrip
of bravo key.

--
Since GnuPG 2.2.19 the keygrip is not emitted for public keys
in a keylisting --with-secret.

As the GPGME test suite should pass with several versions
the json test cannot test this as the suite does not allow
version checks for different output.

What the intended behavior is might still be up for discussion,
always adding --with-keygip is not a good solution because
it slows down keylistings for large keyrings.

GnuPG-Bug-Id: T4820
2020-05-08 10:30:53 +02:00
NIIBE Yutaka
3658e2df65 tests: Add ECC key generation for tests/gpgsm.
* tests/gpgsm/t-genkey.c (check_result): New.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2020-03-27 19:50:24 +09:00
Werner Koch
3afa534645
core: New context flags "include-key-block" and "auto-key-import".
* src/gpgme.c (gpgme_set_ctx_flag): Add flags "include-key-block" and
"auto-key-import".
(gpgme_get_ctx_flag): Ditto.
* src/context.h (struct gpgme_context): Add flags include_key_block
and auto_key_import.
* src/engine-gpg.c (struct engine_gpg): Likewise.
(gpg_set_engine_flags): Set the flags for gpg versions >= 2.2.20.
(gpg_decrypt): Set option according to the new flags.
(gpg_encrypt): Ditto.
(gpg_encrypt_sign): Ditto.
(gpg_sign): Ditto.
(gpg_verify): Ditto.

tests/run-verify: Add option --auto-key-import.
tests/run-sign: add option --include-key-block.
--

GnuPG-bug-id: 4856
Signed-off-by: Werner Koch <wk@gnupg.org>
2020-03-17 17:24:21 +01:00
Andre Heinecke
cff600f1f6
Do not test for a bug in older GnuPG versions
* tests/json/t-keylist-secret.out.json

--
Since at least 2.2.19 GnuPG no longer emits secret = true
for keys where it does not have a secret. To avoid
failures with older versions we remove the check altogether.

GnuPG-Bug-Id: T4820
2020-01-29 11:01:10 +01:00
Werner Koch
5eeae535ee
core: Extend gpgme_user_id_t with uidhash member.
* src/gpgme.h.in (struct _gpgme_user_id): Add field 'uidhash'.
* src/key.c (gpgme_key_unref): Free it.
* src/keylist.c (keylist_colon_handler): Set it.
* tests/run-keylist.c (main): Print it.
--

The uidhash value is part of gpg's output since the year 2005.  This
now adds support to gpgme.  The application for uidhash is to select
a user id in an edit interactor: Instead of giving the number of the
user id, the uidhash value can be be used to avoid tracking the user
id numbers.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-12-13 15:11:00 +01:00
NIIBE Yutaka
b97434fbf0 json: Fix t-decrypt-verify.out for GnuPG >= 2.3.
* tests/json/t-decrypt-verify.out.json: Remove check with key of
04071FB807287134.

--

GnuPG 2.3 changes how public key decryption works; It collects list of
PUBKEY_ENC packets and then processes an ENCRYPTED* packet.  At the
stage of processing an ENCRYPTED* packet, it checks if private keys
can decrypt any of PUBKEY_ENC packets.  It does not necessarily
examine all of PUBKEY_ENC packets.  Only when it finds a PUBKEY_ENC
packet cannot be decrypted, it reports STATUS_NO_SECKEY with keyid of
that packet.

GnuPG 2.2 or older tries PUBKEY_ENC packets in order, and the first
successful PUBKEY_ENC packet is used.  Rest of PUBKEY_ENC packets are
not examined, but STATUS_NO_SECKEY with keyid is reported even when
there is a valid private key.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-08-06 11:19:59 +09:00
Werner Koch
f6fd90c99a
tests: Minor fix to run-threaded.c.
* tests/run-threaded.c (random_data_close): Correct FD test.
--

An invalid DS is -1 and not 0; this fix is for correctness and does
not chnage anything in the real world.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-06-06 18:59:16 +02:00
Andre Heinecke
e6f2827306
tests: Add option "allow-del" to run-threaded
* tests/run-threaded.c (main): Handle allow-del.
(allow-del): New. Variable to allow deletion of keys.
(import): Delete key after import if allow-del is set.
(delete_impres): Delete keys from an import result.
(delete_fpr): Delete a key by fingerprint.

--
This is intended to test write access and locking of the
keyring by repeatedly importing and deleting pubkeys.

It is an option because it might cause keyring corruption
etc. so it should be explicitly enabled.
2019-06-06 09:19:02 +02:00
Andre Heinecke
024a7f75d4
tests: Implement import in run-threaded
* tests/run-threaded.c (import): New.
(do_data_op): Call it.
2019-06-05 17:23:59 +02:00
Andre Heinecke
3a3648e3a5
tests: Use synced output for error in run-threaded
* tests/run-threaded.c (do_data_op): Use synced out macro.
2019-06-05 16:20:31 +02:00
Andre Heinecke
3a11421d0f
tests: Avoid variable named the same as a macro
* tests/run-threaded.c (decrypt, verify): Don't use a variable name
that is also a macro.

--
It just looks confusing and strange at first glance.
2019-06-05 16:20:31 +02:00
Andre Heinecke
9bbe15ebbc
tests,w32: Fix thread creation in run-threaded
* tests/run-threaded.c (create_thread): Check proper return
value and not return value of CloseHandle.
2019-06-05 16:20:31 +02:00
Daniel Kahn Gillmor
c5c3a9d10b tests: add two new types of encrypted data
* tests/gpg/cipher-3.asc: add an encrypted file containing signatures
(one from a known key, and one from an unknown key)
* tests/gpg/cipher-no-sig.asc: add an encrypted file containing no
signatures at all

--

We currently aren't using these files yet, but they should be useful
for exercising the library in unusual circumstances (where the bugs
are).

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-02 22:23:28 -04:00
Andre Heinecke
4746c5c9e2
tests: Add cms mode to run-import
* tests/run-import.c (show_usage): Add doc for cms / openpgp.
(main): Handle protocol.
2019-05-02 10:26:44 +02:00
Werner Koch
b159b2eddd
tests: Let run-verify print the de-vs flag.
* tests/run-verify.c (print_result): Chack is_de_vs.
* tests/run-import.c (main): Fix bad parameter for format string.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-02-28 14:01:47 +01:00
Andre Heinecke
f8312d7c33
tests: Fix memleak in run-threaded
* tests/run-threaded.c (verify): Free msg.
2019-02-11 15:33:34 +01:00
NIIBE Yutaka
66bcb8acb2 build: With LD_LIBRARY_PATH defined, use --disable-new-dtags.
* configure.ac (LDADD_FOR_TESTS_KLUDGE): New for --disable-new-dtags.
* tests/Makefile.am (LDADD): Use LDADD_FOR_TESTS_KLUDGE.
* lang/cpp/tests/Makefile.am, lang/qt/tests/Makefile.am: Likewise.
* tests/gpg/Makefile.am, tests/gpgsm/Makefile.am: Likewise.
* tests/json/Makefile.am, tests/opassuan/Makefile.am: Likewise.

--

GnuPG-bug-id: 4298
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-01-16 10:59:25 +09:00
Andre Heinecke
ce327f994a
tests: Add diagnostic example to run-import.c
* tests/run-import.c (main): Show diagnostics in verbose mode.
2019-01-15 08:36:26 +01:00
Andre Heinecke
a9cfb6dad8
tests, json: Make them run on debian stable
* tests/json/t-json.c (main): Relax version check a bit.
2018-11-28 10:45:27 +01:00
Werner Koch
8d91c0f4cd
Add SPDX identifiers to most source files
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-11-16 13:27:33 +01:00
Andre Heinecke
d0402f886b
tests: Add run-threaded for multithread tests
* tests/Makefile.am (run-threaded): Add.
* tests/run-threaded.c: New.

--
This test is intended to help detect race conditions
or other multithread problems. It can also be used
to put the whole GnuPG system under extreme load.
2018-11-15 11:57:27 +01:00
Andre Heinecke
004e2cad2f
tests,json: Clean openpgp-revocs.d
* tests/json/clean-local: Remove revocs.d
2018-11-15 10:33:35 +01:00
Andre Heinecke
40d962b43a
tests,json: Move version check into t-json
* tests/gpg/t-support.h (check_gpg_version, compare_versions),
(parse_version_string, parse_version_number): Remove version
check code.
* tests/json/t-json.c (check_gpg_version, compare_versions),
(parse_version_string, parse_version_number): Add.
--

t-support header was not a good place for this. It should
go into a library e.g. gpgrt in the future. For now we
can keep it close to where it is needed.
2018-11-15 10:31:22 +01:00
Andre Heinecke
d3dae4a445
tests,json: Add sig-notations test
* tests/json/t-sig-notations.in.json,
tests/json/t-sig-notations.out.json: New
* tests/json/Makefile.am (EXTRA_DIST): Add files.
* tests/json/t-json.c: Register it.
2018-11-14 17:56:23 +01:00
Andre Heinecke
def030e843
tests,json: Fix distcheck
* tests/json/Makefile.am (EXTRA_DIST): Add inital and final scripts.
(t_json_SOURCES): Don't use cJSON.o as source.
2018-11-14 17:21:24 +01:00
Andre Heinecke
d0087d45f0
tests,json: Add more tests
* t-config-opt.in.json,
 t-config-opt.out.json,
 t-import.in.json,
 t-import.out.json,
 t-sign.in.json,
 t-sign.out.json: New.
--
These should actually have been in a previous commit as
they are already registered.
2018-11-14 17:05:25 +01:00
Andre Heinecke
88b7221eb7
tests,json: Add missing files and chunking test
* tests/json/Makefile.am, tests/json/final.test,
tests/json/initial.test: New.
* tests/json/t-chunking.in.json, tests/json/t-chunking.out.json:
New test.
* tests/json/t-json.c: Register new test.

--
Oops..
2018-11-14 15:55:02 +01:00
Andre Heinecke
27ca12e815
tests,json: Fix match if the first child differs
* tests/json/t-json.c (test_contains): Try all siblings of
the haystack child.

--
This fixes the case where we don't match against the
first child because the order might have changed or
a new element was inserted at the top. Then we
have to try out also all the siblings.
2018-11-14 15:17:18 +01:00
Andre Heinecke
dd4b80a5f6
tests,json: Add the bulk of tests
* t-json.c (tests): Register new tests.
* t-createkey.in.json,
  t-createkey.out.json,
  t-decrypt-verify.in.json,
  t-decrypt-verify.out.json,
  t-decrypt.in.json,
  t-decrypt.out.json,
  t-delete.in.json,
  t-delete.out.json,
  t-encrypt-sign.in.json,
  t-encrypt-sign.out.json,
  t-encrypt.in.json,
  t-encrypt.out.json,
  t-export-secret-info.in.json,
  t-export-secret-info.out.json,
  t-export.in.json,
  t-export.out.json,
  t-json.c,
  t-keylist-secret.in.json,
  t-keylist-secret.out.json,
  t-keylist.in.json,
  t-keylist.out.json,
  t-verify.in.json,
  t-verify.out.json,
  t-version.in.json,
  t-version.out.json: New.

--
Except for help and getmore there is now a test for each command.
2018-11-14 15:15:21 +01:00
Andre Heinecke
9a31fdcb11
tests,json: Add wildcard string matching
* tests/json/t-json.c (test_contains): When searching for "*" accept
every string.

--
This allows it to write tests that check for the existence of
a string value but don't care about the contents. E.g. for Data.
2018-11-14 14:57:40 +01:00
Andre Heinecke
e55e467d5f
tests,json: Skip tests for older GnuPG versions
* tests/json/t-json.c (main): Skip if version is not at least
2.2.0

--
In the past new tests often failed when a modern GPGME was
used with old GnuPG's.
This should avoid the hassle for packagers without the
requirement that we test against old versions.
2018-11-14 14:55:09 +01:00
Andre Heinecke
ca2e2b3d69
tests,json: Suffix .json to test pattern
* tests/json/t-config.in, tests/json/t-config.out: Renamed.
* t-json.c (run_test): Use new naming pattern.
2018-11-14 14:53:28 +01:00
Andre Heinecke
5b61c092e7
tests,gpg: Add version check hlp to t-support
* t-support.h (parse_version_number, parse_version_string)
(compare_versions): New. Copy&Paste from src/version.c
(check_gpg_version): New helper to check for a gpg version.

--
This should make it easier to write tests that e.g.
rely on modern gnupg features.
2018-11-14 14:50:57 +01:00
Andre Heinecke
9933641cce
tests,json: Improve verbose mode and add verbose 2
* tests/json/t-json.c (main): Handle multiple verbose args.
(test-contains): Improve verbose output
2018-11-14 13:14:52 +01:00
Andre Heinecke
3e5684d99b
tests,json: Fix and improve t-json
* tests/json/t-json.c (run_test): Terminate argv array correctly.
(run_test): Note and handle empty response.
2018-11-14 13:05:36 +01:00
Andre Heinecke
0c31837766
tests: Add json testrunner
* configure.ac: Configure makefile.
* tests/Makefile.am: Run json tests if gpg tests are run.
* tests/json/t-json.c: New testrunner for json tests.
* tests/json/t-config.in, tests/json/t-config.out: First test.
--
The idea of this test runner is that it only looks for parts
in the output. This should allow it to write robust tests
that check for the basics in the output but don't fail when
the output is extended or slightly changed.
2018-11-14 11:51:08 +01:00
Daniel Kahn Gillmor
2557d0ae6f spelling: fix misspellings
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-11-08 12:34:27 +07:00
Andre Heinecke
681525be00
tests: Add repeat argument to run-verify
* tests/run-verify.c (main): Add repeat argument.

--
This helps reproducing rare / random crashes.
2018-10-29 16:33:04 +01:00
Daniel Kahn Gillmor
2f12427e41 doc: use https:// for www.gnu.org
--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-10-18 00:28:51 -04:00
Andre Heinecke
85627e5818
core: Add trust-model flag
* src/context.h (gpgme_context): Extend with trust_model.
* src/engine-gpg.c (engine_gpg): Extend with trust_model.
(gpg_set_engine_flags): Take trust_model from context.
(build_argv): Handle trust_model.
(gpg_release): Free trust_model.
* src/gpgme.c (gpgme_set_ctx_flag): Handle trust-model flag.
(gpgme_release): Release trust-model.
* doc/gpgme.texi: Document new flag for gpgme_set_ctx_flag.
(Context Flags): New subsection for the context flags.
* tests/run-keylist.c (show_usage, main): Add new --trust-model
parameter.

--
This gives a GPGME user fine grained control over the
trust-model.

Changing the trust model for only a single application depends
on:
GnuPG-Bug-Id: T4134
Maniphest Tasks: T4134
Differential Revision: https://dev.gnupg.org/D466
2018-10-09 10:48:58 +02:00
Werner Koch
a824f4498e
tests: Don't try using keys from a scmartcard.
* tests/gpg/Makefile.am: Disable scdaemon
* lang/python/tests/Makefile.am: Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 12:13:03 +02:00
Andre Heinecke
d09d19fa9f
Make GNUPGHOME for tests overridable
* lang/python/tests/Makefile.am,
lang/qt/tests/Makefile.am,
tests/Makefile.am,
tests/gpg/Makefile.am,
tests/gpgsm/Makefile.am,
tests/opassuan/Makefile.am (GNUPGHOME): Make variable explict.

--
If the build directory has too long path, gpgme could fail.
This is similar to

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847206

In order to fix that, this patch extracts the GNUPGHOME variable
to be presented directly in the Makefile and thus overridable by
command line option.

A build system can then create a symlink to the GNUPGHOME directory
in /tmp and use that symlink as the GNUPGHOME directory
thus making the path very short.

GnuPG-Bug-Id: T4091

Patch provided by vlmarek
2018-08-06 09:30:47 +02:00
Andre Heinecke
c287f09ac0
tests: Add --with-secret to run-keylist.c
* run-keylist.c (show_usage, main): Add --with-secret.
2018-07-09 11:17:27 +02:00
Andre Heinecke
7bc5d3c7e4
Add ctx flag for auto-key-locate
* src/context.h (gpgme_context): Add auto_key_locate.
* src/engine-gpg.c (engine_gpg): Add auto_key_locate.
(gpg_set_engine_flags, build_argv): Handle auto_key_locate.
(gpg_release): Free auto_key_locate.
* src/gpgme.c (gpgme_release): Free auto_key_locate.
(gpgme_get_ctx_flag, gpgme_set_ctx_flag): Handle auto-key-locate.
* doc/gpgme.texi: Document auto-key-locate flag.
* tests/run-keylist.c (show_usage, main): Add --from-wkd option.

--
This enables users of GPGME to control more fine grained what
auto-key-locate does.  Especially for WKD lookups / refreshes
can this be useful.

GnuPG-Bug-Id: T2917
Differential Revision: https://dev.gnupg.org/D463
2018-07-09 10:58:04 +02:00
Andre Heinecke
a2458806f8
core: Add gpg auditlog to get diagnostics
* src/engine-gpg.c (engine_gpg): Add diagnostics member.
(gpg_release): Release diagnostics data.
(gpg_new): Set up logger-fd and diagnostics.
(gpg_getauditlog): New. Copy diagnostics to a user data.
(engine_ops): Add getauditlog.
* src/engine-gpgsm.c (gpgsm_getauditlog): Return not implemented
for GPGME_AUDITLOG_DIAG.
* src/getauditlog.c (getauditlog_start): Don't reset engine
for diagnostics.
* src/gpgme.h.in (GPGME_AUDITLOG_DIAG): New.
(GPGME_AUDITLOG_DEFAULT): New alias to 0.
* tests/run-decrypt.c (show_usage, main): Add --diagnostics.
* doc/gpgme.texi(Additional Logs): Document getauditlog.

--
This enables users of GPGME to get more verbose information
from gpg which can assist users in figuring out a problem
that was before hidden behind a generalized error like
"Decryption Failed".

For GPGSM it is not yet available as it is problematic to
get it properly in server mode and GPGSM already had the
original audit log mechanism in place.

GPGME_AUDITLOG_DEFAULT was added for a more explicit
documentation.
2018-07-05 11:29:36 +02:00
Werner Koch
662604c5bc
core: New context flag "ignore-mdc-error".
* src/context.h (gpgme_context): Add field ignore_mdc_error.
* src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): Set/get it.
* src/engine-gpg.c (engine_gpg): Add flags.ignore_mdc_error.
(gpg_set_engine_flags): Set it.
(build_argv): Pass option to gpg.
* src/decrypt.c (_gpgme_decrypt_status_handler): Take care of flag.
(gpgme_op_decrypt_result): Clear flag.
(gpgme_op_decrypt): Clear flag.
* src/decrypt-verify.c (gpgme_op_decrypt_verify): Clear flag
(gpgme_op_decrypt_ext): Clear flag.

* tests/run-decrypt.c (show_usage): Add option --ignore-mdc-error.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-06-01 01:29:34 +02:00
Werner Koch
dd19cabe81
core: New decryption result flag 'legacy_cipher_nomdc'.
* src/gpgme.h.in (_gpgme_op_decrypt_result): Add flag
legacy_cipher_nomdc.
* src/decrypt.c (parse_status_error): Set this flag.
* tests/run-decrypt.c (print_result): print it.
(main): Print the result even on error.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-06-01 01:01:08 +02:00
Werner Koch
3d8e5c0751
tests: Fix t-verify test for GnuPG < 2.2.7.
* tests/gpg/t-verify.c (check_result): Tweak for gnupg < 2.2.7.
--

The not yet releases 2.2.7-beta may print a full fingerprint in the
ERRSIG status.  This is compliant with the dscription but the new
t-verify test case did not took in account that older GnuPG versions
print only a keyid.

Fixes-commit: b99502274a
GnUPG-bug-id: 3920
Signed-off-by: Werner Koch <wk@gnupg.org>
2018-04-19 10:29:30 +02:00
Werner Koch
65479fe7b8
core: Add 'is_mime' flags to the verify and decrypt results.
* src/op-support.c (_gpgme_parse_plaintext): Add arg r_mime.
* src/decrypt.c (_gpgme_decrypt_status_handler): Ser mime flag.
* src/verify.c (_gpgme_verify_status_handler): Ditto.
* src/gpgme.h.in (gpgme_op_verify_result_t): Append fields 'is_mime'
and '_unused'.
(gpgme_op_decrypt_result_t): New field 'is_mime'.  Shrink '_unused'.

* tests/run-decrypt.c (print_result): Print MIME flag.
* tests/run-verify.c (print_result): Ditto.
--

Note that this flag (Liternal Data packet's 'm' mode) is only
specified in RFC-4880bis.  To use it you currently need to add
"rfc4880bis" to the the gpg.conf.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-04-18 15:20:35 +02:00
Werner Koch
01435da498
core: Extend decryption result with symkey_algo.
* src/gpgme.h.in (gpgme_op_decrypt_result_t): Add field 'symkey_algo'.
* src/decrypt.c (release_op_data): Free SYMKEY_ALGO.
(gpgme_op_decrypt_result): Make sure SYMKEY_ALGO is not NULL.
(parse_decryption_info): New.
(_gpgme_decrypt_status_handler): Parse DECRYPTION_INFO status.
* src/conversion.c (_gpgme_cipher_algo_name): New.
(_gpgme_cipher_mode_name): New.

* tests/run-decrypt.c (print_result): Print SYMKEY_ALGO

* src/util.h (_gpgme_map_gnupg_error): Remove obsolete prototype.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-04-17 13:48:56 +02:00
Werner Koch
a1f76b3b54
core: Add extended versions of the encrypt functions.
* src/gpgme.h.in (gpgme_op_encrypt_ext_start) New.
(gpgme_op_encrypt_ext): New.
(gpgme_op_encrypt_sign_ext_start): New.
(gpgme_op_encrypt_sign_ext): New.
* src/libgpgme.vers, tests/run-encrypt.c: Add them.

* src/encrypt.c (encrypt_start): Add arg recpstring.
(gpgme_op_encrypt): Factor code out to ...
(gpgme_op_encrypt_ext): new function with new arg recpstring.
(gpgme_op_encrypt_start): Factor code out to ...
(gpgme_op_encrypt_ext_start): new function with new arg recpstring.
* src/encrypt-sign.c (encrypt_sign_start): Add arg recpstring.
(gpgme_op_encrypt_sign): Factor code out to ...
(gpgme_op_encrypt_sign_ext): new function with new arg recpstring.
(gpgme_op_encrypt_sign_start): Factor code out to ...
(gpgme_op_encrypt_sign_ext_start): new function with new arg
recpstring.

* src/engine-backend.h (struct engine_ops): Change fields encrypt and
encrypt_sign.
* src/engine.c (_gpgme_engine_op_encrypt): Add arg recpstring and pass
to engine.
(_gpgme_engine_op_encrypt_sign): Ditto.
* src/engine-gpg.c (append_args_from_recipients_string): New.
(gpg_encrypt): Add arg recpstring and call new function as needed.
(gpg_encrypt_sign): Ditto.
* src/engine-gpgsm.c (set_recipients_from_string): New.
(gpgsm_encrypt): Add arg recpstring and call new function as needed.
* src/engine-uiserver.c (set_recipients_from_string): New.
(uiserver_encrypt): Add arg recpstring and call new function as
needed.

* tests/run-encrypt.c (xstrdup): New.
(main): Add option --keystring.

* src/gpgme-json.c (get_keys): Simplify.
(op_encrypt): Modify to make use of the extended encrypt function.

--

This new feature can be used to avoid the need for a key lookup and
thus several extra calls to the backend.

Note that run-test uses a semicolon as delimiter because that make
testing the feature on the command line much easier.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-04-17 08:45:00 +02:00
Werner Koch
b99502274a
core: Tweak STATUS_FAILURE handling.
* src/op-support.c (_gpgme_parse_failure): Ignore failures with
location "gpg-exit".
* tests/gpg/t-verify.c (main): Adjust for the now working checking of
the second key.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-04-12 20:36:30 +02:00
Werner Koch
ee8fad3ea0
tests: Avoid segv in run-verify due to Policy URLs
* tests/run-verify.c (print_result): Take care of Policy URLs.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-04-12 15:59:22 +02:00
Werner Koch
bdf7cd2e28
tests: Add another check to gpg/t-verify.
* tests/gpg/t-verify.c (PGM): New.  Use it instead of __FILE__.
(test_sig1_plus_unknown_key): New test signature.
(check_result): Allow checking of several signatures.
(main): Check a signature with a know and an unknown key.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-04-12 15:39:20 +02:00
Werner Koch
f7700a0169
core: Add new context flag "no-symkey-cache".
* src/gpgme.c (gpgme_set_ctx_flag): Set flag.
(gpgme_get_ctx_flag): Get flag.
* src/context.h (struct gpgme_context): Add field no_symkey_cache.
* src/engine-gpg.c (struct engine_gpg): Ditto.
(gpg_set_engine_flags): Set flag.
(build_argv): Pass option --no-symkey-cache to gpg.

* tests/run-decrypt.c (print_result): Fix segv for symmetric messages.
(main): New option --no-symkey-cache.
* tests/run-encrypt.c (main): New option --no-symkey-cache.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-04-12 09:17:27 +02:00
Werner Koch
b9000bc293
core: New gpgme_set_ctx_flag "request-origin".
* src/context.h (gpgme_context): Add 'request_origin'.
* src/gpgme.c (gpgme_release): Free that field.
(gpgme_set_ctx_flag, gpgme_get_ctx_flag): Add "request-origin".
* src/engine-backend.h (engine_ops): Add 'set_engine_ops' func ptr and
adjust all users.
* src/engine.c (_gpgme_engine_set_engine_flags): New.
* src/op-support.c (_gpgme_op_reset): Call that func.
* src/engine-gpg.c (struct engine_gpg): Add 'request_origin'.
(gpg_set_engine_flags): New.
(_gpgme_engine_ops_gpg): Hook it.
(build_argv): Use command line option --request-origin.
* src/engine-gpgsm.c (struct engine_gpgsm): Add 'request_origin'.
(gpgsm_set_engine_flags): New.
(_gpgme_engine_ops_gpgsm): Hook it.
(start): Send OPTION "request-origin".
* src/engine-assuan.c (struct engine_llass): Add 'request_origin'.
(gpgsm_set_engine_flags): New.
(_gpgme_engine_ops_assuan): Hook it.
(start): Send OPTION "pretend-request-origin".

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-03-23 15:27:32 +01:00
Andre Heinecke
a630a1e3e7
core: Parse skipped_v3_keys
* src/gpgme.h.in (gpgme_import_result_t): Extend with skipped_v3_keys.
* src/import.c (gpgme_op_import_result): Extend debug with new field.
(parse_import_res): Parse skipped_v3_keys.
* tests/gpg/t-support.h, tests/run-support.h (print_import_result):
Print skipped_v3_keys.

--
This makes it possible to handle this in a GUI in a future
version.

GnuPG-Bug-Id: T3776
2018-03-15 16:23:18 +01:00
NIIBE Yutaka
3224d7f0ea tests: Fix previous commit
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2018-02-15 11:31:57 +09:00
NIIBE Yutaka
ba6e610baa tests: More Makefile portability.
* tests/gpg/Makefile.am: Invoke GPG with TESTS_ENVIRONMENT.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2018-02-15 11:24:33 +09:00
NIIBE Yutaka
b5ec21b9ba tests: Makefile portability.
* tests/gpg/Makefile.am: Don't use "export" directive.
* tests/gpgsm/Makefile.am: Ditto.
* lang/qt/tests/Makefile.am: Ditto.
* lang/python/tests/Makefile.am: Ditto.

--

GnuPG-bug-id: 3056
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2018-02-15 11:14:49 +09:00
NIIBE Yutaka
f1d8a7975b build: Fix Makefiles for portability.
* tests/gpg/Makefile.am: Don't allow target with '/'.
* tests/gpgsm/Makefile.am: Ditto.

--

BSD Make doesn't allow a target with '/'.  We still have such a target
in lang/python/Makefile.am, but it's for maintainer only, so,
assumption to GNU Make is OK there.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2018-02-14 17:34:28 +09:00
NIIBE Yutaka
59fcabbdf5 Fix for BSD Make.
* tests/gpg/Makefile.am, tests/gpgsm/Makefile.am: Remove ./.

--

GNU Make is powerful enough for handling and interpreting of
pathname as target, but BSD Make is not.

GnuPG-bug-id: 3056
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2018-01-30 08:22:57 +09:00
NIIBE Yutaka
58130b97f6 tests: Fix for NetBSD.
* tests/gpg/pinentry: Use /bin/sh instead of Bash.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2018-01-29 12:04:55 +09:00
Andre Heinecke
7b5182f288
Spelling fixes for comments and doc
--
Patch provided by ka7 in dev.gnupg.org

Differential D423
2017-12-08 05:59:11 +01:00
Andre Heinecke
5ba1cbdf39
tests: Print userid signatures in run-keylist
* tests/run-keylist.c (main): Print UID signatures if there
are any.
2017-12-07 13:47:18 +01:00
Werner Koch
0c1244a2b7
core: Also check for a failed selftest in gpgm_data_new.
* src/data.c (_gpgme_data_new): Check for failed selftest.
* tests/run-support.h (make_filename): Print a message on mallooc
failure.
(init_gpgme_basic): New.
* tests/run-identify.c (main): Call init_gpgme_basic becuase we do not
need to setup a protocol.
* tests/t-data.c: Define PGM and include run-support.h.
(make_filename): Remove.
(main): Call init_gpgme_basic.
--

Note: This patch may break applications which used gpgme_data but no
gpgme_new without having called the required gpgme_check_version.

GPGME can be used without a protocol for example to work with the data
object abstraction.  Thus a call to gpgme_data_new also needs to check
the result of the core selftests - including on whether
gpgme_check_version has been called.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-12-04 12:08:31 +01:00
Werner Koch
f430165007
tests: Add missing variable to gpgsm tests Makefile
* tests/gpgsm/Makefile.am (GPG_AGENT): Set var.  It is used later.
--

Note that the var is used by the gpgsm.conf target.

Reported-by: Alon Bar-Lev <alon.barlev@gmail.com>
Signed-off-by: Werner Koch <wk@gnupg.org>
2017-11-30 09:52:10 +01:00
NIIBE Yutaka
c441fb7313 tests: Make portability fix.
* lang/python/tests/Makefile.am: Distinguish target and path.
* tests/gpg/Makefile.am: Ditto.
* tests/gpgsm/Makefile.am: Ditto.

--

GNU Make is powerful enough to match path to target (and vice versa),
but BSD make is not.

GnuPG-bug-id: 3056
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-11-21 15:35:10 +09:00
Werner Koch
47f61df070
core: New context flag "auto-key-retrieve"
* src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag
"auto-key-retrieve".
* src/context.h (gpgme_context): New field auto_key_retrieve.
* src/engine-backend.h (struct engine_ops): Add arg auto_key_retrieve
to field 'decrypt'.
* src/engine-gpg.c (gpg_decrypt): Add arg auto_key_retrieve and pass
option --auto-key-retrieve to gpg.  Adjust all callers.
(gpg_verify): Ditto.
* src/engine-gpgsm.c (gpgsm_decrypt): Add dummy arg auto_key_retrieve.
* src/engine-uiserver.c (uiserver_decrypt): Ditto.
* tests/run-verify.c (main): Add option --auto-key-retrieve.
--

This makes the --auto-key-retrieve option available in the GPGME API.

Test plan:
Run

  GPGME_DEBUG=9:out tests/run-verify SIGNEDFILE

with and without its new option --auto-key-retrieve and check in the
trace stored in "out" whether --auto-key-retrieve was passed to gpg.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-08-24 17:17:11 +02:00
Marcus Brinkmann
3244d4daff gpgconf: Fix some warnings.
* tests/gpg/t-gpgconf.c (main): Fix warnings.
* src/engine-gpgconf.c (struct gpgconf_config_dir_s): New struct.
(gpgconf_config_dir_cb, gpgconf_conf_dir) Use it to fix warning.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
2017-08-16 01:50:00 +02:00
Marcus Brinkmann
9f24e6c901 gpgconf: Add access to --list-dirs for non-default engine.
* src/engine-assuan.c (_gpgme_engine_ops_assuan): Add conf_dir.
* src/engine-g13.c (_gpgme_engine_ops_g13): Likewise.
* src/engine-gpg.c (_gpgme_engine_ops_gpg): Likewise.
* src/engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Likewise.
* src/engine-spawn.c (_gpgme_engine_ops_spawn): Likewise.
* src/engine-uiserver.c (_gpgme_engine_ops_uiserver): Likewise.
* src/engine-backend.h (struct engine_ops): Likewise.
* src/engine-gpgconf.c (gpgconf_config_dir_cb, gpgconf_conf_dir):
New functions.
(struct engine_ops): Add gpgconf_conf_dir.
* src/engine.c (_gpgme_engine_op_conf_dir): New function.
* src/engine.h (_gpgme_engine_op_conf_dir): New prototype.
* src/gpgconf.c (gpgme_op_conf_dir): New function.
* src/gpgme.def (gpgme_op_conf_save): New symbol.
* src/gpgme.h.in (gpgme_op_conf_dir): New prototype.
* src/libgpgme.vers (gpgme_op_conf_dir): New symbol.
* tests/gpg/t-gpgconf.c (main): Test gpgme_op_conf_dir.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3018
2017-08-15 19:52:29 +02:00
Justus Winter
7fde780cc1
tests: Fix distcheck.
* tests/start-stop-agent: Remove backup file.

Fixes-commit: 9cd2b58dfb
Signed-off-by: Justus Winter <justus@g10code.com>
2017-07-13 16:06:27 +02:00
Justus Winter
ceed4a7454
tests: Fix blunder.
--
Fixes-commit: 9cd2b58dfb
Signed-off-by: Justus Winter <justus@g10code.com>
2017-07-13 16:04:07 +02:00
Justus Winter
9cd2b58dfb
tests: Make agent spawning more robust.
* tests/gpgsm/Makefile.am (gpgsm.conf): Add agent-program directive.
* tests/start-stop-agent: Update agent-program directive.
--
Update the 'agent-program' configuration directive to point to the
same agent that we are starting.  Previously, it was possible that a
different agent was started if 'make check' was run with a different
PATH.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-07-13 15:41:11 +02:00
Werner Koch
46d2e48105
tests: Fix printf compiler warning for an error case.
* tests/gpg/t-keylist.c (main): Cast DIM to int.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-07-12 18:32:50 +02:00
Justus Winter
a9b4c0ad0d
tests: Remove remnants of 'check-local'.
* tests/gpgsm/Makefile.am (check-local): Drop rule and the dependency
on it.
--
Previously, the test environment was created during 'make check'.
Nowadays we create it using 'BUILT_SOURCES' during 'make all'.  Drop
remnant of the previous method.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-10 16:31:58 +02:00