aboutsummaryrefslogtreecommitdiffstats
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* 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]>
* 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 <[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-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 <[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-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 <[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]>
* 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 <[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: Avoid relying on implicit gpg commands.Justus Winter2017-04-1125-39/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/openpgp/armdetach.scm: Always use an explicit command instead of relying on gpg to guess what we want. * tests/openpgp/armdetachm.scm: Likewise. * tests/openpgp/armencrypt.scm: Likewise. * tests/openpgp/armencryptp.scm: Likewise. * tests/openpgp/armor.scm: Likewise. * tests/openpgp/armsignencrypt.scm: Likewise. * tests/openpgp/armsigs.scm: Likewise. * tests/openpgp/clearsig.scm: Likewise. * tests/openpgp/compression.scm: Likewise. * tests/openpgp/conventional-mdc.scm: Likewise. * tests/openpgp/conventional.scm: Likewise. * tests/openpgp/decrypt-dsa.scm: Likewise. * tests/openpgp/decrypt.scm: Likewise. * tests/openpgp/detach.scm: Likewise. * tests/openpgp/detachm.scm: Likewise. * tests/openpgp/ecc.scm: Likewise. * tests/openpgp/encrypt-dsa.scm: Likewise. * tests/openpgp/encrypt-multifile.scm: Likewise. * tests/openpgp/encrypt.scm: Likewise. * tests/openpgp/encryptp.scm: Likewise. * tests/openpgp/seat.scm: Likewise. * tests/openpgp/signencrypt-dsa.scm: Likewise. * tests/openpgp/signencrypt.scm: Likewise. * tests/openpgp/sigs-dsa.scm: Likewise. * tests/openpgp/sigs.scm: Likewise. Signed-off-by: Justus Winter <[email protected]>
* tests: Make tests more robust.Justus Winter2017-04-112-5/+7
| | | | | | | | | * tests/openpgp/defs.scm (have-opt-always-trust): Execute in empty ephemeral home directory. This prevents gpg from picking up the configuration from the current gnupghome (if any). * tests/migrations/common.scm (untar-armored): Likewise. Signed-off-by: Justus Winter <[email protected]>
* tests: Move common functionality.Justus Winter2017-04-113-26/+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]>
* gpgscm: Merge 'opexe_3'.Justus Winter2017-04-102-86/+75
| | | | | | | | | | | | * tests/gpgscm/scheme.c (opexe_3): 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_2'.Justus Winter2017-04-102-108/+98
| | | | | | | | | | | | * tests/gpgscm/scheme.c (opexe_2): 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_1'.Justus Winter2017-04-102-31/+20
| | | | | | | | | | | | * tests/gpgscm/scheme.c (opexe_1): 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: Allocate small integers in the rodata section.Justus Winter2017-04-074-37/+861
| | | | | | | | | | | | | | | | | | | | | | | | | * tests/gpgscm/Makefile.am (gpgscm_SOURCES): Add new file. * tests/gpgscm/scheme-private.h (struct cell): Move number to the top of the union so that we can initialize it. (struct scheme): Remove 'integer_segment'. * tests/gpgscm/scheme.c (initialize_small_integers): Remove function. (small_integers): New variable. (MAX_SMALL_INTEGER): Compute. (mk_small_integer): Adapt. (mark): Avoid marking objects already marked. This allows us to run the algorithm over objects in the rodata section if they are already marked. (scheme_init_custom_alloc): Remove initialization. (scheme_deinit): Remove deallocation. * tests/gpgscm/small-integers.h: New file. -- Allocate small integers from a fixed pool in the rodata section. This spares us the initialization, and deduplicates integers across different processes. It also makes the integers immutable, increasing memory safety. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Make global data constant when possible.Justus Winter2017-04-072-19/+15
| | | | | | | | | | | | | | | | | | * tests/gpgscm/scheme-private.h (struct scheme): Make 'vptr' const. * tests/gpgscm/scheme.c (num_zero): Statically initialize and turn into constant. (num_one): Likewise. (charnames): Change type so that it can be stored in rodata. (is_ascii_name): Adapt slightly. (assign_proc): Make argument const char *. (op_code_info): Make some fields const char *. (tests): Make const. (dispatch_table): Make const. At least it can be made read-only after relocation. (Eval_Cycle): Adapt slightly. (vtbl): Make const. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Remove arbitrary limit on number of cell segments.Justus Winter2017-04-072-44/+74
| | | | | | | | | | | | | | | | | | | | | | | * tests/gpgscm/scheme-private.h (struct scheme): Remove fixed-size arrays for cell segments, replace them with a pointer to the new 'struct cell_segment' instead. * tests/gpgscm/scheme.c (struct cell_segment): New definition. (_alloc_cellseg): Allocate the header within the segment, return a pointer to the header. (_dealloc_cellseg): New function. (alloc_cellseg): Insert the segments into a list. (_get_cell): Allocate a new segment if less than a quarter of CELL_SIGSIZE is recovered during garbage collection. (initialize_small_integers): Adapt callsite. (gc): Walk the list of segments. (scheme_init_custom_alloc): Remove initialization of removed field. (scheme_deinit): Adapt deallocation. -- Previously the number of cells that could be allocated was a compile-time limit. Remove this limit. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Fix compact vector encoding.Justus Winter2017-04-071-1/+2
| | | | | | | | | | | | | | | | * tests/gpgscm/scheme-private.h (struct cell): Use uintptr_t for '_flags'. This way, '_flags' has the size of a machine word. -- The compact vector representation introduced in 49e2ae65 requires that we can tell apart pointers and type flags. This did not work on 64-bit big-endian architectures. Fixes a crash on 64-bit big-endian architectures. Hat-tip-to: gniibe Fixes-commit: 49e2ae65e892f93be7f87cfaae3392b50a99e4b1 Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Avoid mutating integer.Justus Winter2017-04-061-1/+1
| | | | | | | | * tests/gpgscm/scheme.c (opexe_5): Do not modify the integer in-place while printing an vector. Integer objects may be shared, so they must not be mutated. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Initialize unused slots in vectors.Justus Winter2017-04-061-0/+8
| | | | | | | | | | | | * tests/gpgscm/scheme.c (get_vector_object): Initialize unused slots at the end of vectors. -- They should not be used for anything, but let's just initialize them to something benign to be sure. GnuPG-bug-id: 3014 Signed-off-by: Justus Winter <[email protected]>
* tests: Fix distcheck.Justus Winter2017-04-062-2/+2
| | | | | | | | | | | | | | | | * tests/Makefile.am (SUBDIRS): Add 'pkits' again. Simply dropping it makes 'make distcheck' unhappy. * tests/pkits/Makefile.am (TESTS): Remove all tests. -- Disable the 'pkits' tests in a way that keeps 'make distcheck' happy. To run tests individually, do make -Ctests/pkits check TESTS=some-test GnuPG-bug-id: 3067 Fixes-commit: af1c1a57e46a00a32d83c1a58c5f3ef6f4a1c1d1 Signed-off-by: Justus Winter <[email protected]>
* tests: Disable 'pkits' test suite.Justus Winter2017-04-063-4/+4
| | | | | | | | | | | | | | * tests/Makefile.am (SUBDIRS): Drop 'pkits'. * tests/pkits/common.sh: Fix locating 'PKITS_data.tar.bz2'. * tests/pkits/inittests: Likewise. -- These tests are unmaintained and broken, and were previously only run when doing in-tree builds, hence nobody noticed that they were badly broken. GnuPG-bug-id: 3067 Signed-off-by: Justus Winter <[email protected]>
* tests: Make test more robust.Justus Winter2017-04-062-3/+6
| | | | | | | | * tests/openpgp/4gb-packet.scm: Skip if we do not have BZIP2. * tests/openpgp/defs.scm (have-compression-algo?): New function. GnuPG-bug-id: 3028 Signed-off-by: Justus Winter <[email protected]>
* tests: Fix setup of ephemeral home directories.Justus Winter2017-04-051-2/+2
| | | | | | | | | | * tests/openpgp/defs.scm (with-ephemeral-home-directory): Set GNUPGHOME and cwd to the ephemeral directory before calling the setup function. GnuPG-bug-id: 3047 Fixes-commit: 32b75fb7743f35936d7014fce33c90ba97dfa374 Signed-off-by: Justus Winter <[email protected]>
* tests: Fix setup of ephemeral home directories.Justus Winter2017-04-046-19/+20
| | | | | | | | | | | | | | | | | | | * tests/openpgp/defs.scm (with-ephemeral-home-directory): Create configuration files when we enter the context. * tests/openpgp/setup.scm: Do not use an ephemeral home directory. Tests should always use the cwd. * tests/gpgsm/setup.scm: Likewise. * tests/gpgsm/export.scm: Add explicit constructor function. * tests/openpgp/decrypt-session-key.scm: Likewise. * tests/openpgp/decrypt-unwrap-verify.scm: Likewise. -- Previously, ephemeral homedirectories lacked a configuration, hence GnuPG tried to start backend daemons using their installed locations. Fix this by explicitly creating a suitable configuration. GnuPG-bug-id: 3047 Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Fix copying values.Justus Winter2017-04-041-2/+52
| | | | | | | | | | | | | | | | | | * tests/gpgscm/scheme.c (copy_value): New function. (mk_tagged_value): Use new function. (opexe_4): Likewise for OP_SAVE_FORCED. -- Occasionally, we need to copy a value from one location in the storage to another. Scheme objects are fine. Some primitive objects, however, require finalization, usually to free resources. For these values, we either make a copy or acquire a reference. Fixes e.g. a double free if a delayed expression evaluating to a string is forced. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Simplify get-output-string operation.Justus Winter2017-04-041-14/+6
| | | | | | * tests/gpgscm/scheme.c (opexe_4): Simplify 'get-output-string'. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Simplify substring operation.Justus Winter2017-04-041-7/+1
| | | | | | * tests/gpgscm/scheme.c (opexe_2): Simplify 'substring'. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Slightly improve the procedure dispatch.Justus Winter2017-04-031-1/+1
| | | | | | | * tests/gpgscm/scheme.c (procnum): Procedures always have an integer number, so we can safely use the cheaper 'ivalue_unchecked'. Signed-off-by: Justus Winter <[email protected]>
* tests,w32: Fix importing the extra key for GPGME's keylist test.Justus Winter2017-03-281-1/+1
| | | | | | | * tests/gpgme/wrap.scm: Qualify the tests name with the extension for executables (if any). Signed-off-by: Justus Winter <[email protected]>
* tests: Fix distcheck.Justus Winter2017-03-281-3/+27
| | | | | | | | * tests/openpgp/Makefile.am (sample_msgs): Add all missing sample messages. Fixes-commit: 211d71f19c24da94f4c58014606125c1a29d86a2 Signed-off-by: Justus Winter <[email protected]>
* tests: Add test for '--decrypt --unwrap'.Justus Winter2017-03-282-0/+42
| | | | | | | * tests/openpgp/Makefile.am (XTESTS): Add new test. * tests/openpgp/decrypt-unwrap-verify.scm: New file. Signed-off-by: Justus Winter <[email protected]>