aboutsummaryrefslogtreecommitdiffstats
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* tests: add two new types of encrypted dataDaniel Kahn Gillmor2019-05-033-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]>
* tests: Add cms mode to run-importAndre Heinecke2019-05-021-2/+15
| | | | | * tests/run-import.c (show_usage): Add doc for cms / openpgp. (main): Handle protocol.
* tests: Let run-verify print the de-vs flag.Werner Koch2019-02-282-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]>
* tests: Fix memleak in run-threadedAndre Heinecke2019-02-111-0/+1
| | | | * tests/run-threaded.c (verify): Free msg.
* build: With LD_LIBRARY_PATH defined, use --disable-new-dtags.NIIBE Yutaka2019-01-165-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]>
* tests: Add diagnostic example to run-import.cAndre Heinecke2019-01-151-0/+14
| | | | * tests/run-import.c (main): Show diagnostics in verbose mode.
* tests, json: Make them run on debian stableAndre Heinecke2018-11-281-2/+2
| | | | * tests/json/t-json.c (main): Relax version check a bit.
* Add SPDX identifiers to most source filesWerner Koch2018-11-1662-947/+964
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* tests: Add run-threaded for multithread testsAndre Heinecke2018-11-152-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.
* tests,json: Clean openpgp-revocs.dAndre Heinecke2018-11-151-0/+1
| | | | * tests/json/clean-local: Remove revocs.d
* tests,json: Move version check into t-jsonAndre Heinecke2018-11-152-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.
* tests,json: Add sig-notations testAndre Heinecke2018-11-144-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.
* tests,json: Fix distcheckAndre Heinecke2018-11-141-2/+3
| | | | | * tests/json/Makefile.am (EXTRA_DIST): Add inital and final scripts. (t_json_SOURCES): Don't use cJSON.o as source.
* tests,json: Add more testsAndre Heinecke2018-11-146-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.
* tests,json: Add missing files and chunking testAndre Heinecke2018-11-146-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..
* tests,json: Fix match if the first child differsAndre Heinecke2018-11-141-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.
* tests,json: Add the bulk of testsAndre Heinecke2018-11-1425-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.
* tests,json: Add wildcard string matchingAndre Heinecke2018-11-141-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.
* tests,json: Skip tests for older GnuPG versionsAndre Heinecke2018-11-141-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.
* tests,json: Suffix .json to test patternAndre Heinecke2018-11-143-2/+2
| | | | | * tests/json/t-config.in, tests/json/t-config.out: Renamed. * t-json.c (run_test): Use new naming pattern.
* tests,gpg: Add version check hlp to t-supportAndre Heinecke2018-11-141-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.
* tests,json: Improve verbose mode and add verbose 2Andre Heinecke2018-11-141-13/+25
| | | | | * tests/json/t-json.c (main): Handle multiple verbose args. (test-contains): Improve verbose output
* tests,json: Fix and improve t-jsonAndre Heinecke2018-11-141-10/+17
| | | | | * tests/json/t-json.c (run_test): Terminate argv array correctly. (run_test): Note and handle empty response.
* tests: Add json testrunnerAndre Heinecke2018-11-144-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.
* spelling: fix misspellingsDaniel Kahn Gillmor2018-11-082-2/+2
| | | | Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* tests: Add repeat argument to run-verifyAndre Heinecke2018-10-291-68/+92
| | | | | | | * tests/run-verify.c (main): Add repeat argument. -- This helps reproducing rare / random crashes.
* doc: use https:// for www.gnu.orgDaniel Kahn Gillmor2018-10-182-2/+2
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* core: Add trust-model flagAndre Heinecke2018-10-091-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
* tests: Don't try using keys from a scmartcard.Werner Koch2018-09-201-1/+7
| | | | | | | * tests/gpg/Makefile.am: Disable scdaemon * lang/python/tests/Makefile.am: Ditto. Signed-off-by: Werner Koch <[email protected]>
* Make GNUPGHOME for tests overridableAndre Heinecke2018-08-064-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
* tests: Add --with-secret to run-keylist.cAndre Heinecke2018-07-091-0/+6
| | | | * run-keylist.c (show_usage, main): Add --with-secret.
* Add ctx flag for auto-key-locateAndre Heinecke2018-07-091-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
* core: Add gpg auditlog to get diagnosticsAndre Heinecke2018-07-051-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.
* core: New context flag "ignore-mdc-error".Werner Koch2018-05-311-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]>
* core: New decryption result flag 'legacy_cipher_nomdc'.Werner Koch2018-05-311-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]>
* tests: Fix t-verify test for GnuPG < 2.2.7.Werner Koch2018-04-191-3/+9
| | | | | | | | | | | | | | * 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: b99502274ae5efdf6df0d967900ec3d1e64373d7 GnUPG-bug-id: 3920 Signed-off-by: Werner Koch <[email protected]>
* core: Add 'is_mime' flags to the verify and decrypt results.Werner Koch2018-04-182-14/+16
| | | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* core: Extend decryption result with symkey_algo.Werner Koch2018-04-171-0/+1
| | | | | | | | | | | | | | | | | * 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 <[email protected]>
* core: Add extended versions of the encrypt functions.Werner Koch2018-04-171-11/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* core: Tweak STATUS_FAILURE handling.Werner Koch2018-04-121-3/+5
| | | | | | | | | * 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 <[email protected]>
* tests: Avoid segv in run-verify due to Policy URLsWerner Koch2018-04-121-9/+16
| | | | | | * tests/run-verify.c (print_result): Take care of Policy URLs. Signed-off-by: Werner Koch <[email protected]>
* tests: Add another check to gpg/t-verify.Werner Koch2018-04-121-52/+84
| | | | | | | | | * 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 <[email protected]>
* core: Add new context flag "no-symkey-cache".Werner Koch2018-04-122-12/+47
| | | | | | | | | | | | | | | * 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 <[email protected]>
* core: New gpgme_set_ctx_flag "request-origin".Werner Koch2018-03-231-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* core: Parse skipped_v3_keysAndre Heinecke2018-03-152-4/+8
| | | | | | | | | | | | | | * 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
* tests: Fix previous commitNIIBE Yutaka2018-02-151-1/+1
| | | | Signed-off-by: NIIBE Yutaka <[email protected]>
* tests: More Makefile portability.NIIBE Yutaka2018-02-151-2/+2
| | | | | | * tests/gpg/Makefile.am: Invoke GPG with TESTS_ENVIRONMENT. Signed-off-by: NIIBE Yutaka <[email protected]>
* tests: Makefile portability.NIIBE Yutaka2018-02-152-13/+5
| | | | | | | | | | | | * 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 <[email protected]>
* build: Fix Makefiles for portability.NIIBE Yutaka2018-02-142-10/+10
| | | | | | | | | | | | | * 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 <[email protected]>
* Fix for BSD Make.NIIBE Yutaka2018-01-292-2/+2
| | | | | | | | | | | | * 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 <[email protected]>