~roadmr/ubuntu/oneiric/checkbox/fix-662322-in-0.12.9

« back to all changes in this revision

Viewing changes to scripts/internet_test

  • Committer: Stéphane Graber
  • Date: 2011-06-22 22:25:05 UTC
  • mfrom: (28.1.1 checkbox)
  • Revision ID: stgraber@ubuntu.com-20110622222505-v2msalt9k5eobvuz
Tags: 0.12.2
releasing version 0.12.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
 
81
81
        return t1
82
82
 
83
 
def ping(host, count, deadline, verbose=False):
 
83
def ping(host, interface, count, deadline, verbose=False):
84
84
    command = "ping -R -c %s -w %s %s" % (count, deadline, host)
 
85
    if interface:
 
86
        command = "ping -I%s -R -c %s -w %s %s" % (interface, count, deadline, host)
 
87
 
85
88
    reg = re.compile(r"(\d) received")
86
89
    packets_received = 0
87
90
 
117
120
        default=False,
118
121
        action="store_true",
119
122
        help="Be verbose.")
 
123
    parser.add_option("-I", "--interface",
 
124
        help="Interface to ping from.")
120
125
    (options, args) = parser.parse_args(args)
121
126
 
122
127
    if args:
127
132
 
128
133
    received_packets = 0
129
134
    if host:
130
 
        received_packets = ping(host, options.count, options.deadline,
 
135
        received_packets = ping(host, options.interface, options.count, options.deadline,
131
136
                                options.verbose)
132
137
 
133
138
    if received_packets == 0: