aboutsummaryrefslogtreecommitdiffstats
path: root/tests (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-07-20tests: add test cases for import without uidVincent Breitmoser7-0/+118
This commit adds a test case that does the following, in order: - Import of a primary key plus user id - Check that import of a subkey works, without a user id present in the imported key - Check that import of a subkey revocation works, without a user id or subkey binding signature present in the imported key - Check that import of a primary key revocation works, without a user id present in the imported key -- Note that this test currently fails. The following changesets will fix gpg so that the tests pass. GnuPG-Bug-id: 4393 Signed-Off-By: Daniel Kahn Gillmor <[email protected]> Gbp-Pq: Topic import-merge-without-userid Gbp-Pq: Name tests-add-test-cases-for-import-without-uid.patch
2019-03-18gpg: Avoid importing secret keys if the keyblock is not valid.Werner Koch2-1/+3
* g10/keydb.h (struct kbnode_struct): Replace unused field RECNO by new field TAG. * g10/kbnode.c (alloc_node): Change accordingly. * g10/import.c (import_one): Add arg r_valid. (sec_to_pub_keyblock): Set tags. (resync_sec_with_pub_keyblock): New. (import_secret_one): Change return code to gpg_error_t. Return an error code if sec_to_pub_keyblock failed. Resync secret keyblock. -- When importing an invalid secret key ring for example without key binding signatures or no UIDs, gpg used to let gpg-agent store the secret keys anyway. This is clearly a bug because the diagnostics before claimed that for example the subkeys have been skipped. Importing the secret key parameters then anyway is surprising in particular because a gpg -k does not show the key. After importing the public key the secret keys suddenly showed up. This changes the behaviour of GnuPG-bug-id: 4392 to me more consistent but is not a solution to the actual bug. Caution: The ecc.scm test now fails because two of the sample keys don't have binding signatures. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit f799e9728bcadb3d4148a47848c78c5647860ea4)
2019-03-18tests: Add sample secret key w/o binding signatures.Werner Koch2-0/+66
-- GnuPG-bug-id: 4392 (cherry picked from commit 8c20a363c221438373439cde8c242e04c1bd925e)
2019-03-07tests: Add "disable-scdaemon" in gpg-agent.conf.NIIBE Yutaka5-10/+5
* tests/openpgp/defs.scm: Add "disable-scdaemon". Remove "scdaemon-program". * tests/gpgme/gpgme-defs.scm, tests/gpgsm/gpgsm-defs.scm: Likewise. * tests/inittests, tests/pkits/inittests: Add "disable-scdaemon" -- Before this change, running "make check" accesses USB device by scdaemon on host computer. If there is any smartcard/token available, it may affect test results. Because default key choice depends on smartcard/token availability now and existing tests have nothing about testing smartcard/token, disabling scdaemon is good. Signed-off-by: NIIBE Yutaka <[email protected]> (cherry picked from commit 64b7c6fd1945bc206cf56979633dfca8a7494374)
2019-02-25gpgscm: Build well even if NDEBUG defined.NIIBE Yutaka1-1/+3
* gpgscm/scheme.c (gc_reservation_failure): Fix adding ";". [!NDEBUG] (scheme_init_custom_alloc): Don't init seserved_lineno. -- Cherry icked from master commit of: e140c6d4f581be1a60a34b67b16430452f3987e8 In some build environment, NDEBUG is defined (although it's bad practice). This change supports such a situation. GnuPG-bug-id: 3959 Signed-off-by: NIIBE Yutaka <[email protected]>
2018-12-18Silence compiler warnings new with gcc 8.Werner Koch1-0/+12
* dirmngr/dns.c: Include gpgrt.h. Silence -Warray-bounds also gcc. * tests/gpgscm/scheme.c: Include gpgrt.h. (Eval_Cycle): Ignore -Wimplicit-fallthrough. -- The funny use of case and labels in the CASE macro seems confuse the fallthrough detection. Signed-off-by: Werner Koch <[email protected]>
2018-05-31gpg: Hard fail on a missing MDC even for legacy algorithms.Werner Koch1-0/+1
* g10/mainproc.c (proc_encrypted): Require an MDC or AEAD * tests/openpgp/defs.scm (create-gpghome): Use --ignore-mdc-error to allow testing with the current files. -- Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit d1431901f0143cdc7af8d1a23387e0c6b5bb613f) Resolved Conflicts: g10/mainproc.c - Remove AEAD stuff.
2018-04-04tests: Fix no gpg-agent upon removal of GNUPGHOME.NIIBE Yutaka7-13/+28
* tests/gpgscm/gnupg.scm (with-ephemeral-home-directory): Add teadown-fn. * tests/gpgsm/export.scm: Use -no-atexit version and stop-agent. * tests/openpgp/decrypt-session-key.scm: Likewise. * tests/openpgp/decrypt-unwrap-verify.scm: Likewise. * tests/openpgp/defs.scm (have-opt-always-trust): Likewise. (setup-environment-no-atexit): New. (start-agent): Support no use of atexit. * tests/gpgsm/gpgsm-defs.scm (setup-gpgsm-environment-no-atexit): New. * tests/migrations/common.scm (untar-armored): Follow the change of with-ephemeral-home-directory. -- When gpg-agent detects homedir removal, it will automatically exit. Then, call of 'gpgconf --kill all' will fail. So, stop-agent should be called before the removal of homedir. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-01-29tests: Fix for NetBSD with __func__.NIIBE Yutaka1-1/+1
* tests/asschk.c: Don't define __func__ if available. -- NetBSD 7.0 has __func__ defined. Signed-off-by: NIIBE Yutaka <[email protected]>
2017-10-26agent, tests: Support --disable-scdaemon build case.NIIBE Yutaka2-2/+6
* agent/command.c (cmd_scd): Support !BUILD_WITH_SCDAEMON. * tests/openpgp/defs.scm (create-gpghome): Likewise. * tests/gpgsm/gpgsm-defs.scm (create-gpgsmhome): Likewise. -- We could modify gpg-agent to remove all support of scdaemon, with no inclusion of call-scd.c, divert-scd.c, and learncard.c, but it would not be worth to do that. GnuPG-bug-id: 3316 Signed-off-by: NIIBE Yutaka <[email protected]>
2017-09-11tests: Fix a test which specifies expiration date.NIIBE Yutaka1-4/+4
* tests/openpgp/quick-key-manipulation.scm: Fix expiration time comparison. -- This is a bug fix for Amelia Earhart who is probably in UTC-12. When expiration date is specified, GnuPG interprets it as noon of the date in local time. Before this fix, the test compared the value by 2145916800 which is 2038-01-01 00:00:00 in UTC with allowance of 1 day. When the test was ran in UTC-12 timezone, it failed because of noon in the timezone is midnight of the next day in UTC. GnuPG-bug-id: 3393 Reported-by: Daniel Kahn Gillmor Signed-off-by: NIIBE Yutaka <[email protected]>
2017-08-23tests: Do not run trust-pgp-4.scmWerner Koch1-2/+5
* tests/openpgp/Makefile.am (XTESTS): Remove test. (EXTRA_DIST): Add test file. -- There are two problems with this test: First a syntax error in the file name so that the test was not used at all. Second the test currently returns FAIL. Fixes-commit: c23a69970ba38edae9d3b2603825d18fbb732423 Signed-off-by: Werner Koch <[email protected]>
2017-08-21tests: Add tests for the PGP trust model.Damien Goutte-Gattat17-2/+630
* tests/openpgp/trust-pgp-1.scm: New file. * tests/openpgp/trust-pgp-2.scm: New file. * tests/openpgp/trust-pgp-3.scm: New file. * tests/openpgp/trust-pgp-4.scm: New file. * tests/openpgp/trust-pgp/common.scm: New file. * tests/openpgp/trust-pgp/scenario1.asc: New file. * tests/openpgp/trust-pgp/scenario2.asc: New file. * tests/openpgp/trust-pgp/scenario3.asc: New file. * tests/openpgp/trust-pgp/scenario4.asc: New file. * tests/openpgp/trust-pgp/alice.sec.asc: New file. * tests/openpgp/trust-pgp/bobby.sec.asc: New file. * tests/openpgp/trust-pgp/carol.sec.asc: New file. * tests/openpgp/trust-pgp/david.sec.asc: New file. * tests/openpgp/trust-pgp/frank.sec.asc: New file. * tests/openpgp/trust-pgp/grace.sec.asc: New file. * tests/openpgp/trust-pgp/heidi.sec.asc: New file. * tests/openpgp/Makefile.am (XTESTS): Add new tests. (TEST_FILES): Add new files. (EXTRA_DIST): Add new common file. Signed-off-by: Damien Goutte-Gattat <[email protected]>
2017-08-21tests: Move some functions into a common module.Damien Goutte-Gattat2-24/+24
* tests/openpgp/tofu.scm (gettrust): Moved to the common defs.scm module. (checktrust): Likewise. * tests/openpgp/defs.scm (gettrust): New function. (checktrust): Likewise. -- These functions will be re-used by the tests for the PGP trust model. Signed-off-by: Damien Goutte-Gattat <[email protected]>
2017-08-21gpgscm: Fix -Wimplicit-fallthrough warnings.Justus Winter1-2/+12
* tests/gpgscm/scheme.c (CASE): Rearrange so that the case statement is at the front. (Eval_Cycle): Improve fallthrough annotations. Signed-off-by: Justus Winter <[email protected]>
2017-08-10tests: Improve documentation.Justus Winter1-3/+40
* tests/openpgp/README: Add quickstart instructions, how to use shell.scm, remove no longer used MKDATA. Signed-off-by: Justus Winter <[email protected]>
2017-08-08build: New configure option --enable-all-tests.Werner Koch2-1/+9
* configure.ac: New option --enable-all-tests. * tests/gpgscm/ffi.c (ffi_init): New gloabl var *run-all-tests*. * tests/openpgp/all-tests.scm (all-tests): Use that var instead of *maintainer-mode*. * Makefile.am (AM_DISTCHECK_CONFIGURE_FLAGS): Add --enable-all-tests. -- It is better to have a separate option to run all tests than to put this on top of --enable-maintainer-mode. This way we can also make sure to run all tests during "make distcheck". Signed-off-by: Werner Koch <[email protected]>
2017-08-08gpgscm: Make the test summary stand outWerner Koch1-0/+2
* tests/gpgscm/tests.scm (test-pool): Add delimiter lines. -- This is to make those summaries a bit more simlar to those from automake. Signed-off-by: Werner Koch <[email protected]>
2017-08-07tests: Do not run all tests unless in maintainer mode.Justus Winter2-15/+33
* configure.ac: Leak the maintainer mode flag into 'config.h'. * tests/gpgscm/ffi.c: Pass it into the scheme environment. * tests/openpgp/all-tests.scm: Only run tests against non-default configurations (keyring, extended-key-format) in maintainer mode. -- Werner is concerned that the tests do take up too much time and asked me to reduce the runtime of the tests for normal users. Signed-off-by: Justus Winter <[email protected]>
2017-08-04tests: Adjust tests for changed --auto-key-locate default.Werner Koch1-0/+2
* tests/openpgp/defs.scm (create-gpghome): Disable new defaults. Signed-off-by: Werner Koch <[email protected]>
2017-07-18gpgscm,w32: Fix testing for absolute paths.Justus Winter1-2/+15
* tests/gpgscm/main.c (path_absolute_p): New function. (load): Use new function. Signed-off-by: Justus Winter <[email protected]>
2017-07-14tests: Improve 'shell.scm' script.Justus Winter2-4/+25
* tests/openpgp/defs.scm (create-file): Unlink file first. * tests/openpgp/shell.scm: Ask whether to import legacy test keys or not, and whether to drop 'batch' from the configuration. Add paths to all the programs to 'PATH'. Signed-off-by: Justus Winter <[email protected]>
2017-07-14gpgscm: Library improvements.Justus Winter2-1/+23
* tests/gpgscm/repl.scm (prompt-yes-no?): New function. * tests/gpgscm/tests.scm (pathsep-split): Likewise. (pathsep-join): Likewise. (with-path): Use the new function. Signed-off-by: Justus Winter <[email protected]>
2017-07-14gpgscm: Fail early if the test setup fails.Justus Winter1-0/+2
* tests/gpgscm/tests.scm (make-environment-cache): Check status code of setup script. Signed-off-by: Justus Winter <[email protected]>
2017-07-13gpgscm: Make loading of modules less verbose.Justus Winter1-1/+1
* tests/gpgscm/main.c (load): Increase logging threshold. Signed-off-by: Justus Winter <[email protected]>
2017-07-13gpgscm: Make it impossible to catch '*interpreter-exit*'.Justus Winter1-2/+2
* tests/gpgscm/init.scm (throw'): Make it impossible to catch '*interpreter-exit*'. This fixes 'exit' (and with it 'fail') inside 'catch' statements. Signed-off-by: Justus Winter <[email protected]>
2017-06-26tests: Improve test.Justus Winter1-2/+2
* tests/openpgp/ssh-export.scm: Split output at any whitespace. Signed-off-by: Justus Winter <[email protected]>
2017-06-21tests: Add test for gpgv.Justus Winter4-268/+359
* tests/openpgp/Makefile.am (XTESTS): Add the new test. * tests/openpgp/gpgv.scm: New file. * tests/openpgp/signed-messages.scm: Likewise. * tests/openpgp/verify.scm: Move the signed messages to the new file and load it. Signed-off-by: Justus Winter <[email protected]>
2017-06-19gpgscm: Limit the number of parallel jobs.Justus Winter2-15/+93
* ffi.c (do_wait_processes): Suppress the timeout error. * tests.scm (semaphore): New definition. (test-pool): Only run a bounded number of tests in parallel. (test::started?): New function. (run-tests-parallel): Do not report results, do not start the tests. (run-tests-sequential): Adapt. (run-tests): Parse the number of parallel jobs. -- This change limits the number of tests that are run in parallel. This way we do not overwhelm the operating systems' scheduler. As a side-effect, we also get more accurate runtime information, and it will be easy to implement timeouts on top of this. Use TESTFLAGS to limit the number of jobs: $ make check-all TESTFLAGS=--parallel=16 Signed-off-by: Justus Winter <[email protected]>
2017-06-19gpgscm: Improve option parsing.Justus Winter1-1/+7
* tests/gpgscm/tests.scm (flag): Accept arguments of the form '--foo=bar'. Signed-off-by: Justus Winter <[email protected]>
2017-06-19gpgscm: Improve error handling of foreign functions.Justus Winter1-2/+1
* tests/gpgscm/ffi.scm (ffi-fail): Do not needlessly join the error message. Signed-off-by: Justus Winter <[email protected]>
2017-06-19gpgscm: Improve error reporting.Justus Winter2-25/+27
* tests/gpgscm/init.scm (throw'): Guard against 'args' being atomic. * tests/gpgscm/scheme.c (Eval_Cycle): Remove any superfluous colons in error messages. Signed-off-by: Justus Winter <[email protected]>
2017-06-19tests: Run the OpenPGP tests using the new extended key format.Justus Winter2-6/+18
* tests/openpgp/all-tests.scm: Generalize a bit, and also add a variant that uses the new extended key format. * tests/openpgp/defs.scm (create-gpghome): Conditionally enable the new extended key format. Signed-off-by: Justus Winter <[email protected]>
2017-05-18docs: Point to https://dev.gnupg.org/ .Daniel Kahn Gillmor1-1/+1
Replace mentions of bugs.gnupg.org with https://dev.gnupg.org/. Since the project has transitioned to a better workflow for supporting contributions, we should ensure that our documentation points to the right place. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2017-05-17gpgscm: Fix checking for opcode arguments.Justus Winter1-1/+2
* tests/gpgscm/scheme.c (Eval_Cycle): Update 'pcd' after dispatching an instruction. Fixes-commit: 9c6407d17e0cb9f4a370b1b83e7816577ec7d29d Signed-off-by: Justus Winter <[email protected]>
2017-05-17tests: Fix agent teardown in release builds.Justus Winter1-3/+3
* tests/openpgp/defs.scm (start-agent,stop-agent): Use gpg-conf which will properly use the '--build-prefix' argument to make gpgconf use tools from the build directory. GnuPG-bug-id: 3165 Fixes-commit: 2c9d9ac55ea455a5ec26428989dced0311ed46cc Signed-off-by: Justus Winter <[email protected]>
2017-05-16tests: Configure the environments to use scdaemon from build tree.Justus Winter3-2/+7
* tests/gpgme/gpgme-defs.scm: Use the scdaemon from the build tree when writing a 'gpg-agent.conf'. * tests/gpgsm/gpgsm-defs.scm: Likewise. * tests/openpgp/defs.scm: Likewise. -- As of 97a2394ecafaa6f58e4a1f70ecfd04408dc15606 gpg may query the scdaemon for a signing key to use. To make sure that the agent calls the right scdaemon, we provide the path explicitly in the 'gpg-agent.conf' that is used in the tests, similar to what we do for the agent itself and the pinentry. GnuPG-bug-id: 3165 Signed-off-by: Justus Winter <[email protected]>
2017-05-11tests: Also run all OpenPGP tests using keyrings.Justus Winter3-11/+31
* tests/openpgp/all-tests.scm: Run each test twice, once with public keys stored in a keybox, once with a keyring. * tests/openpgp/defs.scm (create-gpghome): Create a public keyring to make GnuPG use that instead of creating a keybox if '--use-keyring' is given. * tests/openpgp/setup.scm: Fix flag handling and usage. -- This parametrizes the OpenPGP tests. With this change, the test suite is able to detect problems with the keyring store, e.g. like the one fixed in 22739433e98be80e46fe7d01d52a9627c1aebaae. GnuPG-bug-id: 3080 Signed-off-by: Justus Winter <[email protected]>
2017-05-11tests: Make it possible to run all tests using our infrastructure.Justus Winter18-120/+332
* Makefile.am (TESTS_ENVIRONMENT): New variable. (check-all): New phony target to run all tests. * tests/gpgme/gpgme-defs.scm (have-gpgme?): New function that tests whether the GPGME test suite is available instead of exiting the process. * tests/gpgscm/init.scm (export): New macro. * tests/gpgscm/tests.scm (run-tests): New function. (load-tests): Likewise. * tests/gpgme/run-tests.scm: Simplify and move the parsing of the list of tests to 'all-tests.scm'. * tests/gpgsm/run-tests.scm: Likewise. * tests/migrations/run-tests.scm: Likewise. * tests/openpgp/run-tests.scm: Likewise. * tests/gpgme/Makefile.am: To select the tests to run, use the variable 'TESTS'. This harmonizes the interface with the automake test suite. * tests/gpgsm/Makefile.am: Likewise. * tests/migrations/Makefile.am: Likewise. * tests/openpgp/Makefile.am: Likewise. * tests/openpgp/README: Likewise. * agent/all-tests.scm: New file. * common/all-tests.scm: Likewise. * g10/all-tests.scm: Likewise. * g13/all-tests.scm: Likewise. * tests/gpgme/all-tests.scm: Likewise. * tests/gpgsm/all-tests.scm: Likewise. * tests/migrations/all-tests.scm: Likewise. * tests/openpgp/all-tests.scm: Likewise. * tests/run-tests.scm: Likewise. -- This change allows us to run all tests in parallel and write one XML report capturing the results of every test. It also lays the foundation to parametrize test suites. Signed-off-by: Justus Winter <[email protected]>
2017-05-11tests: Move the makefile parser.Justus Winter3-58/+77
* tests/gpgme/gpgme-defs.scm (parse-makefile, parse-makefile-expand): Move... * tests/gpgscm/makefile.scm: ... here. * tests/gpgscm/Makefile.am (EXTRA_DIST): Add new file. Signed-off-by: Justus Winter <[email protected]>
2017-05-11gpgscm: Make it possible to set the logfile name.Justus Winter1-2/+3
* tests/gpgscm/tests.scm (test): Only set the default log filename when it has not been set before. Signed-off-by: Justus Winter <[email protected]>
2017-05-08tests: Clarify comments.Justus Winter1-2/+8
-- Signed-off-by: Justus Winter <[email protected]>
2017-05-04tests: Support tests that are expected to fail.Justus Winter1-27/+40
* tests/gpgscm/tests.scm (test-pool): Rework reporting. Filter using the computed test status instead of the return value. Also print the new categories 'failed expectedly' and 'passed unexpectedly'. (test): If a test ends with a bang (!), it is expected to fail. Adapt status, status-string, and xml accordingly. -- Allow tests to be marked as being expected to fail by appending a bang (!) to the tests name. If such a test fails, it will not be counted as failure, but will still be prominently displayed in the report. If it succeeds unexpectedly, this is counted as a failure. Fixes T3134. GnuPG-bug-id: 3134 Signed-off-by: Justus Winter <[email protected]>
2017-05-04tests: Add function to dump packets.Justus Winter1-0/+6
* tests/openpgp/defs.scm (gpg-dump-packets): New function. Signed-off-by: Justus Winter <[email protected]>
2017-05-03gpgscm: Create and re-use frame objects.Justus Winter2-28/+114
* tests/gpgscm/scheme-private.h (struct scheme): New field 'frame_freelist'. * tests/gpgscm/scheme.c (enum scheme_types): New type 'T_FRAME'. (type_to_string): Handle new type. (settype): New macro. (gc_disable): Make sure there is at least one frame in the free list. (mark): Handle frame objects. (finalize_cell): Likewise. (dump_stack_initialize): Initialize free list. (dump_stack_free): Simplify. (frame_length): New variable. (dump_stack_make_frame): New function. (frame_slots): Likewise. (frame_payload): New macro. (dump_stack_allocate_frame): New function. (dump_stack_deallocate_frame): Likewise. (dump_stack_preallocate_frame): Likewise. (_s_return): Unpack frame object and deallocate it. (s_save): Wrap state in an frame object. (dump_stack_mark): Mark the free list. -- TinySCHEME being a SECD-machine needs to push frames onto the dump stack. Previously, the dump stack was a list. This required four cells for the spine, as well as up to one additional cell to encode the current opcode. This was quite inefficient despite the fact that we recovered the spine as well as the integer cell. We introduce frame objects, which are a special variant of vectors of length four. Since the length is fixed, this frees up the length field of the vector object to store the unboxed opcode. A frame object now fits in two cells. Saving two or three cells is a mere byproduct, the performance gain comes from increased locality, unboxed opcode representation, and the ability to easily put the objects in a free list, keeping the garbage collector out of the continuous motion of the virtual machine. Signed-off-by: Justus Winter <[email protected]>
2017-05-03gpgscm: Merge opexe_0.Justus Winter2-49/+38
* tests/gpgscm/scheme-private.h (struct scheme): Remove field 'op'. * tests/gpgscm/scheme.c (opexe_0): Inline into 'Eval_Cycle'. (_Error_1): Return the opcode to evaluate next. (Error_1): Do not return, but set the opcode and goto dispatch. (Error_0): Likewise. (s_goto): Likewise. (s_return): Likewise. (s_return_enable_gc): Likewise. (s_thread_to): Remove superfluous cast. (_s_return): Return the opcode to evaluate next. (scheme_init_custom_alloc): Adapt to removal of field 'op'. Signed-off-by: Justus Winter <[email protected]>
2017-04-28Spelling fixes in docs and comments.NIIBE Yutaka5-9/+9
-- In addition, fix trailing spaces in tests/inittests. GnuPG-bug-id: 3121 Reported-by: ka7 (klemens) Signed-off-by: NIIBE Yutaka <[email protected]>
2017-04-25tests: Remove *.conf.tmpl from Makefile.NIIBE Yutaka1-1/+0
* tests/openpgp/Makefile.am (TEST_FILES): Remove gpg.conf.tmpl and gpg-agent.conf.tmpl. -- Fixes-commit: 06a177ceea529269a7404740c60416bd6a4567b1 Signed-off-by: NIIBE Yutaka <[email protected]>
2017-04-24tests: Fix Python detection.Justus Winter1-9/+11
* tests/gpgme/gpgme-defs.scm (python): Fix Python detection. -- In 25e6444b3f4601c7821beab06bc4520deacb007b we changed the way GPGME creates the build directory for the Python bindings. We now use the basename of the interpreter as an identifier, that means we have to get the base name right, a link to the same binary is not sufficient. Signed-off-by: Justus Winter <[email protected]>
2017-04-24gpgscm: Refactor cell finalization.Justus Winter1-24/+41
* tests/gpgscm/scheme.c (finalize_cell): Use switch, return whether the cell may be freed. (gc): Update callsite. Signed-off-by: Justus Winter <[email protected]>