Closed Bug 742794 Opened 9 years ago Closed 8 years ago

Client should abort if told to start gecko instance on a used host/port

Categories

(Testing :: Marionette, defect)

x86
All
defect
Not set
normal

Tracking

(firefox20 fixed, b2g18 fixed, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 fixed)

RESOLVED FIXED
mozilla20
Tracking Status
firefox20 --- fixed
b2g18 --- fixed
b2g18-v1.0.0 --- wontfix
b2g18-v1.0.1 --- fixed

People

(Reporter: mdas, Assigned: mihneadb)

References

Details

(Whiteboard: [good first bug][mentor=mdas][lang=python])

Attachments

(1 file, 1 obsolete file)

Right now, if the client is told to start a b2g instance on a used host/port combination, it will kick off the process. It should first detect that this is unused, and if it is free, it should then start the process. Otherwise, it should throw an error
Whiteboard: [good first bug][mentor=mdas][lang=python]
Assignee: nobody → mihneadb
Attached patch check for available port (obsolete) — Splinter Review
As discussed on IRC, I've only added the check before starting the Gecko instance.
Attachment #692003 - Flags: review?(mdas)
Comment on attachment 692003 [details] [diff] [review]
check for available port

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

Thanks for the patch, I'll r+ once we get the Exception change through.

::: testing/marionette/client/marionette/marionette.py
@@ +119,5 @@
>          if bin:
> +            port = int(self.port)
> +            if not Marionette.is_port_available(port, host=self.host):
> +                print >> sys.stderr, "%s:%d is unavailable." % (self.host, port)
> +                sys.exit(1)

This style on lines 122-123 is a bit odd. Here, I'd throw an Exception instead of print/exit, since it will by default print to stderr and set the exit code to 1, and anyone using the Marionette object can catch that exception if they want.

@@ +171,5 @@
> +            return True
> +        except socket.error:
> +            return False
> +        finally:
> +            s.close()

Ah, helpful!
Attachment #692003 - Flags: review?(mdas) → review-
There :)
Attachment #692003 - Attachment is obsolete: true
Attachment #692305 - Flags: review?(mdas)
Comment on attachment 692305 [details] [diff] [review]
raise MarionetteException when the port is unavailable

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

yay!
Attachment #692305 - Flags: review?(mdas) → review+
Summary: Client should abort if told to start b2g instance on a used host/port → Client should abort if told to start gecko instance on a used host/port
https://hg.mozilla.org/mozilla-central/rev/95d847321295
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.