1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-19 04:21:17 +00:00

AndroidDevice: WA now pushes its own sqlite3 binary

Some device have the sqlite3 binary removed. WA will now check for
this and push its own binary if necessary.
This commit is contained in:
Sebastian Goscik 2016-05-09 16:10:02 +01:00
parent d3c7f11f2d
commit 59cfd7c757
6 changed files with 41 additions and 2 deletions

View File

@ -24,6 +24,8 @@ import threading
from subprocess import CalledProcessError
from wlauto.core.extension import Parameter
from wlauto.common.resources import Executable
from wlauto.core.resource import NO_ONE
from wlauto.common.linux.device import BaseLinuxDevice, PsEntry
from wlauto.exceptions import DeviceError, WorkerThreadError, TimeoutError, DeviceNotRespondingError
from wlauto.utils.misc import convert_new_lines
@ -193,6 +195,7 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
self._is_ready = True
def initialize(self, context):
self.sqlite = self.deploy_sqlite3(context) # pylint: disable=attribute-defined-outside-init
if self.is_rooted:
self.disable_screen_lock()
self.disable_selinux()
@ -529,6 +532,11 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
return props[prop]
return props
def deploy_sqlite3(self, context):
host_file = context.resolver.get(Executable(NO_ONE, self.abi, 'sqlite3'))
target_file = self.install_if_needed(host_file)
return target_file
# Android-specific methods. These either rely on specifics of adb or other
# Android-only concepts in their interface and/or implementation.
@ -629,7 +637,7 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
"""
lockdb = '/data/system/locksettings.db'
sqlcommand = "update locksettings set value='0' where name='screenlock.disabled';"
self.execute('sqlite3 {} "{}"'.format(lockdb, sqlcommand), as_root=True)
self.execute('{} {} "{}"'.format(self.sqlite, lockdb, sqlcommand), as_root=True)
def disable_selinux(self):
# This may be invoked from intialize() so we can't use execute() or the

Binary file not shown.

Binary file not shown.

View File

@ -207,7 +207,7 @@ class Gem5AndroidDevice(BaseGem5Device, AndroidDevice):
"""
lockdb = '/data/system/locksettings.db'
sqlcommand = "update locksettings set value=\'0\' where name=\'screenlock.disabled\';"
self.execute('sqlite3 {} "{}"'.format(lockdb, sqlcommand), as_root=True)
self.execute('{} {} "{}"'.format(self.sqlite, lockdb, sqlcommand), as_root=True)
def capture_screen(self, filepath):
if BaseGem5Device.capture_screen(self, filepath):

11
wlauto/external/sqlite/README vendored Normal file
View File

@ -0,0 +1,11 @@
For WA we use a slightly modified version of sqlite3 so that it can
be built statically. We used the amalgamated sqlite3 version 3.12.2.
which is under the public domain.
https://www.sqlite.org/download.html
Build command:
gcc shell.c sqlite3.c -lpthread -ldl -static -O2 -fPIC -DPIC -DSQLITE_OMIT_LOAD_EXTENSION
You will need to apply the diff in static.patch

20
wlauto/external/sqlite/static.patch vendored Normal file
View File

@ -0,0 +1,20 @@
--- shell.c 2016-05-09 15:35:26.952309563 +0100
+++ shell.c.bak 2016-05-09 15:33:41.991259588 +0100
@@ -4503,7 +4503,7 @@
static char *home_dir = NULL;
if( home_dir ) return home_dir;
+/*#if !defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) \
-#if !defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) \
&& !defined(__RTP__) && !defined(_WRS_KERNEL)
{
struct passwd *pwent;
@@ -4512,7 +4512,7 @@
home_dir = pwent->pw_dir;
}
}
+#endif*/
-#endif
#if defined(_WIN32_WCE)
/* Windows CE (arm-wince-mingw32ce-gcc) does not provide getenv()