summaryrefslogtreecommitdiffstats
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tests: Do not run trust-pgp-4.scmWerner Koch2017-08-231-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 <wk@gnupg.org>
* tests: Add tests for the PGP trust model.Damien Goutte-Gattat2017-08-2117-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 <dgouttegattat@incenp.org>
* tests: Move some functions into a common module.Damien Goutte-Gattat2017-08-212-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 <dgouttegattat@incenp.org>
* gpgscm: Fix -Wimplicit-fallthrough warnings.Justus Winter2017-08-211-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 <justus@g10code.com>
* tests: Improve documentation.Justus Winter2017-08-101-3/+40
| | | | | | | * tests/openpgp/README: Add quickstart instructions, how to use shell.scm, remove no longer used MKDATA. Signed-off-by: Justus Winter <justus@g10code.com>
* build: New configure option --enable-all-tests.Werner Koch2017-08-082-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 <wk@gnupg.org>
* gpgscm: Make the test summary stand outWerner Koch2017-08-081-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 <wk@gnupg.org>
* tests: Do not run all tests unless in maintainer mode.Justus Winter2017-08-072-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 <justus@g10code.com>
* tests: Adjust tests for changed --auto-key-locate default.Werner Koch2017-08-041-0/+2
| | | | | | * tests/openpgp/defs.scm (create-gpghome): Disable new defaults. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpgscm,w32: Fix testing for absolute paths.Justus Winter2017-07-181-2/+15
| | | | | | | * tests/gpgscm/main.c (path_absolute_p): New function. (load): Use new function. Signed-off-by: Justus Winter <justus@g10code.com>
* tests: Improve 'shell.scm' script.Justus Winter2017-07-142-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 <justus@g10code.com>
* gpgscm: Library improvements.Justus Winter2017-07-142-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 <justus@g10code.com>
* gpgscm: Fail early if the test setup fails.Justus Winter2017-07-141-0/+2
| | | | | | | * tests/gpgscm/tests.scm (make-environment-cache): Check status code of setup script. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Make loading of modules less verbose.Justus Winter2017-07-131-1/+1
| | | | | | * tests/gpgscm/main.c (load): Increase logging threshold. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Make it impossible to catch '*interpreter-exit*'.Justus Winter2017-07-131-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 <justus@g10code.com>
* tests: Improve test.Justus Winter2017-06-261-2/+2
| | | | | | * tests/openpgp/ssh-export.scm: Split output at any whitespace. Signed-off-by: Justus Winter <justus@g10code.com>
* tests: Add test for gpgv.Justus Winter2017-06-214-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 <justus@g10code.com>
* gpgscm: Limit the number of parallel jobs.Justus Winter2017-06-192-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 <justus@g10code.com>
* gpgscm: Improve option parsing.Justus Winter2017-06-191-1/+7
| | | | | | | * tests/gpgscm/tests.scm (flag): Accept arguments of the form '--foo=bar'. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Improve error handling of foreign functions.Justus Winter2017-06-191-2/+1
| | | | | | | * tests/gpgscm/ffi.scm (ffi-fail): Do not needlessly join the error message. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Improve error reporting.Justus Winter2017-06-192-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 <justus@g10code.com>
* tests: Run the OpenPGP tests using the new extended key format.Justus Winter2017-06-192-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 <justus@g10code.com>
* docs: Point to https://dev.gnupg.org/ .Daniel Kahn Gillmor2017-05-181-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 <dkg@fifthhorseman.net>
* gpgscm: Fix checking for opcode arguments.Justus Winter2017-05-171-1/+2
| | | | | | | | * tests/gpgscm/scheme.c (Eval_Cycle): Update 'pcd' after dispatching an instruction. Fixes-commit: 9c6407d17e0cb9f4a370b1b83e7816577ec7d29d Signed-off-by: Justus Winter <justus@g10code.com>
* tests: Fix agent teardown in release builds.Justus Winter2017-05-171-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 <justus@g10code.com>
* tests: Configure the environments to use scdaemon from build tree.Justus Winter2017-05-163-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 <justus@g10code.com>
* tests: Also run all OpenPGP tests using keyrings.Justus Winter2017-05-113-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 <justus@g10code.com>
* tests: Make it possible to run all tests using our infrastructure.Justus Winter2017-05-1118-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 <justus@g10code.com>
* tests: Move the makefile parser.Justus Winter2017-05-113-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 <justus@g10code.com>
* gpgscm: Make it possible to set the logfile name.Justus Winter2017-05-111-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 <justus@g10code.com>
* tests: Clarify comments.Justus Winter2017-05-081-2/+8
| | | | | -- Signed-off-by: Justus Winter <justus@g10code.com>
* tests: Support tests that are expected to fail.Justus Winter2017-05-041-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 <justus@g10code.com>
* tests: Add function to dump packets.Justus Winter2017-05-041-0/+6
| | | | | | * tests/openpgp/defs.scm (gpg-dump-packets): New function. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Create and re-use frame objects.Justus Winter2017-05-032-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 <justus@g10code.com>
* gpgscm: Merge opexe_0.Justus Winter2017-05-032-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 <justus@g10code.com>
* Spelling fixes in docs and comments.NIIBE Yutaka2017-04-285-9/+9
| | | | | | | | | | -- In addition, fix trailing spaces in tests/inittests. GnuPG-bug-id: 3121 Reported-by: ka7 (klemens) Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* tests: Remove *.conf.tmpl from Makefile.NIIBE Yutaka2017-04-251-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 <gniibe@fsij.org>
* tests: Fix Python detection.Justus Winter2017-04-241-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 <justus@g10code.com>
* gpgscm: Refactor cell finalization.Justus Winter2017-04-241-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 <justus@g10code.com>
* gpgscm: Tweak error message display.Justus Winter2017-04-241-2/+7
| | | | | | | * tests/gpgscm/init.scm (throw'): If the first argument to the error is a string, display it as such. Signed-off-by: Justus Winter <justus@g10code.com>
* tests: Deduplicate and simplify code.Justus Winter2017-04-245-33/+24
| | | | | | | | | | | * tests/gpgme/gpgme-defs.scm (create-file): Move... * tests/gpgsm/gpgsm-defs.scm (create-file): ... likewise... * tests/openpgp/defs.scm (create-file): Here. (create-gpghome): Use 'create-file'. * tests/openpgp/gpg-agent.conf.tmpl: Delete file. * tests/openpgp/gpg.conf.tmpl: Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Fix test.Justus Winter2017-04-241-2/+2
| | | | | | * tests/gpgscm/t-child.scm: Use 'string-length' on the string. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Improve syntax checking.Justus Winter2017-04-241-2/+5
| | | | | | | * tests/gpgscm/scheme.c (opexe_0): Make sure closure arguments are symbols. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Emit JUnit-style XML reports.Justus Winter2017-04-249-14/+256
| | | | | | | | | | | | | | | | | | * tests/gpgscm/Makefile.am (EXTRA_DIST): Add new file. * tests/gpgscm/lib.scm (string-translate): New function. * tests/gpgscm/main.c (main): Load new file. * tests/gpgscm/tests.scm (dirname): New function. (test-pool): Record execution times, emit XML report. (test): Record execution times, record log file name, emit XML report. (run-tests-parallel): Write XML report. (run-tests-sequential): Likewise. * tests/gpgscm/xml.scm: New file. * tests/gpgme/Makefile.am (CLEANFILES): Add 'report.xml'. * tests/gpgsm/Makefile.am: Likewise. * tests/migrations/Makefile.am: Likewise. * tests/openpgp/Makefile.am: Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Make logging less verbose and more useful.Justus Winter2017-04-241-4/+5
| | | | | | | * tests/gpgscm/tests.scm (call-with-io): When being verbose, include the pid in the output, and avoid duplicating the command arguments. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Make test framework less functional.Justus Winter2017-04-241-40/+35
| | | | | | | | | * tests/gpgscm/tests.scm (test-pool, tests): Previously, these methods updated objects by creating new updated copies of the object being manipulated. This made the code awkward without any benefit, therefore I change it to just update the object. Signed-off-by: Justus Winter <justus@g10code.com>
* tests: Locate resources and scripts relative to top source dir.Justus Winter2017-04-2484-171/+197
| | | | | | | | | | | | -- Locate every resource and every script used in the tests using a path relative to the top of the source tree. This is a purely mechanical change, mostly done using regular expressions, with a few manual fixups here and there. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Move 'trace' and 'stringify'.Justus Winter2017-04-242-12/+12
| | | | | | | * tests/gpgscm/tests.scm (trace, stringify): Move... * tests/gpgscm/lib.scm: ... here. Signed-off-by: Justus Winter <justus@g10code.com>
* gpgscm: Avoid fruitless garbage collection cycles.Justus Winter2017-04-242-8/+15
| | | | | | | | | * tests/gpgscm/scheme-private.h (CELL_MINRECOVER): New macro. * tests/gpgscm/scheme.c (_get_cell): Move the heuristic to get more cells... (gc): ... here where every caller benefits from the optimization. Signed-off-by: Justus Winter <justus@g10code.com>
* tests: Minor memory fix.NIIBE Yutaka2017-04-171-0/+2
| | | | | | * tests/openpgp/fake-pinentry.c (get_passphrase): Free the memory. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>