Skip to content

Commit

Permalink
Issue #109: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
cfig committed Jan 16, 2023
1 parent de69dbf commit e96aa0e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
13 changes: 9 additions & 4 deletions bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down Expand Up @@ -451,7 +452,7 @@ data class VendorBoot(
""
}
}
if (EnvironmentVerifier().isWindows) {
if (environmentVerifier.isWindows) {
log.info("\n" + Common.table2String(prints))
} else {
//@formatter:off
Expand All @@ -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 -> {
Expand All @@ -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)
Expand All @@ -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())
Expand Down
2 changes: 2 additions & 0 deletions integrationTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/integrationTest/resources_2
Submodule resources_2 updated from be8c5a to 0caca0

0 comments on commit e96aa0e

Please sign in to comment.