Commit Graph

31 Commits

Author SHA1 Message Date
David James
4e098db36f Close fds in RunCommand to prevent children from inheriting file handles.
RunCommand should only pass in stdin, stdout, and stderr to processes,
not other file handles. Fixing this prevents issues where child
processes can cause the parent to hang by forgetting to close the
file handle when launching daemons.

BUG=chromium-os:18104
TEST=Buildbot run with smoke suite. Unit tests.

Change-Id: Ib85095e1fb592ef05a972a5412348363049e6d86
Reviewed-on: http://gerrit.chromium.org/gerrit/4673
Reviewed-by: Brian Harring <ferringb@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2011-07-25 13:31:30 -07:00
Chris Sosa
237b686be8 Arbitrarily large output can't be used in an exception.
It seems like we are seeing whacky errors with sys.stderr
dying when trying to print out a process and its exception.
I think controlling how the output is printed in RunCommand
is better than passing it with the exception.

Change-Id: I3711575e5d9e710c3aea6ff19d43d149fd83f44c

BUG=chromium-os:14398
TEST=Ran it with au_test_harness

Review URL: http://codereview.chromium.org/6902129
2011-04-28 15:29:12 -07:00
Chris Sosa
c894a0a0a0 Add combine_stdout_stderr as well as make success less verbose.
Change-Id: If46fd1558a00498ce4721dd756532e916f49bc19

BUG=chromium-os:12950
TEST=Ran with autestharness and ran unittests.

Review URL: http://codereview.chromium.org/6877015
2011-04-18 17:19:10 -07:00
Chris Sosa
0d5e4ae006 Add better support for getting the path to crosutils.
Change-Id: I83a56ee38d8d666d3b71b4dc323e26076fab7d96

BUG=chromium-os:13498
TEST=Ran unittests.

Review URL: http://codereview.chromium.org/6765001
2011-03-30 11:22:17 -07:00
Chris Sosa
8d7caa720a Remove au_test_harness code and change symlinks to point to new location
Change-Id: I55a198e09ceac1e05b766864dbc920bfaedffb1f

BUG=chromium-os:11172
TEST=Tested ctest and cros_au_test_harness running from src/scripts
with buildbot params.

Review URL: http://codereview.chromium.org/6717011
2011-03-22 13:17:39 -07:00
Chris Sosa
31b641ec3c Remove test keys from images we test with in the test harness.
Cleaned up _InsertKeyIntoImage to be more general (able to remove key if no key set).  Also made it much more intelligent ... only doing things when it needs to.

Moved mount / unmount code to cros_lib.

BUG=chromium-os:12684
TEST=Ran it a lot ... inspected images after and saw tests pass.

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

Change-Id: Icd96d1178eeabf45a2d5916fbcab8bf7ffba7e21
2011-03-16 16:07:32 -07:00
Chris Sosa
bc4c1574d0 Add logs for update_engine, devserver, and cros_run_vm_update to test artifacts.
Change-Id: Ib5617612be38bb6d7dafcb2edab887c998a676ab

BUG=chromium-os:12951
TEST=Ran it with Simple.  Saw logs generated (1_update) and in root/dev_server.log.  Ran unittests for cros_build_lib.

Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=f53a8c7

Review URL: http://codereview.chromium.org/6672007
2011-03-14 13:21:16 -07:00
Chris Sosa
0cc50a4077 Revert "Add logs for update_engine, devserver, and cros_run_vm_update to test artifacts."
This reverts commit f53a8c769b.

TBR=dgarret: revert CL to open tree

Change-Id: I03f80c715e9724f0759edcbeb9535948c9316200
2011-03-11 16:17:50 -08:00
Chris Sosa
f53a8c769b Add logs for update_engine, devserver, and cros_run_vm_update to test artifacts.
Change-Id: Ib5617612be38bb6d7dafcb2edab887c998a676ab

BUG=chromium-os:12951
TEST=Ran it with Simple.  Saw logs generated (1_update) and in root/dev_server.log.  Ran unittests for cros_build_lib.

Review URL: http://codereview.chromium.org/6672007
2011-03-11 15:42:31 -08:00
Don Garrett
e1b78a7efd Reintroduce RunCommand cleanup and unit tests. Fixed previous issue in which exceptions were thrown if exit_code was set, and added a new unittest to prove that.
This reintroduces the change after commit 3635aaa55e, which reverted 01c8423582.

BUG=chromium-os:11717
TEST=Ran new unit tests, and did full build.

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

Change-Id: I598e459ddaa156af47d47d0482cac16ce44f07a4
2011-03-01 14:22:41 -08:00
Luigi Semenzato
3635aaa55e Revert "RunCommand was catching and rethrowing an exception, which seemed to generate"
This reverts commit 01c8423582.

BUG=chromium-os:11717
TEST=none

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

Change-Id: I4e66e7b2fcf01a4cb35557bdf208f990e6d8eb2b
2011-02-23 19:14:53 -08:00
Don Garrett
01c8423582 RunCommand was catching and rethrowing an exception, which seemed to generate
extra noise in the final exception output.

