aboutsummaryrefslogtreecommitdiffstats
path: root/libacc/tests
diff options
context:
space:
mode:
authorJack Palevich <jackpal@google.com>2009-09-10 12:45:31 -0700
committerJack Palevich <jackpal@google.com>2009-09-10 12:45:31 -0700
commitbb3e9c181480537fed32c6bba83fd1807de70e16 (patch)
treef10cc0b27add3c846192ce27ecde66293653c53d /libacc/tests
parentd30a2ce2440f1eaf495c04c3b184959310a8da0a (diff)
downloadsystem_core-bb3e9c181480537fed32c6bba83fd1807de70e16.tar.gz
system_core-bb3e9c181480537fed32c6bba83fd1807de70e16.tar.bz2
system_core-bb3e9c181480537fed32c6bba83fd1807de70e16.zip
Add a script "accarm" for ad-hoc testing of the ARM acc compiler.
This script copies the test file over to the ARM, runs the acc compiler on ARM, and then prints out the results. It also syncs the acc compiler binary over to the ARM.
Diffstat (limited to 'libacc/tests')
-rwxr-xr-xlibacc/tests/accarm69
1 files changed, 69 insertions, 0 deletions
diff --git a/libacc/tests/accarm b/libacc/tests/accarm
new file mode 100755
index 00000000..6b1bf663
--- /dev/null
+++ b/libacc/tests/accarm
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+#
+# Run a test on the ARM version of acc.
+
+import unittest
+import subprocess
+import os
+import sys
+
+def compile(args):
+ proc = subprocess.Popen(["acc"] + args, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
+ result = proc.communicate()
+ return result
+
+def runCmd(args):
+ proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ result = proc.communicate()
+ return result[0].strip()
+
+def uname():
+ return runCmd(["uname"])
+
+def unameM():
+ return runCmd(["uname", "-m"])
+
+def which(item):
+ return runCmd(["which", item])
+
+def adb(args):
+ return runCmd(["adb"] + args)
+
+def setupArm(file):
+ print "Setting up arm"
+ adb(["remount"])
+ adb(["shell", "rm", "/system/bin/acc"])
+ adb(["shell", "mkdir", "/system/bin/accdata"])
+ adb(["shell", "mkdir", "/system/bin/accdata/data"])
+
+ remoteFileName = os.path.join("/system/bin/accdata", file)
+ adb(["push", file, remoteFileName])
+
+ # Copy over compiler
+ adb(["sync"])
+ return remoteFileName
+
+def compileArm(args):
+ remoteArgs = []
+ fileName = ""
+ for arg in sys.argv[1:]:
+ if arg.startswith('-'):
+ remoteArgs.append(arg)
+ else:
+ fileName = arg
+
+ remoteFileName = setupArm(fileName)
+ remoteArgs.append(remoteFileName)
+ remoteCmdLine = ["adb", "shell", "/system/bin/acc"] + remoteArgs
+ proc = subprocess.Popen(remoteCmdLine, stdout=subprocess.PIPE)
+ result = proc.communicate()
+ return result[0].replace("\r","")
+
+
+def main():
+ print compileArm(sys.argv[1:])
+
+if __name__ == '__main__':
+ main()
+
+