Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfb3debd

Browse files
author
Anton Pogonets
committed
Add test runner
1 parent2ed6d9e commitfb3debd

File tree

2 files changed

+63
-2
lines changed

2 files changed

+63
-2
lines changed

‎src/main/scripts/create_scripts.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,16 @@ rm -f *Unittest*
193193
194194
SCRIPT
195195

196+
cat<<SCRIPT >run-tests.sh &&
197+
#!/bin/bash
198+
199+
export SWIFT_INSTALL="$SWIFT_INSTALL"
200+
~/.gradle/scripts/run-tests.py
201+
SCRIPT
202+
196203
cp$SRC_SCRIPTS_DIR/collect-dependencies.py$SCRIPTS/&&
197-
chmod +x {generate-swift,swift-build,swiftc-android,copy-libraries}.sh&&
198-
echo Created:$SCRIPTS/{generate-swift,swift-build,swiftc-android,copy-libraries}.sh&&
204+
cp$SRC_SCRIPTS_DIR/run-tests.py$SCRIPTS/&&
205+
206+
chmod +x {generate-swift,swift-build,swiftc-android,copy-libraries,run-tests}.sh&&
207+
echo Created:$SCRIPTS/{generate-swift,swift-build,swiftc-android,copy-libraries,run-tests}.sh&&
199208
echo

‎src/main/scripts/run-tests.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env python
2+
3+
from __future__importprint_function
4+
5+
importos
6+
importsys
7+
importsubprocess
8+
importjson
9+
importglob
10+
importplatform
11+
fromos.pathimportexpanduser
12+
13+
14+
SWIFT_INSTALL=os.getenv("SWIFT_INSTALL")
15+
16+
defextract_tests_package(json):
17+
returnjson["name"]+"PackageTests.xctest"
18+
19+
defpush(dst,name):
20+
adb_shell(["mkdir","-p",dst])
21+
22+
adb_push(dst,glob.glob(SWIFT_INSTALL+"/usr/lib/swift/android/*.so"))
23+
adb_push(dst,glob.glob(".build/debug/*.so"))
24+
adb_push(dst, [".build/debug/"+name])
25+
26+
defadb_push(dst,files):
27+
subprocess.call(["adb","push"]+files+ [dst])
28+
29+
defadb_shell(args):
30+
returnsubprocess.call(["adb","shell"]+args)
31+
32+
defexec_tests(folder,name):
33+
ld_path="LD_LIBRARY_PATH="+folder
34+
test_path=folder+"/"+name
35+
36+
returnadb_shell([ld_path,test_path]+sys.argv[1:])
37+
38+
39+
defrun(json):
40+
subprocess.call([expanduser("~/.gradle/scripts/swift-build.sh"),"--build-tests"])
41+
42+
name=extract_tests_package(package_json)
43+
folder="/data/local/tmp/"+name.split(".")[0]
44+
45+
push(folder,name)
46+
returnexec_tests(folder,name)
47+
48+
package_dump=subprocess.check_output(["swift","package","dump-package"])
49+
package_json=json.loads(package_dump)
50+
51+
return_code=run(package_json)
52+
sys.exit(return_code)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp