History log of /external/autotest/client/common_lib/base_utils_unittest.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e428672caa5230383a6b3d40172d4e6e460d10b9 25-Aug-2015 Filipe Brandenburger <filbranden@chromium.org> autotest: Use sh_quote_word() in base_utils.run()

Use the new shell quoting API in the central run() function.

Update test case that depended on the internal quoting format, so that
it now reflects the sh_quote_word() output. Add a comment to note that
specific test depends on the internal quoting function.

It turns out this broke some cases that were passing a list in the
command argument. The old code was working since it used += which is
accepted by a list, but causes problems if args are passed because they
will be in escaped shell syntax. Fix that by making them uniform, always
converting "command" into a string if necessary. (In hindsight, we
should be doing the opposite, but we can try to address that later.)

BUG=None.
TEST=Ran the base_utils_unittest.py unit tests with no failures.

Change-Id: I5ff8f92671583a236ee38d0da90c890bbb096cc8
Signed-off-by: Filipe Brandenburger <filbranden@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295441
Reviewed-by: Christopher Wiley <wiley@chromium.org>
/external/autotest/client/common_lib/base_utils_unittest.py
b2d1fc137b403edf24d3ef3f6e6d3e409bb33948 25-Aug-2015 Filipe Brandenburger <filbranden@chromium.org> autotest: Introduce new sh_quote_word() API for shell commands.

This new API is meant to eventually replace sh_escape().

While the old sh_escape() API works as expected and seems to cover all
the corner cases, I would argue that the new API is:

1) More complete: Because it returns a term that can be directly used as
a shell word (while sh_escape relies on the caller surrounding it with
double quotes.)

2) Cleaner: Most characters are unaffected, including the dollar sign
and backslash and even the double quote.

The only one that gets affected by quoting is the single quote (granted
though, for the single quote it gets pretty ugly, especially if there is
nesting.)

It is also cleaner in that words that require no quoting will be
returned unquoting, with an optional whitelist to control which
characters are totally safe.

Using single quotes for the automated quoting (with sh_quote_word()) is
also nicer as for literal shell commands, the double quote is more
useful, being used for shell code that uses variables, etc. so it is
easier to reason about having all that code use mostly double quotes and
then be fairly recognizable after going through sh_quote_word().

3) More efficient: It only needs a single scan of the original text,
replcaing a single character. (The sh_escape() approach could be made to
do a single scan using regular expressions, but see points #1 and #2
above.)

Add new unit tests to cover the functionality of sh_quote_word. Inherit
from test_sh_escape to ensure the same tests are run on both. Introduce
a new test class to test nested quoting (quote a command, pass it
through "echo" and run the output through another shell.)

BUG=None.
TEST=Ran the base_utils_unittest.py unit tests with no failures.

Change-Id: I8b7fbce0aaf6a7eaa36ee6bc8bb939b915d903fb
Signed-off-by: Filipe Brandenburger <filbranden@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295440
Reviewed-by: Fang Deng <fdeng@chromium.org>
/external/autotest/client/common_lib/base_utils_unittest.py
df1821be7abe211d5a95a76bbbb9c3f0e757fd24 25-Aug-2015 Filipe Brandenburger <filbranden@chromium.org> autotest: Cleanup after logging.warn -> logging.warning

There were some small issues which were probably introduced after
replacing logging.warn() calls with logging.warning().

In particular, line wrapping was incorrect in a few places, since line
continuations needed to be indented three extra spaces. In one place,
this bumped the line over 80 columns, so the string had to be rewrapped
as well.

Test cases were still stubbing logging.warn (so logging.warning was not
mocked, producing some noise in the output of test cases), after
correcting it to stub logging.warning, it was clear that some spots were
not marked as expecting a call, so I added those as well.

BUG=None.
TEST=Ran the base_utils_unittest.py unit tests with no failures.
Also confirmed that the test run did not produce any warning output,
only the "dots" indicating progress with a final report summary
("Ran 91 tests in 2.151s" and the "OK" line.)

Change-Id: I632a59b43d885c7aad8ec2d2083abba08e232279
Signed-off-by: Filipe Brandenburger <filbranden@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295399
Reviewed-by: Christopher Wiley <wiley@chromium.org>
/external/autotest/client/common_lib/base_utils_unittest.py
d84e18ffa85a603e735663cdabca3b5a40c5800c 14-Aug-2014 Prashanth B <beeps@google.com> [autotest] Prevent signals from interrupting bgjob select polling.

