From e96aa0e33d2fc72b957a5f14f2c3099f65770e08 Mon Sep 17 00:00:00 2001 From: cfig Date: Mon, 16 Jan 2023 11:38:13 +0800 Subject: [PATCH] Issue #109: add test case --- bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt | 13 +++++++++---- integrationTest.py | 2 ++ src/integrationTest/resources_2 | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt b/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt index 32bcf806..bbb6b970 100644 --- a/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt +++ b/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt @@ -160,6 +160,7 @@ data class VendorBoot( private val workDir = Helper.prop("workDir") private val mapper = ObjectMapper() private val dtsSuffix = Helper.prop("config.dts_suffix") + private val environmentVerifier = EnvironmentVerifier() fun parse(fileName: String): VendorBoot { val ret = VendorBoot() FileInputStream(fileName).use { fis -> @@ -451,7 +452,7 @@ data class VendorBoot( "" } } - if (EnvironmentVerifier().isWindows) { + if (environmentVerifier.isWindows) { log.info("\n" + Common.table2String(prints)) } else { //@formatter:off @@ -467,7 +468,7 @@ data class VendorBoot( } private fun toCommandLine(): CommandLine { - val cmdPrefix = if (EnvironmentVerifier().isWindows) "python " else "" + val cmdPrefix = if (environmentVerifier.isWindows) "python " else "" return CommandLine.parse(cmdPrefix + Helper.prop("mkbootimg")).apply { when (info.headerVersion) { 3 -> { @@ -482,7 +483,7 @@ data class VendorBoot( addArgument("--board_id$boardIdIndex") addArgument("0x" + Integer.toHexString((boardIdValue as Int))) } - if (EnvironmentVerifier().isWindows) { + if (environmentVerifier.isWindows) { addArgument("--ramdisk_name").addArgument("\"${it.name}\"", false) } else { addArgument("--ramdisk_name").addArgument(it.name, true) @@ -500,7 +501,11 @@ data class VendorBoot( if (dtb.size > 0) { addArgument("--dtb").addArgument(dtb.file) } - addArgument("--vendor_cmdline").addArgument(info.cmdline, false) + if (environmentVerifier.isWindows) { + addArgument("--vendor_cmdline").addArgument(info.cmdline.replace("\"", "\\\""), false) + } else { + addArgument("--vendor_cmdline").addArgument(info.cmdline, false) + } addArgument("--header_version").addArgument(info.headerVersion.toString()) addArgument("--base").addArgument("0") addArgument("--tags_offset").addArgument(info.tagsLoadAddr.toString()) diff --git a/integrationTest.py b/integrationTest.py index a5fc41e1..f590b475 100755 --- a/integrationTest.py +++ b/integrationTest.py @@ -174,6 +174,8 @@ def main(): verifySingleDir(resDir2, "issue_88") # Issue 92: unsigned vendor_boot verifySingleDir(resDir2, "issue_91_unsigned_vendor_boot") + # Issue 109: vendor_boot w/o dtb + verifySingleDir(resDir2, "issue_109_vendor_boot_no_dtb") log.info(successLogo) diff --git a/src/integrationTest/resources_2 b/src/integrationTest/resources_2 index be8c5a2f..0caca003 160000 --- a/src/integrationTest/resources_2 +++ b/src/integrationTest/resources_2 @@ -1 +1 @@ -Subproject commit be8c5a2fb19b43ba2b1a8c8d3e29b0d3bbaec958 +Subproject commit 0caca0031646be47eb89ae1e4380a524f63ec52b