Closed Bug 807861 Opened 7 years ago Closed 7 years ago

xpcshell mach command handler doesn't ensure state directory exists

Categories

(Testing :: XPCShell Harness, defect)

x86
macOS
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla19

People

(Reporter: rnewman, Assigned: gps)

Details

Attachments

(1 file)

Malformed module loading during test => this out.

0.68 TEST-UNEXPECTED-FAIL| resource://gre/modules/services/healthreport/profile.jsm:58 | SyntaxError: missing } after property list
0.69 WARNING: nsExceptionService ignoring thread destruction after shutdown: file /Users/rnewman/moz/hg/services-central/xpcom/base/nsExceptionService.cpp, line 166
0.69 WARNING: OOPDeinit() without successful OOPInit(): file /Users/rnewman/moz/hg/services-central/toolkit/crashreporter/nsExceptionHandler.cpp, line 2252
0.69 nsStringStats
0.69  => mAllocCount:           2260
0.69  => mReallocCount:          385
0.69  => mFreeCount:            2260
0.69  => mShareCount:           8100
0.69  => mAdoptCount:             83
0.69  => mAdoptFreeCount:         83
0.69 <<<<<<<
0.69 INFO | Result summary:
INFO | Passed: 0
INFO | Failed: 1
INFO | Todo: 0
Error running mach:

    ['xpcshell-test', 'services/healthreport/tests/xpcshell/test_load_modules.js']

The error occured in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

IOError: [Errno 2] No such file or directory: u'/Users/rnewman/moz/hg/services-central/obj-ff-dbg/.mozbuild/xpchsell.xunit.xml'

  File "/Users/rnewman/moz/hg/services-central/testing/xpcshell/mach_commands.py", line 129, in run_xpcshell_test
    xpcshell.run_test(**params)
  File "/Users/rnewman/moz/hg/services-central/testing/xpcshell/mach_commands.py", line 62, in run_test
    self._run_xpcshell_harness(**args)
  File "/Users/rnewman/moz/hg/services-central/testing/xpcshell/mach_commands.py", line 108, in _run_xpcshell_harness
    xpcshell.runTests(**args)
  File "/Users/rnewman/moz/hg/services-central/testing/xpcshell/runxpcshelltests.py", line 1002, in runTests
    name=xunitName)
  File "/Users/rnewman/moz/hg/services-central/testing/xpcshell/runxpcshelltests.py", line 488, in writeXunitResults
    fh = open(filename, 'wb')
Scratch that. Now it fails for any test:

1.08 TEST-PASS | (xpcshell/head.js) | 1 (+ 0) check(s) passed
1.08 
1.08 TEST-INFO | (xpcshell/head.js) | 0 check(s) todo
1.08 WARNING: nsExceptionService ignoring thread destruction after shutdown: file /Users/rnewman/moz/hg/services-central/xpcom/base/nsExceptionService.cpp, line 166
1.08 WARNING: OOPDeinit() without successful OOPInit(): file /Users/rnewman/moz/hg/services-central/toolkit/crashreporter/nsExceptionHandler.cpp, line 2252
1.08 nsStringStats
1.08  => mAllocCount:           5182
1.08  => mReallocCount:          537
1.08  => mFreeCount:            5182
1.08  => mShareCount:          10362
1.08  => mAdoptCount:            530
1.08  => mAdoptFreeCount:        530
1.08 <<<<<<<
1.09 INFO | Result summary:
INFO | Passed: 1
INFO | Failed: 0
INFO | Todo: 0
Error running mach:

    ['xpcshell-test', 'services/sync/tests/unit/test_bookmark_batch_fail.js']

The error occured in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

IOError: [Errno 2] No such file or directory: u'/Users/rnewman/moz/hg/services-central/obj-ff-dbg/.mozbuild/xpchsell.xunit.xml'
What typo?

The bug I see is the xpcshell test runner is throwing an exception and that is propagating. I think it is doing that because it doesn't handle writing an xunit file when no tests completed successfully.
Do you have a TOPOBJDIR/.mozbuild directory? If not, mkdir that and it should work. This is likely a missing call to _ensure_state_dir_exists() (or whatever the api is from python/mozbuild/mozbuild/base.py:MozbuildObject) in the xpcshell mach command handler.
Yeah, testing/xpcshell/mach_commands.py is missing a function call to ensure the state directory exists. This is a one-liner.
Summary: Typo in error handler → xpcshell mach command handler doesn't ensure state directory exists
Component: mach → XPCShell Harness
Product: Core → Testing
Typo:

IOError: [Errno 2] No such file or directory: u'/Users/rnewman/moz/
hg/services-central/obj-ff-dbg/.mozbuild/xpchsell.xunit.xml'
                                         ^^^^^^^^

Wild guess that it might be related.

I have been successfully running tests in this tree for aaaaages (including with mach).

I just did a make -f client.mk, and I still don't have objdir/.mozbuild.

But yes, that's the correct fix.
This is a band-aid. Long term I think commands should be conditional depending on them fulfilling preconditions. i.e. xpcshell-test won't run unless a checker verifies that dist/bin/xpcshell exists and the tree has been built. We'll get there.

This code isn't part of the build and is trivial, so giving to rnewman for review. I don't think I'll offend any module owners.
Assignee: nobody → gps
Status: NEW → ASSIGNED
Attachment #677619 - Flags: review?(rnewman)
Comment on attachment 677619 [details] [diff] [review]
Create state dir before running tests, v1

Review of attachment 677619 [details] [diff] [review]:
-----------------------------------------------------------------

Fixes the issue.
Attachment #677619 - Flags: review?(rnewman) → review+
https://hg.mozilla.org/mozilla-central/rev/1ef4d2e4a07e
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.