This change stops catching and rethrowing the same exception, and generally
makes the RunCommand slightly more readable (if longer).

Some unit tests are added, but they only test RunCommand, and not all options
to RunCommand.

BUG=chromium-os:11717
TEST=Manual, and new lib/cros_build_lib_unittest

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

Change-Id: Ibe9b13ff302621e93196008f86914cb65a232d61
2011-02-23 17:36:52 -08:00
Zdenek Behan
18d5703fd7 scripts: use /sbin/ifconfig where appropriate
BUG=n0ne
TEST=cros_au_test_harness

Change-Id: Ic26cc191fdb995b091d910f1c8a46e37085fea72

Review URL: http://codereview.chromium.org/6538067
2011-02-19 00:36:23 +01:00
Zdenek Behan
c264a45ba8 au_test_harness: fix a function call, add sudo in front of ifconfig
Note: sudo before ifconfig is for running on distros which do not
have /sbin or /usr/sbin in common user's paths, like gentoo.

Change-Id: I85bd379ad059d6ecaa8c11f3167fae27987479dd

BUG=5246
TEST=run cros_au_test_harness and see it not fail

Review URL: http://codereview.chromium.org/6541008
2011-02-18 06:06:55 +01:00
Chris Sosa
f2ee5f6871 Passes cache location to tests and runs the tests in parallel.
As a warning, this is a pretty big change.  At a high-level,
this changes the harness to move the managing of the devserver from
image_to_live into the actual test harness.  Paths of the cache locations (for
archive_url) are taken when pre-generating the updates and stored
in a dictionary (maps "path_to_base->path_to_target" (or path for full updates)->
cache paths).

This change also has the tests run in parallel.  Because we now start
X number of VM's at once, each VM needs it's own pid file and ssh_port.
This logic was added as well as running the actual tests in parallel.

Change-Id: I1275d79740c50c2a8028489b43dcbbcf5bbd56c4

BUG=chromium-os:10723
TEST=Ran it ... a lot with -q but without a test_prefix (so full test suite).

Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=c418a8f

Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=be787f3

Review URL: http://codereview.chromium.org/6277015
2011-01-26 11:38:14 -08:00
Chris Sosa
404bfdf073 Revert "Passes cache location to tests and runs the tests in parallel."
This reverts commit be787f3525.

Revert "Fix sudo again."

This reverts commit 0f411ec7d9.

TBR dgarrett

BUG=
TEST=

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

Change-Id: I2fb9ca4967ff173c17840b96eb68b02ff2b7774a
2011-01-25 18:16:55 -08:00
Chris Sosa
be787f3525 Passes cache location to tests and runs the tests in parallel.
As a warning, this is a pretty big change.  At a high-level,
this changes the harness to move the managing of the devserver from
image_to_live into the actual test harness.  Paths of the cache locations (for
archive_url) are taken when pre-generating the updates and stored
in a dictionary (maps "path_to_base->path_to_target" (or path for full updates)->
cache paths).

This change also has the tests run in parallel.  Because we now start
X number of VM's at once, each VM needs it's own pid file and ssh_port.
This logic was added as well as running the actual tests in parallel.

Change-Id: I1275d79740c50c2a8028489b43dcbbcf5bbd56c4

BUG=chromium-os:10723
TEST=Ran it ... a lot with -q but without a test_prefix (so full test suite).

Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=c418a8f

Review URL: http://codereview.chromium.org/6277015
2011-01-25 17:16:56 -08:00
Chris Sosa
27729c7dbf Revert "Passes cache location to tests and runs the tests in parallel."
This reverts commit c418a8fce7.

TBR=open tree

Change-Id: I471d186fca9084fd18858998b4bcf8cb1de19f14
2011-01-25 15:12:39 -08:00
Chris Sosa
c418a8fce7 Passes cache location to tests and runs the tests in parallel.
As a warning, this is a pretty big change.  At a high-level,
this changes the harness to move the managing of the devserver from
image_to_live into the actual test harness.  Paths of the cache locations (for
archive_url) are taken when pre-generating the updates and stored
in a dictionary (maps "path_to_base->path_to_target" (or path for full updates)->
cache paths).

This change also has the tests run in parallel.  Because we now start
X number of VM's at once, each VM needs it's own pid file and ssh_port.
This logic was added as well as running the actual tests in parallel.

Change-Id: I1275d79740c50c2a8028489b43dcbbcf5bbd56c4

BUG=chromium-os:10723
TEST=Ran it ... a lot with -q but without a test_prefix (so full test suite).

Review URL: http://codereview.chromium.org/6277015
2011-01-25 13:49:29 -08:00
Don Garrett
3343f56b77 Add a verbose option to RunCommandCaptureOutput. Not used yet, does not
dump output until after the command has finished, so not useful for
following 'live'.

Change-Id: Ia8562f5e6f8d7ed8af7e188faa68f5cdbba487c6

BUG=chromium-os:11164
TEST=None

