Commit Graph

488 Commits

Author SHA1 Message Date
Daniel Kahn Gillmor 705da1eb23 docs: Point to https://dev.gnupg.org/ .
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>
2017-05-18 15:05:57 -04:00
Justus Winter aae50e0b6a
gpgscm: Fix checking for opcode arguments.
* tests/gpgscm/scheme.c (Eval_Cycle): Update 'pcd' after dispatching
an instruction.

Fixes-commit: 9c6407d17e
Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-17 16:13:26 +02:00
Justus Winter 0e1729bb99
tests: Fix agent teardown in release builds.
* 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: 2c9d9ac55e
Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-17 12:14:55 +02:00
Justus Winter 386a7bbb24
tests: Configure the environments to use scdaemon from build tree.
* 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 97a2394eca 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>
2017-05-16 16:07:25 +02:00
Justus Winter bc01d62dc5
tests: Also run all OpenPGP tests using keyrings.
* 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 22739433e9.

GnuPG-bug-id: 3080
Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-11 18:12:38 +02:00
Justus Winter f4365790da
tests: Make it possible to run all tests using our infrastructure.
* 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>
2017-05-11 18:12:37 +02:00
Justus Winter 78d6a25a2d
tests: Move the makefile parser.
* 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>
2017-05-11 17:41:03 +02:00
Justus Winter 29ef34cc4c
gpgscm: Make it possible to set the logfile name.
* 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>
2017-05-11 17:41:01 +02:00
Justus Winter 38b48eb11b
tests: Clarify comments.
--
Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-08 12:37:20 +02:00
Justus Winter d6b46462f8
tests: Support tests that are expected to fail.
* 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>
2017-05-04 15:22:52 +02:00
Justus Winter eab0138e31
tests: Add function to dump packets.
* tests/openpgp/defs.scm (gpg-dump-packets): New function.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-04 14:25:38 +02:00
Justus Winter 8a168a6d40
gpgscm: Create and re-use frame objects.
* 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>
2017-05-03 15:36:16 +02:00
Justus Winter 9c6407d17e
gpgscm: Merge opexe_0.
* 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>
2017-05-03 15:31:55 +02:00
NIIBE Yutaka 5c8fe54809 Spelling fixes in docs and comments.
--

In addition, fix trailing spaces in tests/inittests.

GnuPG-bug-id: 3121
Reported-by: ka7 (klemens)
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-04-28 10:06:33 +09:00
NIIBE Yutaka 7851d73fd7 tests: Remove *.conf.tmpl from Makefile.
* tests/openpgp/Makefile.am (TEST_FILES): Remove gpg.conf.tmpl
and gpg-agent.conf.tmpl.

--

Fixes-commit: 06a177ceea
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-04-25 11:39:59 +09:00
Justus Winter ef1922b3b1
tests: Fix Python detection.
* 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>
2017-04-24 17:32:41 +02:00
Justus Winter d2f6798621
gpgscm: Refactor cell finalization.
* 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>
2017-04-24 16:00:53 +02:00
Justus Winter 78547bfe8a
gpgscm: Tweak error message display.
* 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>
2017-04-24 16:00:51 +02:00
Justus Winter 06a177ceea
tests: Deduplicate and simplify code.
* 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>
2017-04-24 15:59:49 +02:00
Justus Winter 9ae63b9cae
gpgscm: Fix test.
* tests/gpgscm/t-child.scm: Use 'string-length' on the string.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-04-24 15:47:29 +02:00
Justus Winter 4aab0e6ac7
gpgscm: Improve syntax checking.
* tests/gpgscm/scheme.c (opexe_0): Make sure closure arguments are
symbols.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-04-24 15:47:27 +02:00
Justus Winter ee715201ae
gpgscm: Emit JUnit-style XML reports.
* 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>
2017-04-24 14:28:57 +02:00
Justus Winter 679920781a
gpgscm: Make logging less verbose and more useful.
* 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>
2017-04-24 14:14:08 +02:00
Justus Winter a71f4142e1
gpgscm: Make test framework less functional.
* 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>
2017-04-24 14:14:06 +02:00
Justus Winter ed4d23d75e
tests: Locate resources and scripts relative to top source dir.
--

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>
2017-04-24 14:14:05 +02:00
Justus Winter f03d6897be
gpgscm: Move 'trace' and 'stringify'.
* tests/gpgscm/tests.scm (trace, stringify): Move...
* tests/gpgscm/lib.scm: ... here.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-04-24 14:14:03 +02:00
Justus Winter 245860ecaf
gpgscm: Avoid fruitless garbage collection cycles.
* 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>
2017-04-24 14:14:01 +02:00
NIIBE Yutaka b9440aa369 tests: Minor memory fix.
* tests/openpgp/fake-pinentry.c (get_passphrase): Free the memory.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-04-17 09:44:37 +09:00
NIIBE Yutaka 7f9032d4a8 gpgscm: Fix test program.
* tests/gpgscm/t-child.c (main): Fix for setmode.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-04-12 12:05:53 +09:00
Justus Winter 00be2a9262
tests: Fix distcheck.
* tests/gpgscm/Makefile.am (EXTRA_DIST): Add 'gnupg.scm'.

