Commit Graph

282 Commits

Author SHA1 Message Date
NIIBE Yutaka ba247a114c gpg: Add regular expression support.
* AUTHORS, COPYING.other: Update.
* Makefile.am (SUBDIRS): Add regexp sub directory.
* configure.ac (DISABLE_REGEX): Remove.
* g10/Makefile.am (needed_libs): Add libregexp.a.
* g10/trustdb.c: Remove DISABLE_REGEX support.
* regexp/LICENSE, regexp/jimregexp.c, regexp/jimregexp.h,
  regexp/utf8.c, regexp/utf8.h: New from Jim Tcl.
* regexp/UnicodeData.txt: New from Unicode.
* regexp/Makefile.am, regexp/parse-unidata.awk: New.
* tests/openpgp/Makefile.am: Remove DISABLE_REGEX support.
* tools/Makefile.am: Remove DISABLE_REGEX support.

GnuPG-bug-id: 4843
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2020-04-03 15:30:08 +09:00
Werner Koch 451cd1b392
gpgconf: Further simplify the gpgconf option processing.
* common/gc-opt-flags.h (GC_OPT_FLAG_RUNTIME): Move to ...
* tools/gpgconf-comp.c: here.
(known_options_scdaemon): Remove "options".
(known_options_dirmngr): Remove "options".
(known_options_gpgsm): Remove "options".
(known_options_gpg): Remove "options" and "keyserver".
(struct gc_option_s): Rename active t gpgconf_list.
(gc_component_list_options): Do not act upon active.
(option_check_validity): Ditto.
(is_known_option): Make it work correctly for unknown options.
(retrieve_options_from_program): Use renamed flag gpgconf_list only to
detect duplicated items from --gpgconf-list.  Do not set runtime.
Only e set the options if set by --gpgconf-list; never clear them.
* agent/gpg-agent.c: Simplify the --gpgconf-list output.
* dirmngr/dirmngr.c: Ditto.
* g10/gpg.c: Ditto.
* kbx/keyboxd.c: Ditto.
* scd/scdaemon.c: Ditto.
* sm/gpgsm.c: Ditto.
* tests/openpgp/gpgconf.scm: Use "compliance" instead of "keyserver"
for the string arg test.
--

There is no need to read the list of options from the components
unless they convey a default value.  It is better to consult only the
list we have in gpgconf-comp.c to decide on whether an option should
be displayed.   Right, this might mess up thing if a newer gpgconf
version is used with an older component, but we already print warnings
in this case and in general we do not want to support this anymore -
the times of gpg 1.4. and 2.0 are long over now.

GnuPG-bug-id: 4788
Signed-off-by: Werner Koch <wk@gnupg.org>
2020-03-14 19:12:41 +01:00
Daniel Kahn Gillmor 0904b8ef34 Spelling cleanup.
No functional changes, just fixing minor spelling issues.

---

Most of these were identified from the command line by running:

  codespell \
    --ignore-words-list fpr,stati,keyserver,keyservers,asign,cas,iff,ifset \
    --skip '*.po,ChangeLog*,help.*.txt,*.jpg,*.eps,*.pdf,*.png,*.gpg,*.asc' \
    doc g13 g10 kbx agent artwork scd tests tools am common dirmngr sm \
    NEWS README README.maint TODO

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2020-02-18 18:07:46 -05:00
Werner Koch 0b0104ce47
tests: Add a first v5 sample key
--
2019-03-20 09:18:11 +01:00
Werner Koch f799e9728b
gpg: Avoid importing secret keys if the keyblock is not valid.
* 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 <wk@gnupg.org>
2019-03-15 20:41:38 +01:00
Werner Koch 8c20a363c2
tests: Add sample secret key w/o binding signatures.
--

GnuPG-bug-id: 4392
2019-03-15 19:51:03 +01:00
NIIBE Yutaka 64b7c6fd19 tests: Add "disable-scdaemon" in gpg-agent.conf.
* 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 <gniibe@fsij.org>
2019-02-21 12:26:09 +09:00
Werner Koch d3d41146b3
gpg: Ignore the multiple message override options.
* g10/gpg.c (oAllowMultisigVerification)
(oAllowMultipleMessages, oNoAllowMultipleMessages): Remove.
(opts): Turn --allow-multisig-verification, --allow-multiple-messages
and --no-allow-multiple-messages into NOPs
* g10/options.h (struct opt): Remove flags.allow_multiple_messages.
* g10/mainproc.c (proc_plaintext): Assume allow_multiple_messages is
false.
--

These options are very old compatibility hacks and should not be used
anymore.  We keep them as dummy options in case someone has them in
the conf file.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-05-30 22:05:57 +02:00
Werner Koch d1431901f0
gpg: Hard fail on a missing MDC even for legacy algorithms.
* 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 <wk@gnupg.org>
2018-05-15 12:38:17 +02:00
Werner Koch 36373798c0
Merge branch 'STABLE-BRANCH-2-2' into master
--
Fixed conflicts:
  NEWS            - keep master
  configure.ac    - merge
  g10/card-util.c - mostly 2.2
  g10/sig-check.c - 2.2
