aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gpgscm (follow)
Commit message (Collapse)AuthorAgeFilesLines
* gpgscm: Build well even if NDEBUG defined.NIIBE Yutaka2019-02-251-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]>
* Silence compiler warnings new with gcc 8.Werner Koch2018-12-181-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]>
* tests: Fix no gpg-agent upon removal of GNUPGHOME.NIIBE Yutaka2018-04-041-4/+9
| | | | | | | | | | | | | | | | | | | | | | * 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]>
* 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 <[email protected]>
* build: New configure option --enable-all-tests.Werner Koch2017-08-081-0/+8
| | | | | | | | | | | | | | | * 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]>
* 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 <[email protected]>
* tests: Do not run all tests unless in maintainer mode.Justus Winter2017-08-071-0/+8
| | | | | | | | | | | | | * 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]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* tests: Make it possible to run all tests using our infrastructure.Justus Winter2017-05-112-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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]>
* tests: Move the makefile parser.Justus Winter2017-05-112-0/+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]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* Spelling fixes in docs and comments.NIIBE Yutaka2017-04-281-2/+2
| | | | | | | | | | -- In addition, fix trailing spaces in tests/inittests. GnuPG-bug-id: 3121 Reported-by: ka7 (klemens) Signed-off-by: NIIBE Yutaka <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* gpgscm: Emit JUnit-style XML reports.Justus Winter2017-04-245-10/+252
| | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* tests: Locate resources and scripts relative to top source dir.Justus Winter2017-04-241-1/+1
| | | | | | | | | | | | -- 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* gpgscm: Fix test program.NIIBE Yutaka2017-04-121-2/+2
| | | | | | * tests/gpgscm/t-child.c (main): Fix for setmode. Signed-off-by: NIIBE Yutaka <[email protected]>
* tests: Fix distcheck.Justus Winter2017-04-111-0/+1
| | | | | | | * tests/gpgscm/Makefile.am (EXTRA_DIST): Add 'gnupg.scm'. Fixes-commit: ccd2187212c12b84c86a10fd4417a16536243179 Signed-off-by: Justus Winter <[email protected]>
* tests: Move common functionality.Justus Winter2017-04-112-0/+46
| | | | | | | | | * tests/openpgp/defs.scm (with-home-directory, with-ephemeral-home-directory): Move... * tests/gpgscm/gnupg.scm: ... to this new file. * tests/gpgscm/main.c (main): Load the new file. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Fix opcode dispatch.Justus Winter2017-04-101-2/+2
| | | | | | | * tests/gpgscm/scheme.c (opexe_0): Consider 'op', not 'sc->op'. The former is the opcode we are currently executing. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Mmap script files.Justus Winter2017-04-103-5/+50
| | | | | | | | | * tests/gpgscm/main.c (load): Try to mmap the script. * tests/gpgscm/scheme.c (scheme_load_memory): New function, a generalization of 'scheme_load_string'. * tests/gpgscm/scheme.h (scheme_load_memory): New prototype. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Refactor checking for opcode arguments.Justus Winter2017-04-101-60/+70
| | | | | | | | | * tests/gpgscm/scheme.c (op_code_info): Fix type, add forward declaration. (check_arguments): New function. (Eval_cycle): Use the new function. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Improve syntax dispatch.Justus Winter2017-04-101-58/+36
| | | | | | | | | | * tests/gpgscm/scheme.c (assign_syntax): Add opcode parameter, store opcode in the tag. (syntaxnum): Add sc parameter, retrieve opcode from tag. (opexe_0): Adapt callsite. (scheme_init_custom_alloc): Likewise. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Make tags mandatory.Justus Winter2017-04-103-22/+2
| | | | | | | | | | | | | * tests/gpgscm/opdefines.h: Make tags mandatory. * tests/gpgscm/scheme.c: Likewise. * tests/gpgscm/scheme.h: Likewise. -- Tags provide a constant-time lookup mechanism for almost every object. This is useful for the interpreter itself, and the code for tags is tiny. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Add and use opcode for reversing a list in place.Justus Winter2017-04-103-4/+8
| | | | | | | | | * tests/gpgscm/lib.scm (string-split-pln): Use 'reverse!'. (string-rtrim): Likewise. * tests/gpgscm/opdefines.h (reverse!): New opcode. * tests/gpgscm/scheme.c (opexe_0): Handle new opcode. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Deduplicate code.Justus Winter2017-04-101-50/+28
| | | | | | | | * tests/gpgscm/scheme.c (oblist_add_by_name): Deduplicate. (new_slot_spec_in_env): Likewise. Fixes-commit: 6a3f857224eab108ae38e6259194b01b0ffdad8b Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Move dispatch table into rodata.Justus Winter2017-04-102-13/+14
| | | | | | | | | | | | | | * tests/gpgscm/opdefines.h: Use 0 instead of NULL. * tests/gpgscm/scheme.c (op_code_info): Use char arrays instead of pointers, make arity parameters smaller. (INF_ARG): Adapt. (_OP_DEF): Likewise. (dispatch_table): Likewise. (procname): Likewise. (Eval_cycle): Likewise. (scheme_init_custom_alloc): Likewise. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Use more threaded code.Justus Winter2017-04-101-38/+37
| | | | | | | * tests/gpgscm/scheme.c (opexe_0): Use 's_thread_to' instead of 's_goto' wherever possible. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Remove now obsolete dispatcher function from the opcodes.Justus Winter2017-04-103-194/+191
| | | | | | | | | | | | * tests/gpgscm/opdefines.h: Remove now obsolete dispatcher function from the opcodes. * tests/gpgscm/scheme-private.h (_OP_DEF): Adapt. * tests/gpgscm/scheme.c (dispatch_func): Remove type declaration. (op_code_info): Remove 'func'. (_OP_DEF): Adapt. (Eval_Cycle): Always call 'opexe_0'. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Merge 'opexe_6'.Justus Winter2017-04-102-25/+11
| | | | | | | | | | | | * tests/gpgscm/scheme.c (opexe_6): Merge into 'opexe_0'. * tests/gpgscm/opdefines.h: Adapt. -- Having separate functions to execute opcodes reduces our ability to thread the code and prevents the dispatch_table from being moved to rodata. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Merge 'opexe_5'.Justus Winter2017-04-102-36/+18
| | | | | | | | | | | | * tests/gpgscm/scheme.c (opexe_5): Merge into 'opexe_0'. * tests/gpgscm/opdefines.h: Adapt. -- Having separate functions to execute opcodes reduces our ability to thread the code and prevents the dispatch_table from being moved to rodata. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Merge 'opexe_4'.Justus Winter2017-04-102-46/+37
| | | | | | | | | | | | * tests/gpgscm/scheme.c (opexe_4): Merge into 'opexe_0'. * tests/gpgscm/opdefines.h: Adapt. -- Having separate functions to execute opcodes reduces our ability to thread the code and prevents the dispatch_table from being moved to rodata. Signed-off-by: Justus Winter <[email protected]>