构建: 测试临时目录改指 <repo>/build/test-tmp(本机 /tmp tmpfs 已满会误报测试失败)

This commit is contained in:
zijunchiang
2026-10-14 02:12:30 +08:00
parent 87aa979abd
commit a20aa7b1e2
2 changed files with 13 additions and 0 deletions
+9
View File
@@ -3,6 +3,15 @@ plugins {
id "org.jetbrains.kotlin.android"
}
// ⚠️ 本机 /tmp 是 5.6G 的 tmpfs,且常被"已删除但仍被打开"的文件占满 ——
// 单测写临时文件时会直接抛 IOException: 超出磁盘配额(EDQUOT),看起来像测试失败。
// 统一把测试 JVM 的临时目录指到项目所在磁盘(/home 有 400G 空闲),与 /tmp 状态解耦。
tasks.withType(Test).configureEach {
def testTmp = new File(rootDir, 'build/test-tmp')
doFirst { testTmp.mkdirs() }
systemProperty 'java.io.tmpdir', testTmp.absolutePath
}
android {
namespace "com.local.ktv"
compileSdk 35