2018-04-10 10:14:30 +02:00
NIIBE Yutaka 83529e1bd1 tests: Fix no gpg-agent upon removal of GNUPGHOME.
* 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 <gniibe@fsij.org>
2018-04-04 20:27:08 +09:00
Werner Koch db7661b5a2
gpg: New maintainer option --debug-set-iobuf-size.
* g10/gpg.c (opts): Add new option.
(opt_set_iobuf_size): New var.
(set_debug): Set the option.
* tests/openpgp/armor.scm: Use this option to revert the buffer size
to the one which used to exhibit the tested bugs.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-01-24 18:38:20 +01:00
NIIBE Yutaka 80b9045434 tests: Handle the case with DISABLE_REGEX.
* tests/openpgp/Makefile.am [DISABLE_REGEX] (EXTRA_DIST, XTESTS):
  Conditionalize.
* tests/openpgp/all-tests.scm (all-tests): Input file is Makefile.

--

The feature is only valid with !DISABLE_REGEX.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-11-13 18:50:30 +09:00
Damien Goutte-Gattat a1fe3708d0 tests: Run the trust-pgp-4 test again.
* tests/openpgp/Makefile.am (XTESTS): Add trust-pgp-4.scm.
(EXTRA_DIST): Remove the test file from EXTRA_DIST.
--

Now that issue 2923 is fixed, the trust-pgp-4 test passes as
expected and we can enable it again. That should help prevent
a future regression on this issue.

Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
2017-11-13 16:13:14 +09:00
Werner Koch 42308224d1
tests: Minor imporvement in agent invocation
* tests/openpgp/defs.scm (create-gpghome): Add s2k-count.
--

My tests show only 2.5% improvement, but as we have that option now
let's use it.

real    9m12.604s
user    2m20.720s
sys     0m11.452s

real    8m3.815s
user    2m16.700s
sys     0m11.544s

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-11-06 16:49:07 +01:00
NIIBE Yutaka 05cb87276c agent, tests: Support --disable-scdaemon build case.
* 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 <gniibe@fsij.org>
2017-10-26 11:39:49 +09:00
NIIBE Yutaka bf26c08b95 agent, tests: Support --disable-scdaemon build case.
* 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 <gniibe@fsij.org>
2017-10-26 11:24:39 +09:00
NIIBE Yutaka a172759b50
tests: Fix a test which specifies expiration date.
* 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 <gniibe@fsij.org>
2017-09-11 11:39:17 +02:00
NIIBE Yutaka 17f764dd49 tests: Fix a test which specifies expiration date.
* 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 <gniibe@fsij.org>
2017-09-08 14:21:29 +09:00
Werner Koch b917cb66b7
tests: Do not run trust-pgp-4.scm
* 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: c23a69970b
Signed-off-by: Werner Koch <wk@gnupg.org>
2017-08-23 15:55:20 +02:00
Damien Goutte-Gattat c23a69970b
tests: Add tests for the PGP trust model.
* 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>
2017-08-21 17:12:05 +02:00
Damien Goutte-Gattat cbe54b28bf
tests: Move some functions into a common module.
* 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>
2017-08-21 16:51:03 +02:00
Justus Winter 23107ba20f
tests: Improve documentation.
* tests/openpgp/README: Add quickstart instructions, how to use
shell.scm, remove no longer used MKDATA.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-08-10 12:04:43 +02:00
Werner Koch fb21aa8b50
build: New configure option --enable-all-tests.
* 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>
2017-08-08 17:49:53 +02:00
Justus Winter b0112dbca9
tests: Do not run all tests unless in maintainer mode.
* 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>
2017-08-07 11:15:56 +02:00
Werner Koch 0767eada14
tests: Adjust tests for changed --auto-key-locate default.
* tests/openpgp/defs.scm (create-gpghome): Disable new defaults.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-08-04 22:28:13 +02:00
Justus Winter 58eafd11ed
tests: Improve 'shell.scm' script.
* 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>
2017-07-14 12:59:00 +02:00
Justus Winter b49b1a87ac
tests: Improve test.
* tests/openpgp/ssh-export.scm: Split output at any whitespace.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-06-26 12:51:28 +02:00
Justus Winter 62274d3c30
tests: Add test for gpgv.
* 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>
2017-06-21 15:08:02 +02:00
Justus Winter b766d3d103
tests: Run the OpenPGP tests using the new extended key format.
* 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>
2017-06-19 16:51: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 38b48eb11b
tests: Clarify comments.
--
Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-08 12:37:20 +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
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 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 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 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
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
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 94645311f8
tests: Make test more robust.
* 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 <justus@g10code.com>
2017-04-06 12:36:00 +02:00
Justus Winter 01e84d429a
tests: Fix setup of ephemeral home directories.
* 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: 32b75fb774
Signed-off-by: Justus Winter <justus@g10code.com>
2017-04-05 15:22:42 +02:00
Justus Winter 32b75fb774
tests: Fix setup of ephemeral home directories.
* 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 <justus@g10code.com>
2017-04-04 18:52:06 +02:00
Justus Winter 5128cd74c0
tests: Fix distcheck.
* tests/openpgp/Makefile.am (sample_msgs): Add all missing sample
messages.

Fixes-commit: 211d71f19c
Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-28 12:22:18 +02:00
Justus Winter 211d71f19c
tests: Add test for '--decrypt --unwrap'.
* tests/openpgp/Makefile.am (XTESTS): Add new test.
* tests/openpgp/decrypt-unwrap-verify.scm: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-28 12:11:03 +02:00