mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-22 16:28:29 +00:00
Skip module tests on API < 26
This commit is contained in:
parent
79af2787ae
commit
9ac81a8a25
@ -49,7 +49,8 @@ class AdditionalTest : BaseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testModuleCount() {
|
fun testModuleCount() {
|
||||||
var expected = 2
|
var expected = 0
|
||||||
|
if (Environment.testModules()) expected +=2
|
||||||
if (Environment.lsposed()) expected++
|
if (Environment.lsposed()) expected++
|
||||||
if (Environment.shamiko()) expected++
|
if (Environment.shamiko()) expected++
|
||||||
assertEquals("Module count incorrect", expected, modules.size)
|
assertEquals("Module count incorrect", expected, modules.size)
|
||||||
@ -78,6 +79,8 @@ class AdditionalTest : BaseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testModule01() {
|
fun testModule01() {
|
||||||
|
assumeTrue(Environment.testModules())
|
||||||
|
|
||||||
val module = modules.find { it.id == "test_01" }
|
val module = modules.find { it.id == "test_01" }
|
||||||
assertNotNull("test_01 is not installed", module)
|
assertNotNull("test_01 is not installed", module)
|
||||||
assertTrue(
|
assertTrue(
|
||||||
@ -94,6 +97,8 @@ class AdditionalTest : BaseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testModule02() {
|
fun testModule02() {
|
||||||
|
assumeTrue(Environment.testModules())
|
||||||
|
|
||||||
val module = modules.find { it.id == "test_02" }
|
val module = modules.find { it.id == "test_02" }
|
||||||
assertNotNull("test_02 is not installed", module)
|
assertNotNull("test_02 is not installed", module)
|
||||||
module!!
|
module!!
|
||||||
@ -102,6 +107,8 @@ class AdditionalTest : BaseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testModule03() {
|
fun testModule03() {
|
||||||
|
assumeTrue(Environment.testModules())
|
||||||
|
|
||||||
assertNull("test_03 should be removed", modules.find { it.id == "test_03" })
|
assertNull("test_03 should be removed", modules.find { it.id == "test_03" })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,14 @@ class Environment : BaseTest {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun before() = BaseTest.prerequisite()
|
fun before() = BaseTest.prerequisite()
|
||||||
|
|
||||||
|
// The kernel running on emulators < API 26 does not play well with
|
||||||
|
// magic mount. Skip module tests on those legacy platforms.
|
||||||
|
fun testModules(): Boolean {
|
||||||
|
return Build.VERSION.SDK_INT >= 26
|
||||||
|
}
|
||||||
|
|
||||||
fun lsposed(): Boolean {
|
fun lsposed(): Boolean {
|
||||||
return Build.VERSION.SDK_INT >= 27 && Build.VERSION.SDK_INT <= 34
|
return Build.VERSION.SDK_INT in 27..34
|
||||||
}
|
}
|
||||||
|
|
||||||
fun shamiko(): Boolean {
|
fun shamiko(): Boolean {
|
||||||
@ -169,11 +175,13 @@ class Environment : BaseTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (testModules()) {
|
||||||
val root = RootUtils.fs.getFile(Const.MODULE_PATH)
|
val root = RootUtils.fs.getFile(Const.MODULE_PATH)
|
||||||
setupModule01(root)
|
setupModule01(root)
|
||||||
setupModule02(root)
|
setupModule02(root)
|
||||||
setupModule03(root)
|
setupModule03(root)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun setupAppHide() {
|
fun setupAppHide() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user