unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Hugh Daschbach <hugh@ccss.com>
Cc: 43252@debbugs.gnu.org
Subject: bug#43252: 27.1; DBus properties lack type hints or overrides
Date: Wed, 23 Sep 2020 19:32:08 +0200	[thread overview]
Message-ID: <87wo0kielj.fsf@gmx.de> (raw)
In-Reply-To: <87wo0l8908.fsf@ccss.com> (Hugh Daschbach's message of "Tue, 22 Sep 2020 20:30:47 -0700")

Hugh Daschbach <hugh@ccss.com> writes:

Hi Hugh,

> I've taken a shot at this.  I'm not sure I got the ChangeLog style
> correct.  Let me know if I'm still off the beaten path.

Almost. See comment below.

>> `dbus-register' (if SELECTOR is `register') or
>
> Fixed.

Almost. See comment below.

>> Well, this is one approach. Alternatively, we could regard the
>> introspection file as test data, which is located in a file called
>> .../test/lisp/net/dbus-tests/org.gnu.Emacs.TestDBus.xml. This
>> function (the handler for the Introspect method) would read the file,
>> and return its contents.

Oops, I'm mistaken here. The directory shall be called dbus-resources,
see .../test/file-organization.org. Sorry.

> Is:
>
> (let* ((property
>          (dbus-introspect-get-property
>           :session
>           dbus--test-service
>           dbus--test-path interface
>           property-name))) ...)
>
> preferred over:
>
> (let* ((property
>          (dbus-introspect-get-property :session
>          dbus--test-service
>           dbus--test-path interface property-name)))
>    ...)
>
> If not, I'll take another bite at the apple.

I'd vote for the latter, with the first argument :session preceding
the other arguments in the same line. Like

(let* ((property
        (dbus-introspect-get-property
	 :session dbus--test-service
	 dbus--test-path interface property-name)))
   ...)

If all arguments fit into 80 columns, do it.

The "canonical" formatting is offered by the `pp' command (pretty
printer). I must confess, that I do not follow all its recommendations.

> Done.  ’dbus-annotation-deprecated’.  Let me know if you think this
> should be
> ‘dbus--annotation-deprecated’ instead.

No, the former is OK. People might want to use it in their packages.

> In other news, this test:
>
>  (should-error
>   (dbus-check-arguments :session dbus--test-service :unix-fd 10)
>   :type 'dbus-error)
>
> works for me in batch mode, but not interactive mode.
>
> On GNU/Linux, (dired (format "/proc/%s/fd" (emacs-pid))) indicates I
> have 14 open file descriptors on a test instance (emacs -q -Q). On my
> development instance, I've got 27 open file descriptors.

I see. Will investigate.

And now my review for the latest patch versions.

> From be45a75b315e56649fa9e39d199fe5e2b50bf69d Mon Sep 17 00:00:00 2001
> From: Hugh Daschbach <hdasch@fastmail.com>
> Date: Tue, 22 Sep 2020 19:36:20 -0700
> Subject: [PATCH 1/2] Add D-Bus property tests.
>
> * test/lisp/net/dbus-tests.el: Add property tests.
> (dbus--test-run-property-test) (dbus--test-property)
> (dbus-test06-property-types): Test property registration, set, get.

If you have one comment for several functions, use only one parenthesis
per line like

(dbus--test-run-property-test, dbus--test-property)
(dbus-test06-property-types): Test property registration, set, get.

> +(defsubst dbus--test-run-property-test (selector name value expected)
> +  "Generate a property test: register, set, get, getall sequence.
> +This is a helper function for the macro `dbus--test-property'.
> +The argument SELECTOR indicates whether the test should expand to
> +'dbus-register-property' (if SELECTOR is `register') or

`dbus-register-property' (if SELECTOR is `register') or

> +         '((:array
> +            :object-path "/node00"
> +            :object-path "/node01"
> +            :object-path "/node0/node02") .
> +            ("/node00" "/node01" "/node0/node02"))

If a cons cell doesn't fit into one line, you shall move the dot "." to
the beginning of the next line, like

(dbus--test-property
 "ObjectArray"
 '((:array
    :object-path "/node00"
    :object-path "/node01"
    :object-path "/node0/node02")
   . ("/node00" "/node01" "/node0/node02"))

I bet the dot "." has the font-lock-warning-face (red foreground color)
in your buffer. Admittedly, it doesn't look prominent :-(

Move the cursor over the misplaced dot; there shall be a help message about.

> +    ;; Cleanup.
> +    (message "cleanup")
> +    (dbus-unregister-service :session dbus--test-service)))

I don't believe we need this message. We see that we're done :-)

