Skip to content

Commit a1bc126

Browse files
committed
Add a new scenario folder named genericandroidstartup and updated the android startup scenarios doc to use it.
1 parent c72d44a commit a1bc126

File tree

4 files changed

+71
-3
lines changed

4 files changed

+71
-3
lines changed

docs/android-startup-scenarios.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
. ./init.sh # or `.\init.ps1` on Windows. Can specify custom dotnet install with -dotnetdir <dir>, but dotnet install should not impact Android Startup testing itself.
1919
```
2020

21-
2. Navigate to the `helloandroid` scenario directory:
21+
2. Navigate to the `genericandroidstartup` scenario directory:
2222

2323
```sh
24-
cd helloandroid
24+
cd genericandroidstartup
2525
```
2626

27-
3. Copy the APK into the `helloandroid` directory.
27+
3. Copy the APK into the `genericandroidstartup` directory.
2828
4. Run the test:
2929

3030
```sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'''
2+
post cleanup script
3+
'''
4+
5+
from shared.postcommands import clean_directories
6+
7+
clean_directories()
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
'''
2+
pre-command
3+
'''
4+
import sys
5+
import os
6+
from zipfile import ZipFile
7+
from performance.logger import setup_loggers, getLogger
8+
from shutil import copyfile
9+
from shared.precommands import PreCommands
10+
from shared.const import PUBDIR
11+
from argparse import ArgumentParser
12+
13+
setup_loggers(True)
14+
15+
parser = ArgumentParser()
16+
parser.add_argument('--unzip', help='Unzip APK and report extracted tree', action='store_true', default=False)
17+
parser.add_argument(
18+
'--apk-name',
19+
dest='apk',
20+
required=True,
21+
type=str,
22+
help='Name of the APK to setup (with .apk)')
23+
args = parser.parse_args()
24+
25+
if not os.path.exists(PUBDIR):
26+
os.mkdir(PUBDIR)
27+
apkname = args.apk
28+
apknamezip = '%s.zip' % (apkname)
29+
if not os.path.exists(apkname):
30+
getLogger().error('Cannot find %s' % (apkname))
31+
exit(-1)
32+
if args.unzip:
33+
if not os.path.exists(apknamezip):
34+
copyfile(apkname, apknamezip)
35+
36+
with ZipFile(apknamezip) as zip:
37+
zip.extractall(os.path.join('.', PUBDIR))
38+
39+
assets_dir = os.path.join(PUBDIR, 'assets')
40+
assets_zip = os.path.join(assets_dir, 'assets.zip')
41+
with ZipFile(assets_zip) as zip:
42+
zip.extractall(assets_dir)
43+
44+
os.remove(assets_zip)
45+
else:
46+
copyfile(apkname, os.path.join(PUBDIR, apkname))
47+
48+
49+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'''
2+
C# Console app
3+
'''
4+
from shared.runner import TestTraits, Runner
5+
6+
EXENAME = 'GenericAndroidStartup'
7+
8+
if __name__ == "__main__":
9+
traits = TestTraits(exename=EXENAME,
10+
guiapp='false',
11+
)
12+
Runner(traits).run()

0 commit comments

Comments
 (0)