History log of /external/autotest/client/cros/service_stopper.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0efabf2e85b197929c591cc75c4fdc0d3cddd77e 12-Mar-2015 Christopher Wiley <wiley@chromium.org> autotest: Add a close() method to ServiceStopper

A number of objects and constructs in python use close() to clean
up state (e.g. files, host objects, other helper delegate).
Add an alias to restore_services to ServiceStopper so that we can
write code like:
for closer in objects_to_close():
closer.close()

TEST=leaderd tests that use this functionality correctly restart
stopped services.
BUG=brillo:535

Change-Id: I3fa6a05f3fb9ba93a1e85d76e593a51b2c6596c8
Reviewed-on: https://chromium-review.googlesource.com/260587
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
/external/autotest/client/cros/service_stopper.py
3c4e37edf1da54ee267e6e86abeaccef98b15726 02-Jun-2014 Alex Miller <milleral@chromium.org> service_stopper: Enable context manager usage and add usage instructions

In the offchance that one wishes to start and stop services in each
iteration of the test, it makes more sense to use a context manager
style of using this class. However, in most cases, one should likely
use initialize/cleanup, so this has been included as part of the
documentation for the file.

TEST=None
BUG=None

Change-Id: Ic8886438744b73360dbc91baf704e1d666cb3e04
Reviewed-on: https://chromium-review.googlesource.com/202354
Tested-by: Alex Miller <milleral@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Alex Miller <milleral@chromium.org>
/external/autotest/client/cros/service_stopper.py
0c076d5231eab83b3ca6368c4370cfa8698d2ba1 07-Mar-2014 Todd Broch <tbroch@chromium.org> service_stopper: Add vnc to default services to stop for power.

BUG=none
TEST=run power_Idle

Change-Id: I6cb7808ca64ea67ca8b20e0ac48e1c92d822d30a
Reviewed-on: https://chromium-review.googlesource.com/189222
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
/external/autotest/client/cros/service_stopper.py
7d6386a862470be63bc607fcc0c0eb2b288923df 21-May-2013 Todd Broch <tbroch@chromium.org> Fix bug in service_stopper.

https://gerrit.chromium.org/gerrit/51254 introduced bug into the
service stopper logic where is_stopped was always true.

For example the most likely upstart status strings will create the
following values for is_stopped:

out_arr = ['tcsd start/running, process 507',
'tcsd stop/waiting',
'status: Unknown job: tcsd_bogus'
]
for out in out_arr:
is_stopped = 'start/running' not in out
print is_stopped

>>> False
>>> True
>>> True

Previous change incorrectly assummed find would return 0 for a match
and 1 for not but it should have instead key'd off -1 for no match.

BUG=chrome-os-partner:19561
TEST=hardware_TPMCheck passes

Change-Id: I3f02cf74840ba834c6fe115d8852197532bf4686
Reviewed-on: https://gerrit.chromium.org/gerrit/56025
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
/external/autotest/client/cros/service_stopper.py
5404fef84c6ac8bc6de4227136c0bc5ba390bd4d 21-May-2013 Todd Broch <tbroch@chromium.org> Revert "Fix bug in service_stopper."

This reverts commit 8b72430b5cf2ba9918377de4149123a256b2fe89.

Change-Id: I9647e3007da8f71c0bf9138c17315ed1632e68e4
Reviewed-on: https://gerrit.chromium.org/gerrit/56024
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
/external/autotest/client/cros/service_stopper.py
8b72430b5cf2ba9918377de4149123a256b2fe89 21-May-2013 Todd Broch <tbroch@chromium.org> Fix bug in service_stopper.

https://gerrit.chromium.org/gerrit/51254 introduced bug into the
service stopper logic where is_stopped was always true.

For example the most likely upstart status strings will create the
following matches for is_stopped:

print 'tcsd start/running, process 507'.find('start/running')
>>> 5
print 'tcsd stop/waiting'.find('start/running')
>>> -1
print 'status: Unknown job: tcsd_bogus'.find('start/running')
>>> -1

Previous change incorrectly assummed find would return 0 for a match
and 1 for not but it should have instead key'd off -1 for no match.

BUG=chrome-os-partner:19561
TEST=hardware_TPMCheck passes

Change-Id: I7042512dd01589949167e5f4687fb850553b1ba4
Reviewed-on: https://gerrit.chromium.org/gerrit/55834
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Mohammed Habibulla <moch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
/external/autotest/client/cros/service_stopper.py
3c89c0984d39e06922da1f29e96688aa2a2e177c 15-May-2013 Todd Broch <tbroch@chromium.org> Ignore requests to stop services that don't exist on a platform.

Some platforms don't support certain services. For example, parrot
does not have bluetooth and therefore no bluetoothd service. Change
allows system call to upstart ( 'stop <service>' ) to fail gracefully
instead of causing an exception.

BUG=chrome-os-partner:18931
TEST=run power_Consumption on parrot

Change-Id: Iaf0e84dc41615aee5316c7e0fc59ea0ea7329182
Reviewed-on: https://gerrit.chromium.org/gerrit/51254
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Reviewed-by: Mohammed Habibulla <moch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
/external/autotest/client/cros/service_stopper.py
b74d224b49cbc205d60b2238593695f3a79f964d 04-Feb-2013 Ryan Harrison <rharrison@chromium.org> Move ServiceStopper out of upstart.py

ServiceStopper needs to import utils to keep it from breaking some of the
autotests that it is used in. This is not allowed in upstart.py per the comment
at the head of the file. This CL moves ServiceStopper to its own file
service_stopper.py and adjusts the affected tests appropriately.

BUG=chromium-os:38544
BUG=chromium-os:38561
TEST=Build and run the affected autotests:
- graphics_SyncControl
- hardware_Backlight
- power_Backlight
- power_BatteryCharge
- power_Consumption
- power_Idle

Change-Id: Icde86185ffd66d399bac10debe3dee7e8d6cf45b
Reviewed-on: https://gerrit.chromium.org/gerrit/42536
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Tested-by: Ryan Harrison <rharrison@chromium.org>
/external/autotest/client/cros/service_stopper.py