Fix piglit to install on all x86 boards
This adds a function to utils which tests the compiled output and
determines if the target is x86. This function is then used by the
piglit code to determine if it should be installed or not.
BUG=chrome-os-partner:7942
TEST=`emerge-x86-mario autotest autotest-deps-piglit` installs piglit
TEST=`emerge-lumpy autotest autotest-deps-piglit` installs piglit
Change-Id: I074ab1991f3c6b8d30e6cf94846d87e6158b0ee3
Reviewed-on: https://gerrit.chromium.org/gerrit/15467
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
Reviewed-by: Stuart Abercrombie <sabercrombie@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Ready: Sonny Rao <sonnyrao@chromium.org>
diff --git a/client/bin/site_utils.py b/client/bin/site_utils.py
index e3963cd..5e3e42e 100644
--- a/client/bin/site_utils.py
+++ b/client/bin/site_utils.py
@@ -207,6 +207,27 @@
else:
return False
+def target_is_x86():
+ """Returns whether the toolchain produces an x86 object
+
+ Arguments:
+ None
+
+ Returns:
+ True if the target toolchain produces an x86 object
+ False otherwise.
+ """
+
+
+ command = "echo \"int main(){return 0;}\" | ${CC} -o /tmp/a.out -xc -"
+ command += "&& file /tmp/a.out"
+ result = utils.system_output(command, retain_output=True,
+ ignore_status=True)
+ if re.search("80\d86", result) or re.search("x86-64", result):
+ return True
+ else:
+ return False
+
def mounts():
ret = []
for line in file('/proc/mounts'):