Bug 103758

Summary: Do something about test/data/*-messages/*.message
Product: dbus Reporter: Simon McVittie <smcv>
Component: coreAssignee: D-Bus Maintainers <dbus>
Status: RESOLVED MOVED QA Contact: D-Bus Maintainers <dbus>
Severity: enhancement    
Priority: medium    
Version: git master   
Hardware: Other   
OS: All   
i915 platform: i915 features:
Attachments: Remove test data in the "message builder" domain-specific language
Remove test data in the "message builder" domain-specific language

Description Simon McVittie 2017-11-15 12:05:11 UTC
dbus-message-builder was a domain-specific language for building D-Bus message blobs. It was introduced in 2003, and deleted in early 2005 when the type system was rewritten to be fully recursive. (See https://bugs.freedesktop.org/show_bug.cgi?id=103601#c28 for VCS archaeology)

These tests have been diagnosed as "skipped" since the commit that also deleted dbus-message-builder.[ch]:

commit 9d21554dd3b560952cd5aa607c4ec07898c0b260
Author: Havoc Pennington <hp@redhat.com>
Date:   2005-01-23 06:10:07 +0000

    2005-01-23  Havoc Pennington  <hp@redhat.com>
            * dbus/dbus-message-factory.c, dbus/dbus-message-util.c:
            get this all working, not many tests in the framework yet though

but even before that, the message builder language was disabled by:

+      if (FALSE) /* Message builder disabled, probably permanently,
+                  * I want to do it another way

which was part of this mega-commit:

commit 9c3d566e95c9080f6040c64531b0ccae22bd5d74
Author: Havoc Pennington <hp@redhat.com>
Date:   2005-01-15 07:15:38 +0000

    2005-01-15  Havoc Pennington  <hp@redhat.com>
            * Land the new message args API and type system.
            This patch is huge [...]

As a result of the type system having changed, the specific content of these files is probably no longer useful. However, the general concept of loading message blobs with known content and asserting that they do something sensible is potentially a valuable one, so maybe we should rescue some test coverage from them?

If we want a DSL for writing messages, here is a straw-man:

    message in xxd format, with comment lines introduced by #
    (xxd format is: "%08x: " offset, followed by up to 32 columns of hex
    with a space after each group of 4 digits, optionally followed by a
    double space and an ignored text-dump of the content)


    if VALID, some sort of encoding of the intended message content
    (GVariant text serialization?)

    if INVALID, the error code we expect to see

Unfortunately it would not really be OK for the "embedded tests" to link GLib for the GVariant text syntax. However, we could do something like this:

* in embedded tests
    * load each valid message (optionally with the crazy OOM-simulation),
      assert success or OOM
    * load each invalid message, assert the expected error code
* in GLib'y modular tests
    * load each valid message, assert expected content

I am not going to have time to work on this any time soon, but I'd review patches.

Until this happens, it might make sense to drop the unused code and data files, leaving this bug open - they haven't actually been used since 2005, and it would be trivial to get them back from git history for inspiration.
Comment 1 Simon McVittie 2017-11-15 13:16:19 UTC
Created attachment 135488 [details] [review]
Remove test data in the "message builder" domain-specific  language

These tests were disabled by commit 9c3d566, which rewrote the D-Bus
type system to be fully recursive, back in 2005. The message builder
was subsequently removed by commit 9d21554, also in early 2005.

It will probably take significant work to turn these files into
test-cases that use the current D-Bus type system and so can be run
this decade. Until that work is done, let's not ship them: we can
always fetch them from git history if we want them.

The single .message-raw file can still be read and has been retained,
although it hasn't actually tested the intended failure mode since
2005 due to changes to the D-Bus specification (it is a wire-protocol
version 0 message, and the recursive type system introduced in commit
9c3d566 changed the wire-protocol version to 1).


This patch is not a solution to this bug and does not implement the suggested test coverage - sorry, I don't have time to implement that right now. It just removes dead/misleading files until this bug can be fixed properly.
Comment 2 Simon McVittie 2017-11-15 13:17:54 UTC
Created attachment 135489 [details] [review]
Remove test data in the "message builder" domain-specific  language


Same long commit message as in the previous attempt.

v2: Remove the one reference to *.message from the CMake build system too.
Comment 3 Philip Withnall 2017-11-15 13:46:39 UTC
Comment on attachment 135488 [details] [review]
Remove test data in the "message builder" domain-specific  language

Review of attachment 135488 [details] [review]:

Comment 4 Philip Withnall 2017-11-15 13:47:24 UTC
Comment on attachment 135489 [details] [review]
Remove test data in the "message builder" domain-specific  language

Review of attachment 135489 [details] [review]:

Whoops, that was meant to be r+ on this one.
Comment 5 Simon McVittie 2017-11-15 14:02:07 UTC
Comment on attachment 135489 [details] [review]
Remove test data in the "message builder" domain-specific  language

Thanks, applied. The bug remains open, until someone gets round to reinstating this pre-2005 test coverage.
Comment 6 GitLab Migration User 2018-10-12 21:32:16 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/dbus/dbus/issues/192.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.