> From 3efb1b38d75572b14ac0526dbd79769d6fa89d10 Mon Sep 17 00:00:00 2001
> From: Hugh Daschbach <hdasch@fastmail.com>
> Date: Mon, 21 Sep 2020 17:12:49 -0700
> Subject: [PATCH 2/2] Add D-Bus Introspection tests.
>
> * lisp/net/dbus.el (new defconst): D-Bus deprecation name.
>
> * test/lisp/net/dbus-tests.el  (dbus--tests-dir)
> (dbus--test-introspect) (dbus--test-examine-interface)
> (dbus--test-validate-annotations) (dbus--test-validate-property)
> (dbus--test-validate-m-or-s) (dbus--test-validate-signal)
> (dbus--test-validate-method) (dbus-test07-introspection): new tests.

That's not true. All but the last functions are new defuns, not new
tests. And please start the explanation with a capital letter, like "New test."

> +(defconst dbus-annotation-deprecated (concat dbus-interface-dbus ".Deprecated")
> +  "An annotation value indicating a deprecated interface, method, signal, or property.")

The docstring line does not fit 80 chars. What about

"An annotation indicating a deprecated interface, method, signal, or property."

> +(defvar dbus--tests-dir
> +  (file-truename
> +   (expand-file-name "dbus-tests"
> +                     (file-name-directory (or load-file-name
> +                                              buffer-file-name))))
> +  "Directory containing test data files.")

As said, it must be "dbus-resources".

> +(ert-deftest dbus-test07-introspection ()
> +  :tags '(:expensive-test)
> +  "Register an Introspection interface then query it."

:tags must be after the docstring.

> Cheers,
> Hugh

Best regards, Michael.





  parent reply	other threads:[~2020-09-23 17:32 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07  0:54 bug#43252: 27.1; DBus properties lack type hints or overrides Hugh Daschbach
2020-09-07  7:48 ` Michael Albinus
2020-09-07 17:35   ` Hugh Daschbach
2020-09-07 18:00     ` Michael Albinus
2020-09-07 19:18       ` Hugh Daschbach
2020-09-08 14:36         ` Michael Albinus
2020-09-09  4:10           ` Hugh Daschbach
2020-09-09  4:25             ` Hugh Daschbach
2020-09-09 13:25             ` Michael Albinus
2020-09-09 16:12               ` Hugh Daschbach
2020-09-09 17:43                 ` Michael Albinus
     [not found]                 ` <874ko6979w.fsf@gmx.de>
     [not found]                   ` <87v9gm9x9i.fsf@ccss.com>
2020-09-10 14:59                     ` Michael Albinus
2020-09-10 16:57                       ` Michael Albinus
2020-09-10 19:09                         ` Hugh Daschbach
2020-09-11  8:46                           ` Michael Albinus
2020-09-10 22:53                         ` Hugh Daschbach
2020-09-11  9:57                           ` Michael Albinus
2020-09-11 14:19                           ` Michael Albinus
2020-09-15  4:05                             ` Hugh Daschbach
2020-09-16 12:47                               ` Michael Albinus
2020-09-16 22:23                                 ` Hugh Daschbach
2020-09-17 12:58                                   ` Michael Albinus
2020-09-17 18:42                                     ` Hugh Daschbach
2020-09-18  6:28                                       ` Hugh Daschbach
2020-09-18  9:55                                         ` Michael Albinus
2020-09-18 13:42                                         ` Michael Albinus
2020-09-18 15:50                                           ` Michael Albinus
2020-09-18  9:36                                       ` Michael Albinus
2020-09-19  3:32                                         ` Hugh Daschbach
2020-09-20 15:05                                           ` Michael Albinus
2020-09-21 11:50                                             ` Michael Albinus
2020-09-22  3:48                                               ` Hugh Daschbach
2020-09-22 16:09                                                 ` Michael Albinus
2020-09-22 17:36                                                 ` Michael Albinus
2020-09-23  3:30                                                   ` Hugh Daschbach
2020-09-23  3:34                                                     ` Hugh Daschbach
2020-09-23  7:44                                                     ` Michael Albinus
2020-09-23 17:32                                                     ` Michael Albinus [this message]
2020-09-24  3:02                                                       ` Hugh Daschbach
2020-09-24  8:48                                                         ` Michael Albinus
2020-09-25  4:16                                                           ` Hugh Daschbach
2020-09-26  1:27                                                             ` Hugh Daschbach
2020-09-26  9:51                                                               ` Michael Albinus
2020-09-28  3:00                                                                 ` Hugh Daschbach
2020-09-28 12:55                                                                   ` Michael Albinus
2020-09-28 23:17                                                                     ` Hugh Daschbach
2020-09-29 12:22                                                                       ` Michael Albinus
2020-09-29 21:51                                                                         ` Hugh Daschbach
2020-09-30  9:34                                                                           ` Michael Albinus
2020-09-30 10:42                                                                             ` Michael Albinus
2020-09-30 16:39                                                                               ` Hugh Daschbach
2020-09-10  8:00 ` bug#43252: Fwd: " Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wo0kielj.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=43252@debbugs.gnu.org \
    --cc=hugh@ccss.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).