Closed Bug 1103159 Opened 7 years ago Closed 7 years ago

UnboundLocalError: local variable 'result' referenced before assignment with --e10s and --total-chunks

Categories

(Testing :: Mochitest, defect)

defect
Not set
normal

Tracking

(e10s+)

RESOLVED FIXED
mozilla37
Tracking Status
e10s + ---

People

(Reporter: mccr8, Assigned: vaibhav1994)

References

(Blocks 1 open bug)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

Running this:
  ./mach mochitest-browser --e10s --total-chunks 10 --this-chunk 10
Gives me this:
From _tests: Kept 33741 existing; Added/updated 0; Removed 0 files and 0 directories.
TEST-INFO | checking window state
Browser Chrome Test Summary
	Passed: 0
	Failed: 0
	Todo: 0
*** End BrowserChrome Test Results ***
Error running mach:

    ['mochitest-browser', '--e10s', '--total-chunks', '10', '--this-chunk', '10']

The error occurred 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:

UnboundLocalError: local variable 'result' referenced before assignment

  File "/home/amccreight/mc/testing/mochitest/mach_commands.py", line 662, in run_mochitest_browser
    return self.run_mochitest(test_paths, 'browser', **kwargs)
  File "/home/amccreight/mc/testing/mochitest/mach_commands.py", line 785, in run_mochitest
    test_paths=test_paths, suite=flavor, **kwargs)
  File "/home/amccreight/mc/testing/mochitest/mach_commands.py", line 390, in run_desktop_test
    result = runner.runTests(options)
  File "/home/amccreight/mc/obj-dbg/_tests/testing/mochitest/runtests.py", line 1764, in runTests
    return result

Removing the two chunk arguments, or the --e10s, makes the error go away.
This looks like it may have broken in bug 1036374, which added the |return result| without defining result on all return paths.
It works fine with total-chunks=3, so maybe the problem is that with total-chunks=10 the set of directories is empty?
ahh, most likely that is the case!  I suspect we can make a better error for the case when there are no chunks.
e10s test
Blocks: e10s-tests
tracking-e10s: --- → +
Not being able to run e10s tests locally is quite bad.
Blocks: 1036374
Keywords: regression
I was able to run them, it was just that the final chunk was empty in some cases and I got this weird message.
Attached patch bug1103159.patch (obsolete) — Splinter Review
This patch will ensure that the directories being run is non-empty and then only return the result parameter, thus not giving rise to this error.
Attachment #8539450 - Flags: review?(jmaher)
Comment on attachment 8539450 [details] [diff] [review]
bug1103159.patch

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

Please make this return a value:
0 = green
1 = orange

since there are no tests run, this probably should be a value of 1

::: testing/mochitest/runtests.py
@@ +1786,5 @@
>        print "3 INFO Todo:    %s" % self.counttodo
>        print "4 INFO SimpleTest FINISHED"
>  
> +    if dirs:
> +        return result

I would rather set result to a default value and always return something.  We use the return code from here when we sys.ext()
Attachment #8539450 - Flags: review?(jmaher) → review-
Attached patch bug1103159.patchSplinter Review
Placed a default value for result variable.
Attachment #8539450 - Attachment is obsolete: true
Attachment #8539467 - Flags: review?(jmaher)
Comment on attachment 8539467 [details] [diff] [review]
bug1103159.patch

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

thanks, how does this look locally.  Make sure whilst running this locally and hitting this condition that the ./mach termination makes sense.
Attachment #8539467 - Flags: review?(jmaher) → review+
vaibhav@vaibhav:~/mozilla-inbound$ ./mach mochitest-browser --e10s --total-chunks 10 --this-chunk 10
Build configuration changed. Regenerating backend.
Reticulating splines...
Finished reading 2748 moz.build files in 2.13s
Processed into 7569 build config descriptors in 1.71s
Backend executed in 2.74s
2265 total backend files; 0 created; 1 updated; 2264 unchanged; 0 deleted; 139 -> 852 Makefile
Total wall time: 6.86s; CPU time: 6.41s; Efficiency: 93%; Untracked: 0.29s
From _tests: Kept 34202 existing; Added/updated 0; Removed 0 files and 0 directories.
TEST-INFO | checking window state
Browser Chrome Test Summary
	Passed: 0
	Failed: 0
	Todo: 0
*** End BrowserChrome Test Results ***
0 ERROR Got suite_end message before suite_start.


This is the output. It shows that 0 tests are run. The last error is occurring because of 
bug 1060439.
this looks great, thanks!
Try push: https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=17d5b78fe521
Assignee: nobody → vaibhavmagarwal
The try run is green as expected.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/c3f9a03e9745
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.