update integrationTest for android Q preview

pull/31/head
cfig 6 years ago
parent c7e46c537d
commit 3dd9f1e685
No known key found for this signature in database
GPG Key ID: B104C307F0FDABB7

@ -23,7 +23,7 @@ Supported images:
(2) These utilities are known to work for Nexus/Pixel boot.img for the following Android releases:
- AOSP master
- Lollipop (5.0) - Pie (9)
- Lollipop (5.0) - Q preview
## 2. Usage
Put your boot.img to current directory, then start gradle 'unpack' task:
@ -72,6 +72,7 @@ We now support both VB 1.0 and AVB 2.0 layouts.
| Device Model | Manufacturer | Compatible | Android Version | Note |
|--------------------------------|--------------|----------------------|--------------------------|------|
| Pixel 3 (blueline) | Google | Y | Q preview (qpp2.190228.023, <Br>2019)| [more ...](doc/additional_tricks.md#pixel-3-blueline) |
| Pixel XL (marlin) | HTC | Y | 9.0.0 (PPR2.180905.006, <Br>Sep 2018)| [more ...](doc/additional_tricks.md#pixel-xl-marlin) |
| Z18(NX606J) | ZTE | Y | 8.1.0 | [more...](doc/additional_tricks.md#nx606j) |
| Nexus 9 (volantis/flounder) | HTC | Y(with some tricks) | 7.1.1 (N9F27M, Oct 2017) | [tricks](doc/additional_tricks.md#tricks-for-nexus-9volantis)|

@ -37,6 +37,10 @@ Now we can work with 'raw\_boot'
Due to the configuration "BOARD_BUILD_SYSTEM_ROOT_IMAGE := true", the embeded ramdisk in boot.img is actually used in recovery mode.
## Pixel 3 (blueline)
Fickle Google removed "BOARD_BUILD_SYSTEM_ROOT_IMAGE" and added "ro.boot.dynamic_partitions=true", which means normal mode ramdisk is back. Besides, it also packed DTB inside boot.img.
## NX606J
Thanks to the work by [CallMESuper], ZTE NX606J boot.img is also verified to be compatible with this toolkit.

@ -1,13 +1,20 @@
#!/usr/bin/env python3
import shutil, os.path, json, subprocess, hashlib, glob
import unittest
import unittest, logging, sys
successLogo = """
+----------------------------------+
| All test cases have PASSED |
+----------------------------------+
"""
resDir = "src/integrationTest/resources"
log = logging.getLogger('TEST')
log.setLevel(logging.DEBUG)
consoleHandler = logging.StreamHandler(sys.stdout)
consoleHandler.setFormatter(logging.Formatter(fmt='%(asctime)s %(levelname)-8s %(name)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'))
log.addHandler(consoleHandler)
def hashFile(fileName):
hasher = hashlib.md5()
@ -20,22 +27,9 @@ def deleteIfExists(inFile):
if os.path.isfile(inFile):
os.remove(inFile)
def verifySingleJson(inResourceDir, inImageDir, jsonFile):
print(jsonFile)
resDir = inResourceDir
imgDir = inImageDir
verifyItems = json.load(open(jsonFile))
for k, v in verifyItems["copy"].items():
shutil.copyfile(os.path.join(resDir, imgDir, k), v)
subprocess.check_call("gradle unpack", shell = True)
subprocess.check_call("gradle pack", shell = True)
for k, v in verifyItems["hash"].items():
print("%s : %s" % (k, v))
unittest.TestCase().assertEqual(hashFile(k), v)
shutil.rmtree("build")
def cleanUp():
log.info("clean up ...")
shutil.rmtree("build", ignore_errors = True)
deleteIfExists("boot.img")
deleteIfExists("boot.img.clear")
deleteIfExists("boot.img.google")
@ -47,33 +41,58 @@ def verifySingleJson(inResourceDir, inImageDir, jsonFile):
deleteIfExists("vbmeta.img")
deleteIfExists("vbmeta.img.signed")
def verifySingleJson(inResourceDir, inImageDir, jsonFile):
log.info(jsonFile)
resDir = inResourceDir
imgDir = inImageDir
verifyItems = json.load(open(jsonFile))
for k, v in verifyItems["copy"].items():
shutil.copyfile(os.path.join(resDir, imgDir, k), v)
subprocess.check_call("gradle unpack", shell = True)
subprocess.check_call("gradle pack", shell = True)
for k, v in verifyItems["hash"].items():
log.info("%s : %s" % (k, v))
unittest.TestCase().assertEqual(hashFile(k), v)
def verifySingleDir(inResourceDir, inImageDir):
resDir = inResourceDir
imgDir = inImageDir
print("enter %s ..." % os.path.join(resDir, imgDir))
log.info("Enter %s ..." % os.path.join(resDir, imgDir))
jsonFiles = glob.glob(os.path.join(resDir, imgDir) + "/*.json")
for jsonFile in jsonFiles:
cleanUp()
verifySingleJson(inResourceDir, inImageDir, jsonFile)
cleanUp()
resDir = "src/integrationTest/resources"
# 5.0
verifySingleDir(resDir, "5.0_fugu_lrx21m")
# 6.0
verifySingleDir(resDir, "6.0.0_bullhead_mda89e")
# 7.0 special boot
subprocess.check_call("dd if=%s/7.1.1_volantis_n9f27m/boot.img of=boot.img bs=256 skip=1" % resDir, shell = True)
verifySingleJson(resDir, "7.1.1_volantis_n9f27m", "%s/7.1.1_volantis_n9f27m/boot.json" % resDir)
# 7.0 special recovery
subprocess.check_call("dd if=%s/7.1.1_volantis_n9f27m/recovery.img of=recovery.img bs=256 skip=1" % resDir, shell = True)
verifySingleJson(resDir, "7.1.1_volantis_n9f27m", "%s/7.1.1_volantis_n9f27m/recovery.json" % resDir)
# 8.0
verifySingleDir(resDir, "8.0.0_fugu_opr2.170623.027")
# 9.0 + avb
subprocess.check_call("tar xf %s/9.0.0_blueline_pq1a.181105.017.a1/boot.img.tar.gz" % resDir, shell = True)
verifySingleJson(resDir, "9.0.0_blueline_pq1a.181105.017.a1", "%s/9.0.0_blueline_pq1a.181105.017.a1/boot.json" % resDir)
verifySingleJson(resDir, "9.0.0_blueline_pq1a.181105.017.a1", "%s/9.0.0_blueline_pq1a.181105.017.a1/vbmeta.json" % resDir)
def main():
# 5.0
verifySingleDir(resDir, "5.0_fugu_lrx21m")
# 6.0
verifySingleDir(resDir, "6.0.0_bullhead_mda89e")
# 7.0 special boot
cleanUp()
subprocess.check_call("dd if=%s/7.1.1_volantis_n9f27m/boot.img of=boot.img bs=256 skip=1" % resDir, shell = True)
verifySingleJson(resDir, "7.1.1_volantis_n9f27m", "%s/7.1.1_volantis_n9f27m/boot.json" % resDir)
# 7.0 special recovery
cleanUp()
subprocess.check_call("dd if=%s/7.1.1_volantis_n9f27m/recovery.img of=recovery.img bs=256 skip=1" % resDir, shell = True)
verifySingleJson(resDir, "7.1.1_volantis_n9f27m", "%s/7.1.1_volantis_n9f27m/recovery.json" % resDir)
# 8.0
verifySingleDir(resDir, "8.0.0_fugu_opr2.170623.027")
# 9.0 + avb
cleanUp()
subprocess.check_call("tar xf %s/9.0.0_blueline_pq1a.181105.017.a1/boot.img.tar.gz" % resDir, shell = True)
verifySingleJson(resDir, "9.0.0_blueline_pq1a.181105.017.a1", "%s/9.0.0_blueline_pq1a.181105.017.a1/boot.json" % resDir)
cleanUp()
verifySingleJson(resDir, "9.0.0_blueline_pq1a.181105.017.a1", "%s/9.0.0_blueline_pq1a.181105.017.a1/vbmeta.json" % resDir)
# Q preview
verifySingleDir(resDir, "Q_preview_blueline_qpp2.190228.023")
# from volunteers
verifySingleDir(resDir, "recovery_image_from_s-trace")
# from volunteers
verifySingleDir(resDir, "recovery_image_from_s-trace")
log.info(successLogo)
print(successLogo)
if __name__ == "__main__":
# execute only if run as a script
main()

@ -1 +1 @@
Subproject commit c595bc039cb618e505b579bab04e58970910f99c
Subproject commit 3cddd2559cb7965abf96f2bbd6b3469a959abf63
Loading…
Cancel
Save