Skip to content

test: 单测不再读本机生产根目录 - #150

Merged
qiyinxi merged 1 commit into
ModAVD:mainfrom
qiyinxi:test/no-prod-mas1
Nov 13, 2026
Merged

qiyinxi merged 1 commit into
ModAVD:mainfrom
qiyinxi:test/no-prod-mas1

Conversation

@qiyinxi

@qiyinxi qiyinxi commented Nov 13, 2026

Copy link
Copy Markdown
Member

改了什么

单测不再读本机的 ModAVD 根目录(D:\ModAVD)。

  • internal/avd 的 TestMatchesProductionInstance:原来只读打开本机根目录里的 mas_1.ini、mas_1.avd\config.ini 和 mas-avd.json 来比对。实例装过执行桥后多了 hw.gltransport=asg,go test ./... 因此失败;没有这台实例的机器上它又一直跳过。现在把 10-16 AUTO-MAS 建出来的那份 mas_1 写成测试里的快照,在临时目录里搭一个根目录再比,任何机器上都会跑。
  • internal/adb 的真 adb 测试:原来没设 MODAVD_TEST_SDK 时会退回去运行 D:\ModAVD\sdk 里的 adb.exe。现在只认 MODAVD_TEST_SDK,没设就跳过。

其余 *_test.go 里出现的 D:\ModAVD 都只是写进临时文件的字符串,不碰真实目录。

测试

  • go vet ./internal/adb/ ./internal/avd/
  • go test ./... -count=1(没设 MODAVD_TEST_SDK):全部通过

只改测试,不进安装包。

TestMatchesProductionInstance compared against the installed mas_1 and broke once
the bridge added hw.gltransport=asg; it now uses a 10-16 snapshot in a temp root.
The real-adb tests no longer fall back to the installed root's adb.exe; they need
MODAVD_TEST_SDK.
@qiyinxi qiyinxi added the bug Something isn't working label Nov 13, 2026
@qiyinxi
qiyinxi added this pull request to the merge queue Nov 13, 2026
Merged via the queue into ModAVD:main with commit 9f8ccca Nov 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant