Closed Bug 799216 Opened 12 years ago Closed 10 years ago

Head and tail lines shouldn't be required in xpcshell manifests

Categories

(Testing :: XPCShell Harness, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla32

People

(Reporter: ehsan.akhgari, Assigned: Gijs)

Details

(Whiteboard: [fixed-in-inbound])

Attachments

(1 file)

If you omit head and tail from the xpcshell manifest file, you'll be presented with an error like this:

Traceback (most recent call last):
  File "./mach", line 47, in <module>
    sys.exit(mach.run(sys.argv[1:]))
  File "/Users/ehsanakhgari/moz/mozilla-central/python/mach/mach/main.py", line 147, in run
    return self._run(argv)
  File "/Users/ehsanakhgari/moz/mozilla-central/python/mach/mach/main.py", line 206, in _run
    result = fn(**stripped)
  File "/Users/ehsanakhgari/moz/mozilla-central/python/mozbuild/mach/commands/testing.py", line 89, in run_xpcshell_test
    xpcshell.run_test(**params)
  File "/Users/ehsanakhgari/moz/mozilla-central/python/mozbuild/mozbuild/testing/xpcshell.py", line 49, in run_test
    self._run_xpcshell_harness(**args)
  File "/Users/ehsanakhgari/moz/mozilla-central/python/mozbuild/mozbuild/testing/xpcshell.py", line 89, in _run_xpcshell_harness
    xpcshell.runTests(**args)
  File "/Users/ehsanakhgari/moz/mozilla-central/testing/xpcshell/runxpcshelltests.py", line 768, in runTests
    testHeadFiles, testTailFiles = self.getHeadAndTailFiles(test)
  File "/Users/ehsanakhgari/moz/mozilla-central/testing/xpcshell/runxpcshelltests.py", line 265, in getHeadAndTailFiles
    return (list(sanitize_list(test['head'], 'head')),
KeyError: 'head'

A much better way to notify the user would be an error message which describes what has happened.  (Really, head and tail entries should be optional, but that's another discussion.)
Why don't we just fix it to make them optional instead?
(In reply to comment #1)
> Why don't we just fix it to make them optional instead?

That would be absolutely fine by me!
Hrmpf. Just got bitten by this. I'll have a look later today. <insert lightbulb rabbithole gif here>
Flags: needinfo?(gijskruitbosch+bugs)
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Flags: needinfo?(gijskruitbosch+bugs)
Comment on attachment 8415670 [details] [diff] [review]
allow leaving out head/tail entries in xpcshell manifests,

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

::: testing/xpcshell/runxpcshelltests.py
@@ +358,5 @@
>  
>                  yield path
>  
> +        headlist = test_object['head'] if 'head' in test_object else ""
> +        taillist = test_object['tail'] if 'tail' in test_object else ""

nit: use consistent quote characters
Attachment #8415670 - Flags: review?(ted) → review+
Summary: The xpcshell test suite should emit a useful error for manifest files without head and tail lines → Head and tail lines shouldn't be required in xpcshell manifests
remote:   https://hg.mozilla.org/integration/mozilla-inbound/rev/7f7abc547fb9
Whiteboard: [fixed-in-inbound]
https://hg.mozilla.org/mozilla-central/rev/7f7abc547fb9
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.