1. 26 Jul, 2020 3 commits
    • Philipp Stephani's avatar
      Add another test for global module references · 73a2f510
      Philipp Stephani authored
      * test/src/emacs-module-tests.el (mod-test-globref-reordered): New
      unit test.
      
      * test/data/emacs-module/mod-test.c (Fmod_test_globref_reordered): New
      test module function.
      (emacs_module_init): Export it.
      73a2f510
    • Philipp Stephani's avatar
      Backport: add another test case for module assertions. · 3838aeb7
      Philipp Stephani authored
      This backports commit 9f01ce63 from master.  Since the bug isn’t
      present on emacs-27, just backport the new test case.
      
      * test/data/emacs-module/mod-test.c (Fmod_test_globref_invalid_free):
      New test module function.
      (emacs_module_init): Export it.
      
      * test/src/emacs-module-tests.el
      (module--test-assertions--globref-invalid-free): New unit test.
      3838aeb7
    • Philipp Stephani's avatar
      Backport: Add module test for edge case. · bde5f5f8
      Philipp Stephani authored
      This backports commit 6355a3ec from master.  Since the bug isn’t
      present in emacs-27, just backport the test case.
      
      * test/data/emacs-module/mod-test.c
      (Fmod_test_invalid_store_copy): New test module function.
      (emacs_module_init): Export it.
      
      * test/src/emacs-module-tests.el
      (module--test-assertions--load-non-live-object-with-global-copy):
      New unit test.
      bde5f5f8
  2. 01 Jan, 2020 1 commit
  3. 05 Dec, 2019 1 commit
    • Eli Zaretskii's avatar
      Fix recent modifications in emacs-module-tests · 85f8aa10
      Eli Zaretskii authored
      * test/data/emacs-module/mod-test.c (extract_big_integer): Fix
      calculation of size of 'magnitude' when 'emacs_limb_t' is wider
      than 'unsigned long'.
      
      * test/src/emacs-module-tests.el
      (module--test-assertions--load-non-live-object)
      (module--test-assertions--call-emacs-from-gc): On MS-Windows,
      check also mod-test-emacs with ".exe" appended, before
      skipping the tests.
      85f8aa10
  4. 16 Aug, 2019 1 commit
    • Paul Eggert's avatar
      Fix time-add rounding bug · f9fd12a3
      Paul Eggert authored
      Without this fix, time arithmetic yielded results that were not
      mathematically accurate, even though the exact results were
      representable; for example, (time-add 0 1e-13) yielded a timestamp
      equal to 0 instead of to 1e-13.
      * lisp/timezone.el (timezone-time-from-absolute):
      Let time-add do its thing rather than using floating point
      internally, which has rounding errors.  We now have bignums and so
      don’t need floating point to avoid overflow issues.
      * src/timefns.c (timeform_sub_ps_p): New function.
      (time_arith): If either argument is a float, represent the
      result exactly instead of discarding sub-ps info.
      * test/lisp/timezone-tests.el (timezone-tests-time-from-absolute):
      Don’t assume (HI LO US PS) timestamp format.
      * test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid):
      Don’t assume that time-add discards sub-ns info.
      * test/src/timefns-tests.el (time-rounding-tests):
      Add regression test to detect time-add rounding bug.
      f9fd12a3
  5. 15 Aug, 2019 1 commit
  6. 06 Jul, 2019 1 commit
    • Konstantin Kharlamov's avatar
      Replace manually crafted hex regexes with [:xdigit:] · dfc322d7
      Konstantin Kharlamov authored
      * admin/charsets/mapconv:
      * build-aux/gitlog-to-changelog (parse_amend_file, git_dir_option):
      * lisp/progmodes/verilog-mode.el (verilog-delay-re):
      (verilog-type-font-keywords, verilog-read-always-signals-recurse):
      (verilog-is-number):
      * lisp/progmodes/vera-mode.el (vera-font-lock-keywords):
      * test/src/emacs-module-tests.el (mod-test-sum-test):
      * lisp/xml.el: (xml--entity-replacement-text):
      * lisp/version.el (emacs-repository-version-git):
      * lisp/textmodes/sgml-mode.el (sgml-quote):
      * lisp/textmodes/css-mode.el (css-escapes-re)
      (css--colors-regexp):
      * lisp/progmodes/prolog.el (prolog-syntax-propertize-function):
      * lisp/progmodes/hideif.el (hif-token-regexp, hif-tokenize):
      * lisp/progmodes/ebnf-dtd.el: (ebnf-dtd-attlistdecl)
      (ebnf-dtd-entitydecl, ebnf-dtd-lex):
      * lisp/progmodes/ebnf-ebx.el (ebnf-ebx-hex-character):
      * lisp/progmodes/ebnf-abn.el (ebnf-abn-character):
      * lisp/progmodes/cperl-mode.el (cperl-highlight-charclass)
      (cperl-find-pods-heres):
      * lisp/progmodes/cc-mode.el (c-maybe-quoted-number-head)
      (c-maybe-quoted-number, c-parse-quotes-before-change)
      (c-parse-quotes-after-change, c-quoted-number-head-before-point)
      (c-quoted-number-straddling-point):
      * lisp/progmodes/ada-mode.el (featurep, ada-in-numeric-literal-p)
      (ada-font-lock-keywords):
      * lisp/org/org-mobile.el (org-mobile-copy-agenda-files)
      * lisp/org/org-table.el (org-table-number-regexp):
      (org-mobile-update-checksum-for-capture-file):
      * lisp/nxml/xsd-regexp.el (xsdre-gen-categories):
      * lisp/nxml/xmltok.el (let*):
      * lisp/nxml/rng-xsd.el (rng-xsd-convert-hex-binary)
      (rng-xsd-convert-any-uri):
      * lisp/nxml/rng-uri.el (rng-uri-file-name-1)
      (rng-uri-unescape-multibyte, rng-uri-unescape-unibyte)
      (rng-uri-unescape-unibyte-match)
      (rng-uri-unescape-unibyte-replace):
      * lisp/nxml/rng-cmpct.el (rng-c-process-escapes):
      * lisp/nxml/nxml-maint.el (nxml-insert-target-repertoire-glyph-set):
      * lisp/net/shr-color.el (shr-color->hexadecimal):
      * lisp/mail/rfc2231.el (rfc2231-decode-encoded-string):
      * lisp/international/mule-cmds.el (read-char-by-name):
      * lisp/htmlfontify.el (hfy-hex-regex):
      * lisp/gnus/nneething.el (nneething-decode-file-name):
      * lisp/gnus/mml-sec.el (mml-secure-find-usable-keys):
      * lisp/gnus/gnus-art.el (gnus-button-mid-or-mail-heuristic-alist):
      * lisp/faces.el (read-color):
      * lisp/epg.el (epg--status-ERRSIG, epg--status-VALIDSIG)
      (epg--status-SIG_CREATED, epg--decode-percent-escape)
      (epg--decode-hexstring, epg--decode-quotedstring)
      (epg-dn-from-string):
      * lisp/emulation/cua-rect.el (cua-incr-rectangle):
      * lisp/dnd.el (dnd-unescape-uri):
      * lisp/cedet/semantic/lex.el (semantic-lex-number-expression):
      * lisp/cedet/semantic/java.el (semantic-java-number-regexp):
      * lisp/calc/calc-lang.el (pascal):
      * lisp/calc/calc-ext.el (math-read-number-fancy):
      * lisp/calc/calc-aent.el (math-read-token):
      Replace various combinations of [0-9a-fA-F] with [[:xdigit:]].
      (Bug#36167)
      dfc322d7
  7. 04 May, 2019 1 commit
    • Philipp Stephani's avatar
      Use extract_time in test module. · e95ecbe1
      Philipp Stephani authored
      * test/data/emacs-module/mod-test.c (Fmod_test_sleep_until): Use
      extract_time for time argument.
      (signal_wrong_type_argument): Remove unused function.
      
      * test/src/emacs-module-tests.el (mod-test-sleep-until): Remove
      unnecessary ‘float-time’.
      e95ecbe1
  8. 28 Apr, 2019 3 commits
  9. 24 Apr, 2019 4 commits
    • Philipp Stephani's avatar
      Clarify rounding mode when converting to struct timespec. · c4bacb12
      Philipp Stephani authored
      * doc/lispref/internals.texi (Module Values): Clarify that the
      truncation is towards negative infinity.
      
      * test/data/emacs-module/mod-test.c (Fmod_test_nanoseconds): Add test
      function.
      (emacs_module_init): Define it.
      
      * test/src/emacs-module-tests.el (mod-test-nanoseconds): New unit test.
      c4bacb12
    • Philipp Stephani's avatar
      Fix return type of make_time. · 534c33cf
      Philipp Stephani authored
      make_time is documented to return a (TICKS . HZ) pair, so we can’t use
      make_lisp_time.  Introduce a new conversion function instead.
      
      * src/emacs-module.c (module_make_time): Use timespec_to_lisp to
      correct return type.
      
      * src/timefns.c (timespec_to_lisp): New function.
      (make_lisp_time): Use it.
      
      * test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid):
      Check return type.
      534c33cf
    • Philipp Stephani's avatar
      Add module functions to convert from and to big integers. · e290a7d1
      Philipp Stephani authored
      * src/module-env-27.h: Add new module functions to convert big
      integers.
      
      * src/emacs-module.h.in (emacs_mpz): Define if GMP is available.
      
      * src/emacs-module.c (module_extract_big_integer)
      (module_make_big_integer): New functions.
      (initialize_environment): Use them.
      
      * test/data/emacs-module/mod-test.c (Fmod_test_double): New test
      function.
      (emacs_module_init): Define it.
      
      * test/src/emacs-module-tests.el (mod-test-double): New unit test.
      
      * doc/lispref/internals.texi (Module Values): Document new functions.
      e290a7d1
    • Philipp Stephani's avatar
      Add conversions to and from struct timespec to module interface. · bffceab6
      Philipp Stephani authored
      Time values are a fundamental data type, and such conversions are hard
      to implement within modules because of the various forms of time
      values in Emacs Lisp.  Adding dedicated conversion functions can
      significantly simplify module code dealing with times.
      
      This approach uses nanosecond precision.  While Emacs in theory has
      support for higher-precision time values, in practice most languages
      and standards, such as POSIX, C, Java, and Go, have settled on
      nanosecond-precision integers to represent time.
      
      * src/emacs-module.h.in: Add header for struct timespec.
      
      * src/module-env-27.h: Add module functions for time conversion.
      
      * src/emacs-module.c (module_extract_time, module_make_time): New
      functions.
      (initialize_environment): Use them.
      
      * test/data/emacs-module/mod-test.c (Fmod_test_add_nanosecond): New
      test function.
      (emacs_module_init): Define it.
      
      * test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid)
      (mod-test-add-nanosecond/nil, mod-test-add-nanosecond/invalid): New
      unit tests.
      
      * doc/lispref/internals.texi (Module Values): Document time
      conversion functions.
      bffceab6
  10. 22 Mar, 2019 1 commit
  11. 21 Mar, 2019 2 commits
  12. 24 Feb, 2019 1 commit
    • Philipp Stephani's avatar
      Ignore pending_signals when checking for quits. · 72ec233f
      Philipp Stephani authored
      pending_signals is often set if no quit is pending.  This results in
      bugs in module code if the module returns but no quit is actually
      pending.
      
      As a better alternative, add a new process_input environment function
      for Emacs 27.  That function processes signals (like maybe_quit).
      
      * configure.ac: Add module snippet for Emacs 27.
      
      * src/module-env-27.h: New file.
      
      * src/emacs-module.h.in: Add process_input function to environment
      interface.
      
      * src/emacs-module.c (module_should_quit): Use QUITP macro to check
      whether the caller should quit.
      (module_process_input): New function.
      (initialize_environment): Use it.
      
      * src/eval.c: Remove obsolete comment.
      
      * test/data/emacs-module/mod-test.c (signal_wrong_type_argument)
      (signal_errno): New helper functions.
      (Fmod_test_sleep_until): New test module function.
      
      * test/src/emacs-module-tests.el (mod-test-sleep-until): New unit
      test.
      
      * doc/lispref/internals.texi (Module Misc): Document process_input.
      72ec233f
  13. 01 Jan, 2019 1 commit
  14. 25 Aug, 2018 1 commit
    • Sergey Vinokurov's avatar
      Fix detection of freed emacs_values (Bug#32479) · 54fb383a
      Sergey Vinokurov authored
      * src/emacs-module.c (module_free_global_ref): Compare a value to be
      freed with all entries of the list.
      
      * test/data/emacs-module/mod-test.c (Fmod_test_globref_free): New
      function.
      (emacs_module_init): Make it accessible from Lisp.
      * test/src/emacs-module-tests.el (mod-test-globref-free-test): New
      test which uses it.
      54fb383a
  15. 08 Aug, 2018 1 commit
  16. 28 Apr, 2018 1 commit
    • Juri Linkov's avatar
      * lisp/subr.el (dotimes): Deprecate RESULT field. (Bug#16206) · f4eeb0f5
      Juri Linkov authored
      * doc/lispref/control.texi (Iteration):
      * doc/misc/cl.texi (Iteration): Document deprecation of its use.
      * doc/lispintro/emacs-lisp-intro.texi (dotimes):
      * test/src/emacs-module-tests.el (multiply-string):
      * test/lisp/filenotify-tests.el (file-notify-test07-many-events):
      Place RESULT field after the form.
      f4eeb0f5
  17. 22 Mar, 2018 1 commit
    • Paul Eggert's avatar
      Port emacs-module-tests to 32-bit Emacs · 01118627
      Paul Eggert authored
      Fix a portability bug when emacs-module-tests.el is byte-compiled
      with a 32-bit Emacs (where #x20000000 evaluates to a
      floating-point number) and then is run on a 64-bit Emacs (where
      the floating-point number causes a test failure).
      * test/src/emacs-module-tests.el (mod-test-sum-test):
      Don’t assume #x20000000 can be represented as an Emacs integer.
      01118627
  18. 02 Feb, 2018 3 commits
    • Philipp Stephani's avatar
      Properly integrate modules into the loading process (Bug#30164). · 0443411f
      Philipp Stephani authored
      * src/lread.c (Fload): Don't defer to module-load immediately when
      encountering a module, but use the normal loading machinery to
      properly set up load-history, check for recursive loads, print
      messages, etc.
      
      * test/src/emacs-module-tests.el (module/load-history): New test.
      (module/describe-function-1): Adapt test.
      
      * etc/NEWS: Mention fixed behavior.
      0443411f
    • Philipp Stephani's avatar
      Use 'defalias' in test module instead of 'fset'. · 75c663f8
      Philipp Stephani authored
      This puts functions defined in the module into the 'load-history'.
      
      * test/data/emacs-module/mod-test.c (bind_function): Use 'defalias'
      instead of 'fset'.
      
      * test/src/emacs-module-tests.el (module/describe-function-1): Adapt
      unit test.
      75c663f8
    • Philipp Stephani's avatar
      Add support for module functions to C-h f (Bug#30163). · f3d0db7f
      Philipp Stephani authored
      * lisp/help-fns.el (help-fns-function-description-header): Handle
      module functions.
      
      * test/src/emacs-module-tests.el (module/describe-function-1): New
      test.
      f3d0db7f
  19. 28 Jan, 2018 2 commits
  20. 26 Jan, 2018 1 commit
    • Andy Moreton's avatar
      Fix emacs-module-tests to work out of build tree · e08f2416
      Andy Moreton authored
      * test/Makefile.in (test_module_dir): Build the test module library in
      a subdirectory of the build directory (not the source tree).
      (MODULE_CFLAGS): Fix location of emacs-module.h header file.
      (test_module): Move built library out of the source tree.
      * test/src/emacs-module-tests.el (mod-test-file): Locate the test module
      library relative to the running Emacs executable.
      e08f2416
  21. 01 Jan, 2018 1 commit
  22. 20 Dec, 2017 1 commit
  23. 13 Sep, 2017 1 commit
    • Paul Eggert's avatar
      Prefer HTTPS to FTP and HTTP in documentation · bc511a64
      Paul Eggert authored
      Most of this change is to boilerplate commentary such as license URLs.
      This change was prompted by ftp://ftp.gnu.org's going-away party,
      planned for November.  Change these FTP URLs to https://ftp.gnu.org
      instead.  Make similar changes for URLs to other organizations moving
      away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
      fsf.org when this works, as this will further help defend against
      man-in-the-middle attacks (for this part I omitted the MS-DOS and
      MS-Windows sources and the test tarballs to keep the workload down).
      HTTPS is not fully working to lists.gnu.org so I left those URLs alone
      for now.
      bc511a64
  24. 09 Aug, 2017 1 commit
    • Eli Zaretskii's avatar
      Fix crashing emacs-module tests on MS-Windows · 7fc27ea7
      Eli Zaretskii authored
      * src/w32fns.c (syms_of_w32fns) <w32-disable-abort-dialog>: New
      variable.
      (emacs_abort): If w32-disable-abort-dialog is non-nil, abort right
      away, without displaying the Abort dialog, which waits for the user.
      
      * test/src/emacs-module-tests.el (module--test-assertion): Run the
      inferior Emacs with the w32 abort dialog disabled.  Expect the
      status of the aborted Emacs sub-process to be 3 on MS-Windows and
      2 on MS-DOS.
      7fc27ea7
  25. 09 Jul, 2017 1 commit
    • Glenn Morris's avatar
      Fix failing module tests on GNU/Linux · 273f4bde
      Glenn Morris authored
      * test/src/emacs-module-tests.el
      (module--test-assertions--load-non-live-object)
      (module--test-assertions--call-emacs-from-gc):
      Avoid test failures due to backtraces.
      273f4bde
  26. 08 Jul, 2017 1 commit
    • Philipp Stephani's avatar
      Module assertions: check for garbage collections · b7dab24b
      Philipp Stephani authored
      It's technically possible to write a user pointer finalizer that calls
      into Emacs module functions.  This would be disastrous because it
      would allow arbitrary Lisp code to run during garbage collection.
      Therefore extend the module assertions to check for this case.
      
      * src/emacs-module.c (module_assert_thread): Also check whether a
      garbage collection is in progress.
      
      * test/data/emacs-module/mod-test.c (invalid_finalizer)
      (Fmod_test_invalid_finalizer): New test module functions.
      (emacs_module_init): Register new test function.
      
      * test/src/emacs-module-tests.el (module--test-assertion)
      (module--with-temp-directory): New helper macros.
      (module--test-assertions--load-non-live-object): Rename existing
      unit test, use helper macros.
      (module--test-assertions--call-emacs-from-gc): New unit test.
      b7dab24b
  27. 12 Jun, 2017 3 commits