Bug 16166

Summary: [patch] Add DBusServer-using test cases
Product: dbus Reporter: Colin Walters <walters>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED FIXED QA Contact: John (J5) Palmieri <johnp>
Severity: normal    
Priority: medium CC: walters
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 15570, 15571    
Attachments: Add-a-test-shutdown-test-with-some-test-infrastruct.patch
Add-test-library-functions-for-using-DBusServer.patch
Small-tweaks-to-shutdown-test.patch
Add-PrivServer-test-which-uses-DBusServer.patch

Description Colin Walters 2008-05-30 08:02:45 UTC
Hi, I was looking at Scott's patches, but was uncomfortable about the fact that there is very little coverage of DBusServer (outside of the bus itself) and dbus_shutdown() right now.  

Attached are 4 patches.  
The first separates the test-utils.[ch] into a separate noinst libtool library and creates a test-shutdown.c test that calls dbus_shutdown and also reinitializes.  
The second patch adds utility functions for setting up a DBusServer with DBusLoop, matching the code for connections.
The third patch is trivial changes for the first which if I knew Git better I would have merged.
The fourth patch finally uses this infrastructure to create a "PrivServer" test which excercises DBusServer and dbus_shutdown and we can start to reproduce the problems Scott is hitting.
Comment 1 Colin Walters 2008-05-30 08:03:36 UTC
Created attachment 16827 [details] [review]
Add-a-test-shutdown-test-with-some-test-infrastruct.patch
Comment 2 Colin Walters 2008-05-30 08:04:07 UTC
Created attachment 16828 [details] [review]
Add-test-library-functions-for-using-DBusServer.patch
Comment 3 Colin Walters 2008-05-30 08:04:30 UTC
Created attachment 16829 [details] [review]
Small-tweaks-to-shutdown-test.patch
Comment 4 Colin Walters 2008-05-30 08:04:45 UTC
Created attachment 16830 [details] [review]
Add-PrivServer-test-which-uses-DBusServer.patch
Comment 5 John (J5) Palmieri 2008-05-30 12:03:09 UTC
These all look good.  Look at the docs for interactive git-rebase to merge the two patches and fix up your commit messages.  The commit messages should have the header then a regular changelog entry with a listing of each file that changed and what changed in them.  For the most part it is new files or functions so you can just say "added new file" for those and give a brief description.  If you can fix that up then feel free to commit to head and the dbus-1.2-branch branch.  Don't forget to push --all after you are done.   If you need any help with git commands just ask or talk to the X guys as they are using it in more detail than we are.
Comment 6 John (J5) Palmieri 2008-05-30 12:17:00 UTC
I should note you can commit all your patches to the master branch and then branch the remote 1.2 branch:

git checkout -b dbus-1.2-branch origin/dbus-1.2-branch
 
and then use git-cherrypick to commit those patches.  Only bug fixes should be moved over to the 1.2 branch.
Comment 7 Colin Walters 2008-06-05 15:30:48 UTC
Committed to HEAD on master, I haven't moved them over to dbus-1.2.

commit 5e359834f28b0580e7b79a057614d4e3592709ac
Author: Colin Walters <walters@verbum.org>
Date:   Fri May 30 17:11:15 2008 -0400

    Add "PrivServer" test which exercises DBusServer and dbus_shutdown
    
    	* test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service.in:
    	New service file for PrivServer.
    	* configure.in: Generate it.
    	* test/name-test/Makefile.am: Build test-privserver and
    	test-privserver-client.
    	* test/name-test/test-privserver.c: Use DBusServer to
    	serve a private connection.
    	* test/name-test/test-privserver-client.c: Connect
    	via session bus and get address of private server,
    	exercise dbus_shutdown().
    	* test/name-test/run-test.sh: Run it.

commit a73a79a155e97a3bd0d3ce5001ca6b9db803eeeb
Author: Colin Walters <walters@verbum.org>
Date:   Fri May 30 16:53:35 2008 -0400

    Add noinst convenience test library, add a test-shutdown
    
    	* test/Makefile.am: New convenience library
    	libdbus_testutils_la.  Reorder build so that
    	test/ gets built before test/name-test so
    	name-test files can depend on it.
    	* test/name-test/test-shutdown.c: New file,
    	exercises dbus_shutdown () a bit.
    	* test/name-test/run-test.sh Run test-shutdown.
    	* test/test-utils.h: In some cases we already have
    	DBUS_COMPILATION defined, avoid double definition
    	warning.

commit 9d8989cfec02e6ca41f8ffa0ccda16c93ddcb23c
Author: Colin Walters <walters@verbum.org>
Date:   Fri May 30 10:33:18 2008 -0400

    Add test library functions for using DBusServer
    
    	* test/test-utils.h, test/test-utils.c: Add functions
    	which hook up a DBusServer to a DBusLoop, useful
    	for test cases.

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.