diff --git a/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt b/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt index 9a60a39..65af803 100644 --- a/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt +++ b/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt @@ -147,11 +147,10 @@ class AndroidCpio { entry.statMode = itemConfig[0].statMode } else -> { - //Issue #73: https://github.com/cfig/Android_boot_image_editor/issues/73 - //Reason: cpio may have multiple entries with the same name, that's ugly! - //throw IllegalArgumentException("${entry.name} has multiple exact-match fsConfig") - log.warn("${entry.name} has multiple exact-match fsConfig") - entry.statMode = itemConfig[0].statMode + //Issue #75: https://github.com/cfig/Android_boot_image_editor/issues/75 + //Reason: cpio may have multiple entries with the same name, that's caused by man-made errors + throw IllegalArgumentException("${entry.name} has multiple exact-match fsConfig, " + + "check https://github.com/cfig/Android_boot_image_editor/issues/75") } } } diff --git a/bbootimg/src/test/kotlin/bcb/VirtualABMsgTest.kt b/bbootimg/src/test/kotlin/bcb/VirtualABMsgTest.kt index 70c4386..80b1d8b 100644 --- a/bbootimg/src/test/kotlin/bcb/VirtualABMsgTest.kt +++ b/bbootimg/src/test/kotlin/bcb/VirtualABMsgTest.kt @@ -2,32 +2,41 @@ package bcb import cfig.bcb.VirtualABMsg import cfig.bootimg.Common.Companion.deleleIfExists +import cfig.helper.Helper import cfig.helper.Helper.Companion.check_call -import org.junit.After -import org.junit.Before +import org.apache.commons.exec.CommandLine +import org.junit.* -import org.junit.Ignore -import org.junit.Test import org.slf4j.LoggerFactory import java.io.File import java.io.FileInputStream +import java.io.IOException class VirtualABMsgTest { private val log = LoggerFactory.getLogger(VirtualABMsgTest::class.java) @Before fun setUp() { - "adb root".check_call() + Assume.assumeTrue( + try { + "adb --version".check_call() + true + } catch (e: IOException) { + false + } + ) + Assume.assumeTrue(Helper.powerRun3(CommandLine.parse("adb root"), null)[0] as Boolean) "adb wait-for-device".check_call() "adb shell dd if=/dev/block/by-name/misc of=/data/vendor/debug.misc skip=512 bs=64 count=1".check_call() "adb pull /data/vendor/debug.misc".check_call() } @Test - @Ignore fun parseVAB() { - val vab = VirtualABMsg(FileInputStream("debug.misc")) - log.info("VAB msg: $vab") + FileInputStream("debug.misc").use { + val vab = VirtualABMsg(it) + log.info("VAB msg: $vab") + } } @After