Fixes-commit: ccd2187212
Signed-off-by: Justus Winter <justus@g10code.com>
2017-04-11 11:50:54 +02:00
Justus Winter cde626e7f7
tests: Avoid relying on implicit gpg commands.
* 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 <justus@g10code.com>
2017-04-11 11:37:37 +02:00
Justus Winter 1b28d9dbe0
tests: Make tests more robust.
* 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 <justus@g10code.com>
2017-04-11 11:37:02 +02:00
Justus Winter ccd2187212
tests: Move common functionality.
* 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 <justus@g10code.com>
2017-04-11 10:43:52 +02:00
Justus Winter 1b6adab41d
gpgscm: Fix opcode dispatch.
* 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 <justus@g10code.com>
2017-04-10 14:57:36 +02:00
Justus Winter c7f0d90592
gpgscm: Mmap script files.
* 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 <justus@g10code.com>
2017-04-10 14:57:35 +02:00
Justus Winter f3d1f68677
gpgscm: Refactor checking for opcode arguments.
* 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 <justus@g10code.com>
2017-04-10 14:57:33 +02:00
Justus Winter b628e62b5b
gpgscm: Improve syntax dispatch.
* 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 <justus@g10code.com>
2017-04-10 14:57:32 +02:00
Justus Winter a1ad5d6a30
gpgscm: Make tags mandatory.
* 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 <justus@g10code.com>
2017-04-10 14:57:30 +02:00
Justus Winter e1bb9326dc
gpgscm: Add and use opcode for reversing a list in place.
* 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 <justus@g10code.com>
2017-04-10 14:57:28 +02:00
Justus Winter 3e91019a92
gpgscm: Deduplicate code.
* tests/gpgscm/scheme.c (oblist_add_by_name): Deduplicate.
(new_slot_spec_in_env): Likewise.

Fixes-commit: 6a3f857224
Signed-off-by: Justus Winter <justus@g10code.com>
2017-04-10 14:57:27 +02:00
Justus Winter 7dff6248bd
gpgscm: Move dispatch table into rodata.
* 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 <justus@g10code.com>
2017-04-10 14:57:25 +02:00
Justus Winter 6f217d116d
gpgscm: Use more threaded code.
* tests/gpgscm/scheme.c (opexe_0): Use 's_thread_to' instead of
's_goto' wherever possible.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-04-10 14:57:24 +02:00
Justus Winter e7ed9822e2
gpgscm: Remove now obsolete dispatcher function from the opcodes.
* 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 <justus@g10code.com>
2017-04-10 14:57:22 +02:00
Justus Winter ddf444828b
gpgscm: Merge 'opexe_6'.
* 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 <justus@g10code.com>
2017-04-10 14:57:21 +02:00
Justus Winter 1379df4453
gpgscm: Merge 'opexe_5'.
* 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 <justus@g10code.com>
2017-04-10 14:57:19 +02:00
Justus Winter 4f835104b9
gpgscm: Merge 'opexe_4'.
* 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 <justus@g10code.com>
2017-04-10 14:57:18 +02:00
Justus Winter d591ab65d3
gpgscm: Merge 'opexe_3'.
* 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 <justus@g10code.com>
2017-04-10 14:57:16 +02:00
Justus Winter 6cad38228f
gpgscm: Merge 'opexe_2'.
* 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 <justus@g10code.com>
2017-04-10 14:57:15 +02:00
Justus Winter 154af876f0
gpgscm: Merge 'opexe_1'.
* 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 <justus@g10code.com>
2017-04-10 14:57:13 +02:00
Justus Winter 8640fa880d
gpgscm: Allocate small integers in the rodata section.
* 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 <justus@g10code.com>
2017-04-07 13:50:20 +02:00