Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Issue 6849042: Introduce crossystem wrapper in SAFT. (Closed)

Created:
9 years, 8 months ago by vb
Modified:
9 years, 6 months ago
Reviewers:
Randall Spangler
CC:
chromium-os-reviews_chromium.org
Visibility:
Public.

Description

Introduce crossystem wrapper for SAFT. There has been an effort under way to abstract platform specific information through the 'crossystem' utility, which is capable of discovering information in platform specific fashion and representing it in a unified way on all platforms. The BIOS ACPI on some platforms has been modified to support this, which of course broke SAFT completely. This CL introduces a wrapper for crossystem to derive all necessary information in a target independent way and emulate information previously read directly from ACPI. The actual SAFT fix will come in the next CL. The 'crossystem' wrapper is a class which runs the crossystem utility to retrieve or set the crossystem parameters.. The __getattr__() method override is used to get the value of an arbitrary crossystem parameter, so that crossystem.name causes the shell command 'crossystem name' invocation to retrieve the value of parameter 'name'. The __setattr__() method override is used to set the crossystem parameters, such that assigning crossystem.name = value causes a shell command 'crossystem "name=value"' to be invoked. The only name not passed to the shell command, but set directly is 'cros_if', which is a member of the crossystem wrapper class. Change-Id: I59b547d899598501185a443cf2cffcc00330b37c BUG=chrome-os-partner:2617 TEST=on the workstation: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv es^o: home/vbendeb/projects/1repo/src/platform/saft 119 > ./runtests.sh .... ---------------------------------------------------------------------- Ran 4 tests in 0.032s OK ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=c034073

Patch Set 1 : Adapt to using crossystem. #

Patch Set 2 : Do not cache crossystem output. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+241 lines, -42 lines) Patch
M chromeos_interface.py View 1 7 chunks +135 lines, -36 lines 1 comment Download
M runtests.sh View 4 chunks +21 lines, -3 lines 0 comments Download
M test_chromeos_interface.py View 1 2 chunks +85 lines, -3 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
vb
9 years, 8 months ago (2011-04-15 21:53:49 UTC) #1
vb
On 2011/04/15 21:53:49, vb wrote: Randal, as per our face to face discussion, I changed ...
9 years, 8 months ago (2011-04-18 17:59:39 UTC) #2
Randall Spangler
LGTM http://codereview.chromium.org/6849042/diff/9002/chromeos_interface.py File chromeos_interface.py (right): http://codereview.chromium.org/6849042/diff/9002/chromeos_interface.py#newcode34 chromeos_interface.py:34: return self.cros_if.run_shell_command_get_output( What happens if crossystem exits non-zero ...
9 years, 8 months ago (2011-04-18 20:42:54 UTC) #3
vb
9 years, 8 months ago (2011-04-18 20:50:43 UTC) #4
On Mon, Apr 18, 2011 at 1:42 PM,  <rspangler@chromium.org> wrote:
> LGTM
>
>
> http://codereview.chromium.org/6849042/diff/9002/chromeos_interface.py
> File chromeos_interface.py (right):
>
>
http://codereview.chromium.org/6849042/diff/9002/chromeos_interface.py#newcode34
> chromeos_interface.py:34: return
> self.cros_if.run_shell_command_get_output(
> What happens if crossystem exits non-zero (for example, if you access a
> non-existent attribute)?
>

An exception is raised in case the shell command returns nonzero
value. I will add a test case for this in the upcoming CL (which
restores SAFT functionality).

cheers,
/v
> http://codereview.chromium.org/6849042/
>



-- 
Vadim Bendebury (mailto:vbendeb@google.com)
Google ChromeOS - (650) 253-7486

Powered by Google App Engine
This is Rietveld 408576698