Chinese translated version of Documentation/power/drivers-testing
If you have any comment or update to the content, please contact the
original document maintainer directly. However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help. Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.
Chinese maintainer: 774945605@qq.com
---------------------------------------------------------------------
Documentation/power/drivers-testing 的中文翻译
如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。
中文版维护者: 潘丽卡 774945605@qq.com
中文版翻译者: 潘丽卡 774945605@qq.com
中文版校译者: 黄佳露 799942107@qq.com
以下为正文
---------------------------------------------------------------------
Testing suspend and resume support in device drivers
测试设备驱动程序支持挂起和恢复
(C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL
1. Preparing the test system
准备测试程序
Unfortunately, to effectively test the support for the system-wide suspend and
resume transitions in a driver, it is necessary to suspend and resume a fully
functional system with this driver loaded. Moreover, that should be done
several times, preferably several times in a row, and separately for hibernation
(aka suspend to disk or STD) and suspend to RAM (STR), because each of these
cases involves slightly different operations and different interactions with
the machine's BIOS.
不幸的是,为了有效地测试一个驱动中对支持系统挂起和恢复间转换的支持,必须在一个加载了
该驱动的功能完善的系统中进行挂起和恢复操作。并且,需要重复几次该操作,可以几次为一组,
以休眠(又叫挂起到磁盘或STD)和挂起到内存(STR)隔开,因为这两种情况在操作以及和计算机
的BIOS进行交互上都略有不同。
Of course, for this purpose the test system has to be known to suspend and
resume without the driver being tested. Thus, if possible, you should first
resolve all suspend/resume-related problems in the test system before you start
testing the new driver. Please see Documentation/power/basic-pm-debugging.txt
for more information about the debugging of suspend/resume functionality.
当然,为了这个目的,测试系统必须在还没有加载驱动前就已经可以挂起和恢复。因此,如果
可能的话,你必须在开始测试新的驱动前就解决掉测试系统的所有挂起/恢复方面的问题。请查阅
Documentation/power/basic-pm-debugging.txt这个文档,获取更多关于挂起/恢复功能的调试的
信息。
2. Testing the driver
测试驱动程序
Once you have resolved the suspend/resume-related problems with your test system
without the new driver, you are ready to test it:
当你用自己的测试系统在没有运行新的驱动程序的情况下解决了与挂起/暂停相关的问题之后,
你就可以开始进行下面的测试了:
a) Build the driver as a module, load it and try the test modes of hibernation
(see: Documentation/power/basic-pm-debugging.txt, 1).
构建一个驱动模块,加载这个模块并测试它的休眠模式。
(查阅:Documentation/power/basic-pm-debugging.txt, 1)
b) Load the driver and attempt to hibernate in the "reboot", "shutdown" and
"platform" modes (see: Documentation/power/basic-pm-debugging.txt, 1).
加载驱动,尝试以“reboot”、“shutdomn”和“platform”方式进行休眠。
(查阅:Documentation/power/basic-pm-debugging.txt, 1)
c) Compile the driver directly into the kernel and try the test modes of
hibernation.
直接将驱动编译进内核并进行休眠模式的测试。
d) Attempt to hibernate with the driver compiled directly into the kernel
in the "reboot", "shutdown" and "platform" modes.
对已经直接编译进内核的驱动进行“reboot”、“shutdomn”和“platform”方式的休眠测试。
e) Try the test modes of suspend (see: Documentation/power/basic-pm-debugging.txt,
2). [As far as the STR tests are concerned, it should not matter whether or
not the driver is built as a module.]
尝试进行驱动挂起模式的测试(查阅:Documentation/power/basic-pm-debugging.txt, 2)。
[当进行STR测试时,驱动模块是否构建并不重要。]
f) Attempt to suspend to RAM using the s2ram tool with the driver loaded
(see: Documentation/power/basic-pm-debugging.txt, 2).
在驱动加载后,试着利用s2ram工具进行STR测试。
Each of the above tests should be repeated several times and the STD tests
should be mixed with the STR tests. If any of them fails, the driver cannot be
regarded as suspend/resume-safe.
以上的每一个测试都应该重复进行,而且STD测试和STR测试应该混合进行。如果其中任意
一个测试失败了,那么我们就不能认为这个驱动的挂起/恢复是安全的。