Commit Graph

19 Commits

Author SHA1 Message Date
Werner Koch cdbe10b762
Remove the now obsolete argparse code.
* tests/gpgscm/main.c: Switch to the new option parser.
* common/argparse.c, common/argparse.h: Remove.
* common/init.c (_init_common_subsystems): Do not call obsolete func.
* common/Makefile.am (common_sources): Remove those files.

Signed-off-by: Werner Koch <wk@gnupg.org>
2020-02-22 09:52:48 +01:00
Werner Koch 0e8f6e2aa9
gpg: Use gpgrt's new option parser to provide a global conf file.
* common/util.h: Remove argparse.h.
* common/argparse.c: Undef GPGRT_ENABLE_ARGPARSE_MACROS.
* configure.ac (GPGRT_ENABLE_ARGPARSE_MACROS): Define.
* agent/gpg-agent.c: Undef GPGRT_ENABLE_ARGPARSE_MACROS and include
argparse.h.  Do this also for all main modules which use our option
parser except for gpg.  Replace calls to strusage by calls to
gpgrt_strusage everywhere.

* g10/gpg.c (opts): Change type to gpgrt_opt_t.  Flag oOptions and
oNoOptions with ARGPARSE_conffile and ARGPARSE_no_conffile.
(main): Change type of pargs to gpgrt_argparse_t.  Rework the option
parser to make use of the new gpgrt_argparser.
--

This is not yet finished but a make check works.  gpg has the most
complex and oldest option handling and thus this is the first
migration target.  SE-Linux checks and version-ed config files are
missing and will be added later.

GnuPG-bug-id: 4788
Signed-off-by: Werner Koch <wk@gnupg.org>
2020-02-20 11:13:32 +01:00
Justus Winter 2e1342b78b
gpgscm,w32: Fix testing for absolute paths.
* tests/gpgscm/main.c (path_absolute_p): New function.
(load): Use new function.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-07-18 16:15:45 +02:00
Justus Winter f78fe1a4ec
gpgscm: Make loading of modules less verbose.
* tests/gpgscm/main.c (load): Increase logging threshold.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-07-13 16:29:25 +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 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 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
NIIBE Yutaka d6c7bf1f8a More change for common.
* g10, scd, test, tools: Follow the change of removal of -Icommon.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-03-07 20:32:09 +09:00
Yuri Chornoivan 24cf0606b4 Clean up word replication.
--

This fixes extra word repetitions (like "the the" or "is is") in the
code and docs.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2017-02-21 13:11:46 -05:00
Justus Winter e7429b1ced gpgscm: Better error reporting.
* tests/gpgscm/ffi.scm: Move the customized exception handling and
atexit logic...
* tests/gpgscm/init.scm: ... here.
(throw): Record the current history.
(throw'): New function that is history-aware.
(rethrow): New function.
(*error-hook*): Use the new throw'.
* tests/gpgscm/main.c (load): Fix error handling.
(main): Save and use the 'sc->retcode' as exit code.
* tests/gpgscm/repl.scm (repl): Print call history.
* tests/gpgscm/scheme.c (_Error_1): Make a snapshot of the history,
use it to provide a accurate location of the expression causing the
error at runtime, and hand the history trace to the '*error-hook*'.
(opexe_5): Tag all lists at parse time with the current location.
* tests/gpgscm/tests.scm: Update calls to 'throw', use 'rethrow'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-08 17:22:50 +01:00
Werner Koch 4d7dc432b5
Change all http://www.gnu.org in license notices to https://
--
2016-11-05 12:02:19 +01:00
Justus Winter 43f8006f5c gpgscm: Implement 'atexit'.
* tests/gpgscm/ffi.scm (throw): Run *run-atexit-handlers* when
terminating the interpreter.
(*atexit-handlers*): New variable.
(*run-atexit-handlers*): New function.
(atexit): Likewise.
* tests/gpgscm/main.c (main): Run *run-atexit-handlers* at normal
interpreter shutdown.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-11-04 12:42:00 +01:00
Justus Winter 83a406b38a tests: Use descriptive temporary file names.
* tests/gpgscm/ffi.c (do_get_isotime): New function.
(ffi_init): Add parameter 'scriptname', bind new function and
scriptname.
* tests/gpgscm/ffi.h (ffi_init): Update prototype.
* tests/gpgscm/main.c (main): Hand in the script name.
* tests/gpgscm/tests.scm (mkdtemp): Use current time and script name
for the names of temporary directories.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-19 18:49:17 +02:00
Werner Koch 47baeac50c
gpgscm: Fix gcrypt version check.
* tests/gpgscm/main.c (main): Check against required and not installed
version.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-19 08:41:51 +02:00
Justus Winter f2249b7370 gpgscm: Fix detection of unbalanced parenthesis.
* tests/gpgscm/main.c (load): Print error message.
* tests/gpgscm/scheme.c (opexe_0): Correctly report nesting level when
loading files.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-06 16:46:31 +02:00
Daniel Kahn Gillmor 61c2a1fa6d
Call log_set_prefix() with human-readable labels.
* agent/preset-passphrase.c, agent/protect-tool.c, dirmngr/dirmngr.c
* dirmngr/t-http.c, g10/gpg.c, g10/gpgv.c, g13/g13-syshelp.c
* g13/g13.c, kbx/kbxutil.c, scd/scdaemon.c, sm/gpgsm.c
* tests/gpgscm/main.c, tools/gpg-check-pattern.c
* tools/gpg-connect-agent.c, tools/gpgconf.c, tools/gpgtar.c
* tools/symcryptrun.c: Invoke log_set_prefix() with
human-readable labels.

--

Some invocations of log_set_prefix() were done with raw numeric values
instead of values that humans can understand.  Use symbolic
representations instead of numeric for better readability.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2016-08-12 12:16:19 +02:00
Justus Winter d4ede89981 gpgscm: Use the allocator from libgcrypt.
* tests/gpgscm/main.c (main): Use the allocator from libgcrypt.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-06-30 15:31:37 +02:00
Justus Winter 9c67958c47 gpgscm: Fix memory leaks.
* tests/gpgscm/ffi-private.h (ffi_schemify_name): Fix prototype.
(ffi_define_function_name): Free schemified name.
(ffi_define_function): Likewise.
(ffi_define_constant): Likewise.
(ffi_define_variable_pointer): Likewise.
* tests/gpgscm/ffi.c (do_wait_processes): Free arrays.
(ffi_schemify_name): Fix type.
* tests/gpgscm/main.c (main): Free 'sc'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-06-28 18:21:50 +02:00
Justus Winter d2ce3f9eee tests/gpgscm: Add a TinySCHEME-based test driver.
* configure.ac: Add new component.
* tests/Makefile.am: Likewise.
* tests/gpgscm/Makefile.am: New file.
* tests/gpgscm/ffi-private.h: Likewise.
* tests/gpgscm/ffi.c: Likewise.
* tests/gpgscm/ffi.h: Likewise.
* tests/gpgscm/ffi.scm: Likewise.
* tests/gpgscm/lib.scm: Likewise.
* tests/gpgscm/main.c: Likewise.
* tests/gpgscm/private.h: Likewise.
* tests/gpgscm/repl.scm: Likewise.
* tests/gpgscm/scheme-config.h: Likewise.
* tests/gpgscm/t-child.c: Likewise.
* tests/gpgscm/t-child.scm: Likewise.
* tests/gpgscm/tests.scm: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-06-17 11:57:12 +02:00