aboutsummaryrefslogtreecommitdiffstats
path: root/tests (unfollow)
Commit message (Collapse)AuthorFilesLines
2020-07-16core: New export mode to export as OpenSSH public key.Werner Koch1-36/+74
* 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 <[email protected]>
2020-07-15core: Deprecate the non-working trustlist functions.Werner Koch2-68/+1
* 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 <[email protected]>
2020-05-11tests: Remove/change tests for GnuPG 2.3 with no gpg.keyserver.NIIBE Yutaka1-4/+4
* lang/qt/tests/t-config.cpp (testKeyserver): Remove. * tests/gpg/t-gpgconf.c (main): Test with dirmngr.keyserver. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-08tests, json: Do not check for keygrip of pubkeysAndre Heinecke1-2/+0
* 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-03-27tests: Add ECC key generation for tests/gpgsm.NIIBE Yutaka2-33/+65
* tests/gpgsm/t-genkey.c (check_result): New. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-03-17core: New context flags "include-key-block" and "auto-key-import".Werner Koch2-1/+39
* 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 <[email protected]>
2020-01-29Do not test for a bug in older GnuPG versionsAndre Heinecke1-1/+0
* 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
2019-12-13core: Extend gpgme_user_id_t with uidhash member.Werner Koch1-0/+2
* 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 <[email protected]>
2019-08-06json: Fix t-decrypt-verify.out for GnuPG >= 2.3.NIIBE Yutaka1-5/+0
* 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 <[email protected]>
2019-06-06tests: Minor fix to run-threaded.c.Werner Koch1-1/+5
* 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 <[email protected]>
2019-06-06tests: Add option "allow-del" to run-threadedAndre Heinecke1-0/+74
* 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-05tests: Implement import in run-threadedAndre Heinecke1-0/+36
* tests/run-threaded.c (import): New. (do_data_op): Call it.
2019-06-05tests: Use synced output for error in run-threadedAndre Heinecke1-2/+2
* tests/run-threaded.c (do_data_op): Use synced out macro.
2019-06-05tests: Avoid variable named the same as a macroAndre Heinecke1-8/+8
* 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-05tests,w32: Fix thread creation in run-threadedAndre Heinecke1-2/+4
* tests/run-threaded.c (create_thread): Check proper return value and not return value of CloseHandle.
2019-05-03tests: add two new types of encrypted dataDaniel Kahn Gillmor3-0/+32
* 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 <[email protected]>
2019-05-02tests: Add cms mode to run-importAndre Heinecke1-2/+15
* tests/run-import.c (show_usage): Add doc for cms / openpgp. (main): Handle protocol.
2019-02-28tests: Let run-verify print the de-vs flag.Werner Koch2-3/+4
* 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 <[email protected]>
2019-02-11tests: Fix memleak in run-threadedAndre Heinecke1-0/+1
* tests/run-threaded.c (verify): Free msg.
2019-01-16build: With LD_LIBRARY_PATH defined, use --disable-new-dtags.NIIBE Yutaka5-11/+13
* 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 <[email protected]>
2019-01-15tests: Add diagnostic example to run-import.cAndre Heinecke1-0/+14
* tests/run-import.c (main): Show diagnostics in verbose mode.
2018-11-28tests, json: Make them run on debian stableAndre Heinecke1-2/+2
* tests/json/t-json.c (main): Relax version check a bit.
2018-11-16Add SPDX identifiers to most source filesWerner Koch62-947/+964
-- Signed-off-by: Werner Koch <[email protected]>
2018-11-15tests: Add run-threaded for multithread testsAndre Heinecke2-1/+680
* 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-15tests,json: Clean openpgp-revocs.dAndre Heinecke1-0/+1
* tests/json/clean-local: Remove revocs.d
2018-11-15tests,json: Move version check into t-jsonAndre Heinecke2-103/+106
* 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-14tests,json: Add sig-notations testAndre Heinecke4-1/+62
* 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-14tests,json: Fix distcheckAndre Heinecke1-2/+3
* tests/json/Makefile.am (EXTRA_DIST): Add inital and final scripts. (t_json_SOURCES): Don't use cJSON.o as source.
2018-11-14tests,json: Add more testsAndre Heinecke6-0/+50
* 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-14tests,json: Add missing files and chunking testAndre Heinecke6-1/+125
* 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-14tests,json: Fix match if the first child differsAndre Heinecke1-1/+13
* 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-14tests,json: Add the bulk of testsAndre Heinecke25-1/+443
* 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-14tests,json: Add wildcard string matchingAndre Heinecke1-1/+3
* 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-14tests,json: Skip tests for older GnuPG versionsAndre Heinecke1-0/+8
* 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-14tests,json: Suffix .json to test patternAndre Heinecke3-2/+2
* tests/json/t-config.in, tests/json/t-config.out: Renamed. * t-json.c (run_test): Use new naming pattern.
2018-11-14tests,gpg: Add version check hlp to t-supportAndre Heinecke1-0/+104
* 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-14tests,json: Improve verbose mode and add verbose 2Andre Heinecke1-13/+25
* tests/json/t-json.c (main): Handle multiple verbose args. (test-contains): Improve verbose output
2018-11-14tests,json: Fix and improve t-jsonAndre Heinecke1-10/+17
* tests/json/t-json.c (run_test): Terminate argv array correctly. (run_test): Note and handle empty response.
2018-11-14tests: Add json testrunnerAndre Heinecke4-1/+368
* 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-08spelling: fix misspellingsDaniel Kahn Gillmor2-2/+2
Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2018-10-29tests: Add repeat argument to run-verifyAndre Heinecke1-68/+92
* tests/run-verify.c (main): Add repeat argument. -- This helps reproducing rare / random crashes.
2018-10-18doc: use https:// for www.gnu.orgDaniel Kahn Gillmor2-2/+2
-- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2018-10-09core: Add trust-model flagAndre Heinecke1-0/+18
* 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-09-20tests: Don't try using keys from a scmartcard.Werner Koch1-1/+7
* tests/gpg/Makefile.am: Disable scdaemon * lang/python/tests/Makefile.am: Ditto. Signed-off-by: Werner Koch <[email protected]>
2018-08-06Make GNUPGHOME for tests overridableAndre Heinecke4-4/+8
* 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-07-09tests: Add --with-secret to run-keylist.cAndre Heinecke1-0/+6
* run-keylist.c (show_usage, main): Add --with-secret.
2018-07-09Add ctx flag for auto-key-locateAndre Heinecke1-0/+15
* 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-05core: Add gpg auditlog to get diagnosticsAndre Heinecke1-0/+29
* 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-05-31core: New context flag "ignore-mdc-error".Werner Koch1-1/+19
* 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 <[email protected]>
2018-05-31core: New decryption result flag 'legacy_cipher_nomdc'.Werner Koch1-0/+3
* 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 <[email protected]>