We monitor the progress of a bg job by select polling. If the process
has a signal handler setup to ignore a signal like sigterm (which
upstart sends by default) and it's waiting on a background job, it
will still die because the select system call was interrupted thereby
raising an exception.

This cl enables processes that monitor bgjobs to decide if the
polling should continue through the signal handler.

TEST=Sent signals mid-poll and confirmed that polling continues.
Added a unittest for the same.
BUG=chromium:403495

Change-Id: I26630b5cc3c980ffd2768b2c69c9eb6af44f0acf
Reviewed-on: https://chromium-review.googlesource.com/212376
Tested-by: Prashanth B <beeps@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Prashanth B <beeps@chromium.org>
/external/autotest/client/common_lib/base_utils_unittest.py
04be2bd5e4666a5c253e9c30ab20555e04286032 08-May-2014 Ilja H. Friedel <ihf@chromium.org> Autotest: Change logging.warn() to logging.warning().

logging.warn() is deprecated. See
http://bugs.python.org/issue13235

Substitution was performed via
~/cros/src/third_party/autotest/files$ find ./ -type f | xargs sed -i 's/logging.warn(/logging.warning(/'

BUG=None.
TEST=There should be one-- and preferably only one --obvious way to do it.

Change-Id: Ie5665743121a49f7fbd5d1f47896a7c65e87e489
Reviewed-on: https://chromium-review.googlesource.com/198793
Commit-Queue: Ilja Friedel <ihf@chromium.org>
Tested-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: Alex Miller <milleral@chromium.org>
/external/autotest/client/common_lib/base_utils_unittest.py
e1e4f2295e949b89961938167ea622dd51053151 23-Oct-2013 Fang Deng <fdeng@chromium.org> [autotest] platform_BootPerfServer uploads perf data to new perf dashboard

Read the perf data from keyval file. Call output_perf_value()
to upload the perf data to chromeos perf dashboard.

Uploading is controlled by a tag 'upload_perf' passed from control file.
Only control.perfalearts will be uploading perf data.

Also make client/common_lib/base_utils:read_keyval
respect type_tag in the key noted in '{}', e.g. 'seconds_reboot_time{perf}'.

BUG=chromium:280634;chromium:314167
TEST=Ran the test locally, confirmed that the file "perf_measurements"
with correct perf data was outputted to the result dir.
run_suite works with dummy suite.

Change-Id: Iaf17872467dedb72878c43e563caa28cdadc9b5d
Reviewed-on: https://chromium-review.googlesource.com/175507
Tested-by: Fang Deng <fdeng@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Fang Deng <fdeng@chromium.org>
/external/autotest/client/common_lib/base_utils_unittest.py
861b2d54aec24228cdb3895dbc40062cb40cb2ad 04-Feb-2011 Eric Li <ericli@chromium.org> Merge remote branch 'cros/upstream' into master

Merged to upstream autotest @4749~@5215.

The entire change list description is too big to enlist here. Please refer to upstream (http://autotest.kernel.org/browser) for more details.

BUG=
TEST=emerged both x86 and arm build.
Tested emerged x86 build bvt against a chromeos device.

Review URL: http://codereview.chromium.org/6246035

Change-Id: I8455f2135c87c321c6efc232e2869dc8f675395e
/external/autotest/client/common_lib/base_utils_unittest.py
bdaab795cffa33f9a37995bb283047cb03699272 07-Jan-2011 Kenneth Waters <kwaters@chromium.org> Revert "Merge remote branch 'cros/upstream' into autotest-rebase"

This reverts commit 7edb30498d75a29a3287fe07070f2b51a116c5d4.

TEST=Built for tegra2_seaboard
BUG=10756

Review URL: http://codereview.chromium.org/6124004

Change-Id: Ifcd1a2279f5a62b99552a8f961c1430889a3a928
/external/autotest/client/common_lib/base_utils_unittest.py
7edb30498d75a29a3287fe07070f2b51a116c5d4 07-Jan-2011 Eric Li <ericli@chromium.org> Merge remote branch 'cros/upstream' into autotest-rebase

Merged to upstream trunk@5066, from trunk@4749.

There is no way I could enlist each individual CL from the upstream here since it will blow up the changelist description field.

BUG=
TEST=
Had patched this CL into a fresh cut client to avoid any side effect.
run_remote_test bvt from both emerged location and third_party/autotest/file.

Both test passed!

We should also keep any eye on this to see how it gets propagated into cautotest server.
TBR=dalecurtis

Change-Id: I72f2bc7a9de530178484aea1bfb5ace68bcad029
/external/autotest/client/common_lib/base_utils_unittest.py