Review URL: http://codereview.chromium.org/6296013
2011-01-21 16:06:51 -08:00
Don Garrett
83d063b670 Pass along RunCommandException correctly. This is a minor
fix, but it leads to better error messages from ctest.

Change-Id: I624ad805ef037b022e6e67b56f0ed10ca05fe325

BUG=11096
TEST=Test currently in progress.

Review URL: http://codereview.chromium.org/6257007
2011-01-20 11:44:41 -08:00
Chris Sosa
53ac954a36 Add some desired options to the au test harness.
Adds verbose flag to print output while updates are running rather than on error.
Adds test_prefix to specify a prefix of tests you want to run
Flushes stderr more reliably for builders and debugging purposes
Dies when stateful_updates fail

Change-Id: I9e4289deec3688c52b92763eee9334a8868f948e

BUG=chromium-os:6910
TEST=Ran with test_prefix and verbose on and off

Review URL: http://codereview.chromium.org/5573007
2010-12-09 11:29:31 -08:00
Don Garrett
cd33866c89 Add RunCommandCaptureOutput as a helper method.
It's like RunCommand, but you can run the command, capture it's error code and output together.

This is to support tests that need to capture output of image_to_live, and to know if it succeeded.

Change-Id: If674b6d79697c0f0b5c96be9fc83adbed9b9893e

BUG=chromium-os:9502
TEST=Ran by hand

Review URL: http://codereview.chromium.org/5339006
2010-11-29 13:30:42 -08:00
Thieu Le
ac13647eda Change _ArchiveTestResults to upload to Google Storage
BUG=chromium-os:8364
TEST=

Change-Id: Icecc8268fa2c12c8413caa2879785f00e4be5a0a

Review URL: http://codereview.chromium.org/4864001
2010-11-24 10:42:32 -08:00
David James
d87170bb7b Fix infinite loop when FindRepoDir argument is a relative path.
This bug doesn't affect production but affects the unit tests.

BUG=chromium-os:9201
TEST=Confirmed this fixes an infinite loop in the unit tests, and that
    cbuildbot.py still works.

Change-Id: I1a56b92d8229110c84cebbe877e55fb99f053212

Review URL: http://codereview.chromium.org/5025002
2010-11-15 18:57:19 -08:00
David James
b49c6df754 Add more error checking to preflight queue.
What's new?
  - cros_mark_as_stable now exits with errors if directories are specified
    that don't exist.
  - cbuildbot.py always explicitly specifies overlay directories so
    cros_mark_as_stable can rely on them existing.
  - Package names and paths are now separated with colons instead of
    spaces, so as to allow for us using the same syntax with
    enter_chroot.sh as we use without the same script. (enter_chroot.sh
    mucks with command-lines that contain spaces or quotes.)
  - cbuildbot.py now ensures its build path is a absolute path. This ensures we don't kill the wrong processes, if, for instance, the buildpath is '../..'
  - All buildbots now explicitly specify what overlays they want to rev. Public buildbots only rev public ebuilds and private buildbots now only rev private ebuilds.

BUG=chromium-os:8647
TEST=Ran unit tests. Manually marked packages as stable. Ran cbuildbot.py test run.

Change-Id: I1df6d428973d91329c4f5159e2886889a3ebb7c7

Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=795bd30

Review URL: http://codereview.chromium.org/4442001
2010-11-15 13:06:42 -08:00
Chris Sosa
aa4670315b Fix equals in RunCommand's in cbuildbot.
Change-Id: If8cdde42a470c3d07cfd41552cf95dea7567688b

BUG=
TEST=Ran cbuildbot.

Review URL: http://codereview.chromium.org/3967002
2010-10-21 10:54:02 -07:00
Chris Sosa
af33f8f8ae Add board option to au test harness so that this works for others without a default board and add ability to reference images without relative paths.
Change-Id: I4afa86fa7a6b772124de56114910a1ca5e3d4511

BUG=
TEST=Ran through update harness code and ran loman.

Review URL: http://codereview.chromium.org/3612004
2010-10-04 18:19:29 -07:00
Chris Sosa
c2db26c796 Add methods to run vm tests on x86-pre-flight-queue.
Right now we're leaving error_ok=True until the tests are shown to work on builder.

Change-Id: I6b8c690a0da30948389fd4312032c78d87115364

BUG=6906
TEST=Ran through it locally.

Review URL: http://codereview.chromium.org/3591002
2010-09-30 14:25:25 -07:00
Chris Sosa
e13960240b Fix cleanup so we don't have to clobber as much when failures occur
Change-Id: I120c49a38d2a17a2216296a68378fee7345f616a

TBR=petkov

Review URL: http://codereview.chromium.org/3255004
2010-08-30 22:37:28 -07:00
Chris Sosa
70e2c9e72a Move RunCommand, and Info/Warning/Die into common pylib
TEST=Ran all commands that used RunCommand or Die with
their associated unittests.

Review URL: http://codereview.chromium.org/3266004
2010-08-30 11:05:50 -07:00