Closed Bug 1320861 Opened 8 years ago Closed 5 years ago

gtestify mailnews/base/test/TestMailCookie.cpp

Categories

(MailNews Core :: Testing Infrastructure, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1322072

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

Details

Attachments

(1 file)

We need to convert mailnews/base/test/TestMailCookie.cpp to support bug 1313141, which is de-exporting XPCOM symbols to prevent 3rd party software hooking into Firefox on Windows.
The good news: this compiles.

The bad news: I don't know how to run gtests in comm-central. The obvious thing
fails in the following way.

> [fjord:~/moz/cc0] ./mozilla/mach gtest
> 0:00.10 /usr/bin/make -C testing/gtest -j8 -s gtest
> 0:00.14 /home/njn/moz/cc0/obj-x86_64-pc-linux-gnu/dist/bin/thunderbird -unittest
> Couldn't load XPCOM.

I can run the two commands by hand:

- |/usr/bin/make -C testing/gtest -j8 -s gtest| works if I run it in the objdir.

- |/home/njn/moz/cc0/obj-x86_64-pc-linux-gnu/dist/bin/thunderbird -unittest|
  works anywhere, though it complains about not recognizing |-unittest| and
  then just brings up a Thunderbird startup window. I don't get a startup
  window when I run |./mozilla/mach gtest|, though.

glandium, any ideas?
Attachment #8815163 - Flags: feedback?(mh+mozilla)
Assignee: nobody → n.nethercote
Status: NEW → ASSIGNED
There is automation and try for comm-central. They actually don't seem to be running gtests :(

https://treeherder.mozilla.org/#/jobs?repo=comm-central

Now looking at the build logs, I'm not even sure TestMailCookie is actually running. It's not running during make check, and it is packaged with other C++ unit tests. But there is no separate job running those.

So it would seem:
- Running tests locally for comm-central is busted, or require to do something that is not required for m-c alone
- comm-central-specific c++ unit tests have not been running on automation ever since m-c moved running them out of make check.
- comm-central-specific gtests have not been running on automation ever since m-c moved running them out of make check.
Philip, Justin, any insight? (or better ideas as to whom would know)
Attachment #8815163 - Flags: feedback?(mh+mozilla)
I've never run a C++ test in comm-central, and I've suspected for a long time that we are not running them at all.
Comment on attachment 8815163 [details] [diff] [review]
gtestify mailnews/base/test/TestMailCookie.cpp

Looks like the patch won't apply any more due to
https://hg.mozilla.org/comm-central/rev/8cba5e96786d45cea65c17fe3aee91eeba150753
which I landed as a bustage fix.
I'm happy to fix the conflict once we have an answer to the bigger question of what's the right thing to do with this test. Remove it? Convert to a gtest but don't both running it? Convert to a gtest and work out how to run it?
(In reply to Nicholas Nethercote [:njn] from comment #6)
> ... an answer to the bigger question of what's the right thing to do with this
> test.
I think first of all we need to work out what the test is doing and whether that represents any value. If it's useful, I'd convert it and run it. Otherwise, I'd remove it.

Running it locally gives "All Mail Cookie Tests passed" which is reassuring ;-)
Nicholas, some wires seem to have crossed here. TestMailCookie.cpp was converted to a gtest in bug 1322072 which landed in Jan. 2017.

That solved the immediate compile problem. However, I cannot work out how to run that test manually. With M-C being top source dir these days and C-C living in a comm/ subdirectory, it should just be:
  mach gtest TestMailCookie* (or without the asterisk)
but I get an error: Error loading c:\mozilla-source\comm-central\obj-x86_64-pc-mingw32\dist\bin\gtest/xul.dll: The specified module could not be found.
Copying a xul.dll to that directory then gives:
TEST-UNEXPECTED-FAIL | gtest | Not compiled with enable-tests
That's surprising, since I'm always building with |ac_add_options --enable-tests|.

I'm asking since in bug 1466343 I want to resurrect TestMsgStripRE. So if I can for out how to get TestMailCookie to run, I have a chance of making TestMsgStripRE work.

Nicholas, some wires seem to have crossed here. TestMailCookie.cpp was converted to a gtest in bug 1322072 which landed in Jan. 2017.
Flags: needinfo?(n.nethercote)
Oops, ignore the last repeated line.
Nicholas, could you check TestMailCookie.cpp in its current form after
https://hg.mozilla.org/comm-central/rev/89cfdf12b27260e9e6a8ed14b4c41066c1a1cc0c
to see whether anything from your patch here should be still incorporated.
The test code itself seems fine, the problem with running seems to be something about how it is built and/or run. I don't have any additional insight there, unfortunately.
Flags: needinfo?(n.nethercote)

Let's close this bug. TestMailCookie was converted into a gTest in bug 1322072.

I'll file a new bug to get it and TestMsgStripRE from bug 1466748 run as part of the test suite.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: