Bug 69542

Summary: MC: make tests pass under recent automake, fix timing bugs, misc
Product: Telepathy Reporter: Simon McVittie <smcv>
Component: mission-controlAssignee: Simon McVittie <smcv>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: git master   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: 01/10] Flag printf-ish functions with G_GNUC_PRINTF and fix resulting warnings
02/10] Ignore /test-driver, installed by Automake 1.13
03/10] installcheck-twisted: test the just-installed MC if using a DESTDIR
04/10] Always use run-test.sh to run tests
05/10] run-mc.sh.in: set DBUS_SYSTEM_BUS_ADDRESS
06/10] tests: write logs to MC_TEST_LOG_DIR, with latest log in `pwd`
07/10] Tests: clean up all built sources
08/10] tests: cd into the directory from which we were run
09/10] mcd_account_self_contact_upgraded_cb: don't crash on bad timing
10/10] document MC_TEST_KEEP_TEMP

Description Simon McVittie 2013-09-18 18:45:06 UTC
This should probably be more than one branch, but it's late, and this all needs to land before 5.16 anyway.
Comment 1 Simon McVittie 2013-09-18 18:46:08 UTC
Created attachment 86081 [details] [review]
01/10] Flag printf-ish functions with G_GNUC_PRINTF and fix  resulting warnings

In particular, mcd-account-manager-default could crash when migrating
an account, since it would dereference arbitrary stack contents
as a pointer-to-string.
Comment 2 Simon McVittie 2013-09-18 18:46:29 UTC
Created attachment 86082 [details] [review]
02/10] Ignore /test-driver, installed by Automake 1.13
Comment 3 Simon McVittie 2013-09-18 18:46:44 UTC
Created attachment 86083 [details] [review]
03/10] installcheck-twisted: test the just-installed MC if  using a DESTDIR
Comment 4 Simon McVittie 2013-09-18 18:47:25 UTC
Created attachment 86084 [details] [review]
04/10] Always use run-test.sh to run tests

There are three modes here:

- make check: run tests in ${srcdir} against MC in ${builddir}
- make installcheck: run tests in ${srcdir} against MC in
  ${DESTDIR}${prefix}
- ${mctestsdir}/twisted/run-test.sh: run tests in ${mctestsdir}
  against MC in ${prefix}

Also simplify the last of those cases, and avoid a potential symlink
attack, by requiring that the current working directory for run-test.sh
is a directory controlled by us. In practice we already required that,
because with-session-bus.sh creates files in the current directory.

---

Yes I realise this is pretty huge.
Comment 5 Simon McVittie 2013-09-18 18:47:42 UTC
Created attachment 86085 [details] [review]
05/10] run-mc.sh.in: set DBUS_SYSTEM_BUS_ADDRESS

This is used in the "installed" case, and this change is necessary to
catch up with exec-with-log.sh.in in the "uninstalled" case. We want
to use the fake NetworkManager, ConnMan etc., not the real ones.
Comment 6 Simon McVittie 2013-09-18 18:48:18 UTC
Created attachment 86086 [details] [review]
06/10] tests: write logs to MC_TEST_LOG_DIR, with latest log  in `pwd`

This makes the logs' location rather more obvious. Not altering MC's
working directory also means the core dump (if any) comes out in
tests/twisted, which makes sense, instead of tests/twisted/tools,
which doesn't.
Comment 7 Simon McVittie 2013-09-18 18:48:41 UTC
Created attachment 86087 [details] [review]
07/10] Tests: clean up all built sources
Comment 8 Simon McVittie 2013-09-18 18:48:59 UTC
Created attachment 86088 [details] [review]
08/10] tests: cd into the directory from which we were run

dbus-daemon does a chdir("/") for activated services. We want to
undo that, and put our logs (and core dumps, if any) in a more
obvious place.
Comment 9 Simon McVittie 2013-09-18 18:49:16 UTC
Created attachment 86089 [details] [review]
09/10] mcd_account_self_contact_upgraded_cb: don't crash on  bad timing

If the account is disconnecting, we might get the callback for
upgrading after we've already NULLed out self->priv->self_contact.
Comment 10 Simon McVittie 2013-09-18 18:49:30 UTC
Created attachment 86090 [details] [review]
10/10] document MC_TEST_KEEP_TEMP
Comment 11 Guillaume Desmottes 2013-09-19 09:09:23 UTC
Comment on attachment 86081 [details] [review]
01/10] Flag printf-ish functions with G_GNUC_PRINTF and fix  resulting warnings

Review of attachment 86081 [details] [review]:
-----------------------------------------------------------------

++
Comment 12 Guillaume Desmottes 2013-09-19 09:10:38 UTC
Comment on attachment 86082 [details] [review]
02/10] Ignore /test-driver, installed by Automake 1.13

Review of attachment 86082 [details] [review]:
-----------------------------------------------------------------

++

Did I mention I hate this thing? I can no longer type "vi tes<tab>" to edit a test file.
Comment 13 Guillaume Desmottes 2013-09-19 09:10:58 UTC
Comment on attachment 86083 [details] [review]
03/10] installcheck-twisted: test the just-installed MC if  using a DESTDIR

Review of attachment 86083 [details] [review]:
-----------------------------------------------------------------

++
Comment 14 Guillaume Desmottes 2013-09-19 09:11:46 UTC
Comment on attachment 86084 [details] [review]
04/10] Always use run-test.sh to run tests

Review of attachment 86084 [details] [review]:
-----------------------------------------------------------------

++ assuming distcheck passes.
Comment 15 Guillaume Desmottes 2013-09-19 09:12:17 UTC
Comment on attachment 86085 [details] [review]
05/10] run-mc.sh.in: set DBUS_SYSTEM_BUS_ADDRESS

Review of attachment 86085 [details] [review]:
-----------------------------------------------------------------

++
Comment 16 Guillaume Desmottes 2013-09-19 09:13:03 UTC
Comment on attachment 86086 [details] [review]
06/10] tests: write logs to MC_TEST_LOG_DIR, with latest log  in `pwd`

Review of attachment 86086 [details] [review]:
-----------------------------------------------------------------

++
Comment 17 Guillaume Desmottes 2013-09-19 09:13:15 UTC
Comment on attachment 86087 [details] [review]
07/10] Tests: clean up all built sources

Review of attachment 86087 [details] [review]:
-----------------------------------------------------------------

++
Comment 18 Guillaume Desmottes 2013-09-19 09:13:44 UTC
Comment on attachment 86088 [details] [review]
08/10] tests: cd into the directory from which we were run

Review of attachment 86088 [details] [review]:
-----------------------------------------------------------------

++
Comment 19 Guillaume Desmottes 2013-09-19 09:14:06 UTC
Comment on attachment 86089 [details] [review]
09/10] mcd_account_self_contact_upgraded_cb: don't crash on  bad timing

Review of attachment 86089 [details] [review]:
-----------------------------------------------------------------

++
Comment 20 Guillaume Desmottes 2013-09-19 09:14:29 UTC
Comment on attachment 86090 [details] [review]
10/10] document MC_TEST_KEEP_TEMP

Review of attachment 86090 [details] [review]:
-----------------------------------------------------------------

++
Comment 21 Simon McVittie 2013-09-19 10:31:15 UTC
(In reply to comment #12)
> Did I mention I hate this thing? I can no longer type "vi tes<tab>" to edit
> a test file.

We can probably move the Autotools misc into a subdirectory (I think /build-aux is traditional) via autoconf/automake directives, although we might need to bump required versions.
Comment 22 Simon McVittie 2013-09-26 11:46:25 UTC
fixed in 5.15.1

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.