<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>http://wiki.foofun.cn//index.php?action=history&amp;feed=atom&amp;title=Testing</id>
	<title>Testing - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.foofun.cn//index.php?action=history&amp;feed=atom&amp;title=Testing"/>
	<link rel="alternate" type="text/html" href="http://wiki.foofun.cn//index.php?title=Testing&amp;action=history"/>
	<updated>2026-04-04T01:37:49Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.foofun.cn//index.php?title=Testing&amp;diff=869&amp;oldid=prev</id>
		<title>2022年3月14日 (一) 11:27 Zhang3</title>
		<link rel="alternate" type="text/html" href="http://wiki.foofun.cn//index.php?title=Testing&amp;diff=869&amp;oldid=prev"/>
		<updated>2022-03-14T11:27:28Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2022年3月14日 (一) 11:27的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot;&gt;第5行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第5行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 作为成功测试环境要达到的要求 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 作为成功测试环境要达到的要求 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 速度。''' 你希望能够重新启动你的 (可能是虚拟的) 测试机，并在输入完命令之前将其准备好与新内核一起使用。 你还希望代码尽可能快地执行，这样你就可以回到编码，而不是等待 [[GRUB]] 加载。 物理机可以在这个指标上获胜，但这取决于硬件速度，当然 (软盘驱动器特别慢)。模拟486的Core 2 Duo可能会比486本身更快。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 速度。''' 你希望能够重新启动你的 (可能是虚拟的) 测试机，并在输入完命令之前将其准备好与新内核一起使用。 你还希望代码尽可能快地执行，这样你就可以回到编码，而不是等待 [[GRUB]] 加载。 物理机可以在这个指标上获胜，但这取决于硬件速度，当然 (软盘驱动器特别慢)。模拟486的Core 2 Duo可能会比486本身更快。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 易用性。''' 仅为了修改20条不同命令，就构建和运行新内核，肯定不太好玩，因此你可能希望编译构建的更少。 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;减少测试构建步骤是使减少Bug的好方法。 &lt;/del&gt;模拟器通常会在这个指标获胜，因为你可以设置makefile来构建磁盘映像，同时准备在模拟器中运行。 [[Diskless Booting|无盘引导]] 也是真实机器上的一种选择。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 易用性。''' 仅为了修改20条不同命令，就构建和运行新内核，肯定不太好玩，因此你可能希望编译构建的更少。 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;减少测试构建步骤是减少Bug的好方法。 &lt;/ins&gt;模拟器通常会在这个指标获胜，因为你可以设置makefile来构建磁盘映像，同时准备在模拟器中运行。 [[Diskless Booting|无盘引导]] 也是真实机器上的一种选择。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 与真实情况足够接近。''' 如果你的测试机器尽可能接近真实，这被认为是一件好事。 当然，物理机器最适合此，其次是 [[Bochs]]一类的虚拟机。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 与真实情况足够接近。''' 如果你的测试机器尽可能接近真实，这被认为是一件好事。 当然，物理机器最适合此，其次是 [[Bochs]]一类的虚拟机。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l24&quot;&gt;第24行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第24行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;使用虚拟机进行测试的优点是，它可以用一个非常简单的过程来编译然后运行你的新内核 (shell脚本可以使它成为一个命令过程)，如果你明智地选择你的模拟器，在调试消息方面，你可以获得很多免费帮助。  [[:Category:Emulators|这里]]有一份模拟器列表。 也许最推荐给OSDev开发者的两个是 [[Bochs]] 和 [[QEMU]]。 有关虚拟机测试的更多信息，请从相应的模拟器页面中获得。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;使用虚拟机进行测试的优点是，它可以用一个非常简单的过程来编译然后运行你的新内核 (shell脚本可以使它成为一个命令过程)，如果你明智地选择你的模拟器，在调试消息方面，你可以获得很多免费帮助。  [[:Category:Emulators|这里]]有一份模拟器列表。 也许最推荐给OSDev开发者的两个是 [[Bochs]] 和 [[QEMU]]。 有关虚拟机测试的更多信息，请从相应的模拟器页面中获得。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;使用虚拟机的一个缺点是硬件的选择受到限制。 例如，Bochs和QEMU的 [[VGA Hardware| VGA]] 和 [[:Category:Network devices|网络]] 设备的选择有限。 他们模拟的那些设备可能 (尽管不太可能) 有错误，并且不像真正的设备那样运行 (&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;模拟器有时内存为零，而真正的机器通常没有&lt;/del&gt;)。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;使用虚拟机的一个缺点是硬件的选择受到限制。 例如，Bochs和QEMU的 [[VGA Hardware| VGA]] 和 [[:Category:Network devices|网络]] 设备的选择有限。 他们模拟的那些设备可能 (尽管不太可能) 有错误，并且不像真正的设备那样运行 (&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;模拟器有时会为内存清零，而真正的机器通常没有&lt;/ins&gt;)。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 高级事项 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 高级事项 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== 硬盘访问测试 ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== 硬盘访问测试 ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;测试硬盘访问会带来比通常测试问题更麻烦，因为这意味着不太可能使用你的主要开发平台作为测试平台 &lt;/del&gt;(你可以坚持，但这通常是一个坏主意。译者注：主要怕开发中的操作系统把在用硬盘弄坏了)。 但是，如果你确实需要 (由于缺少模拟器或第二台机器)，请参考以下指南:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;硬盘访问测试会带来比通常测试更麻烦的问题，因为这意味着不太可能使用你的主要开发平台作为测试平台 &lt;/ins&gt;(你可以坚持，但这通常是一个坏主意。译者注：主要怕开发中的操作系统把在用硬盘弄坏了)。 但是，如果你确实需要 (由于缺少模拟器或第二台机器)，请参考以下指南:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 你的内核应该非常稳定，以确保它不会写入内存中的随机位置，不是跟随空指针和其他类似的东西。 处于保护模式在这里是一个优势，因为你不会意外调用可能写入磁盘的BIOS代码。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 你的内核应该非常稳定，以确保它不会写入内存中的随机位置，不是跟随空指针和其他类似的东西。 处于保护模式在这里是一个优势，因为你不会意外调用可能写入磁盘的BIOS代码。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 首先在ramdisk上尝试文件系统代码。 ramdisk内容可以从头开始构建，也可以由引导加载程序加载的数据生成 ([[GRUB]] 的模块加载工具将是很好的工具) 确保你有能力检查ramdisk中写入的内容，而不必将ramdisk写入真实磁盘 (你也可以在真正的磁盘上先试过)。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 首先在ramdisk上尝试文件系统代码。 ramdisk内容可以从头开始构建，也可以由引导加载程序加载的数据生成 ([[GRUB]] 的模块加载工具将是很好的工具) 确保你有能力检查ramdisk中写入的内容，而不必将ramdisk写入真实磁盘 (你也可以在真正的磁盘上先试过)。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhang3</name></author>
	</entry>
	<entry>
		<id>http://wiki.foofun.cn//index.php?title=Testing&amp;diff=858&amp;oldid=prev</id>
		<title>2022年3月14日 (一) 05:38 Zhang3</title>
		<link rel="alternate" type="text/html" href="http://wiki.foofun.cn//index.php?title=Testing&amp;diff=858&amp;oldid=prev"/>
		<updated>2022-03-14T05:38:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2022年3月14日 (一) 05:38的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;第1行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;除非有一种方法可以测试新版本的操作系统或内核，否则开发操作系统几乎是完全无用的练习。 &lt;/del&gt;设置测试环境有许多不同的方法。 广义上，它们可以分为两种方法:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;除非有一种方法可以测试新版本的操作系统或内核，否则开发操作系统几乎只是完全无用的练习。 &lt;/ins&gt;设置测试环境有许多不同的方法。 广义上，它们可以分为两种方法:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 物理机&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 物理机&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[:Category:Emulators|虚拟机]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[:Category:Emulators|虚拟机]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot;&gt;第5行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第5行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 作为成功测试环境要达到的要求 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 作为成功测试环境要达到的要求 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 速度。''' 你希望能够重新启动你的 (可能是虚拟的) 测试机，并在输入完命令之前将其准备好与新内核一起使用。 你还希望代码尽可能快地执行，这样你就可以回到编码，而不是等待 [[GRUB]] 加载。 物理机可以在这个指标上获胜，但这取决于硬件速度，当然 (软盘驱动器特别慢)。模拟486的Core 2 Duo可能会比486本身更快。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 速度。''' 你希望能够重新启动你的 (可能是虚拟的) 测试机，并在输入完命令之前将其准备好与新内核一起使用。 你还希望代码尽可能快地执行，这样你就可以回到编码，而不是等待 [[GRUB]] 加载。 物理机可以在这个指标上获胜，但这取决于硬件速度，当然 (软盘驱动器特别慢)。模拟486的Core 2 Duo可能会比486本身更快。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 易用性。''' &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;仅为了修改20种不同命令，就构建和运行新内核，肯定不太好玩，因此你可能希望编译构建的更少。 减少测试构建步骤是使错误漏出的好方法。 模拟器通常会在这里获胜，因为你可以设置makefile来构建磁盘映像，同时准备在模拟器中运行。 &lt;/del&gt;[[Diskless Booting]] &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;也是真实机器的一种选择。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 易用性。''' &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;仅为了修改20条不同命令，就构建和运行新内核，肯定不太好玩，因此你可能希望编译构建的更少。 减少测试构建步骤是使减少Bug的好方法。 模拟器通常会在这个指标获胜，因为你可以设置makefile来构建磁盘映像，同时准备在模拟器中运行。 &lt;/ins&gt;[[Diskless Booting&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|无盘引导&lt;/ins&gt;]] &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;也是真实机器上的一种选择。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 与真实情况足够接近。''' 如果你的测试机器尽可能接近真实，这被认为是一件好事。 当然，物理机器最适合此，其次是 [[Bochs]]一类的虚拟机。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 与真实情况足够接近。''' 如果你的测试机器尽可能接近真实，这被认为是一件好事。 当然，物理机器最适合此，其次是 [[Bochs]]一类的虚拟机。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l17&quot;&gt;第17行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第17行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 网卡，例如 [[Ne2000|NE2000]] 或 [[3c90x]]。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 网卡，例如 [[Ne2000|NE2000]] 或 [[3c90x]]。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;这种机器是一个很好的基础。 由此，你添加的任何其他内容都只是用来编写更多驱动程序的。 &lt;/del&gt;要执行测试，你可以从便携式介质 ([[Floppy]] 或 [[USB]]) 引导内核，或者使用 [[Diskless Booting]] 从开发PC下载内核。 从 [[Bootable CD|CD-ROM]] 引导是另一种选择，尽管它可能需要大量空白光盘 (或CD-RW)。 另一个很棒的技术是使用U盘: &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;只需在其上复制软盘映像，只要你使用BIOS routines来读取，BIOS就会为你模拟出一个软盘。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;这类机器是一个很好的基础。 由此，你添加的任何其他设备都只是用来编写更多驱动程序的。 &lt;/ins&gt;要执行测试，你可以从便携式介质 ([[Floppy&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|软盘&lt;/ins&gt;]] 或 [[USB]]) 引导内核，或者使用 [[Diskless Booting&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|无盘引导&lt;/ins&gt;]] 从开发PC下载内核。 从 [[Bootable CD|CD-ROM]] 引导是另一种选择，尽管它可能需要大量空白光盘 (或CD-RW)。 另一个很棒的技术是使用U盘: &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;只需在其上复制好软盘映像，然后使用BIOS例程来读取，BIOS就会为你模拟出一个软盘。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Brendan在 [[topic:17948|这个]] 论坛主题中写了一篇关于购买和管理测试机的很好的指南。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Brendan在 [[topic:17948|这个]] 论坛主题中写了一篇关于购买和管理测试机的很好的指南。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 使用虚拟机进行测试 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 使用虚拟机进行测试 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;使用虚拟机进行测试的优点是，它可以用一个非常简单的过程来编译然后运行你的新内核 (shell脚本可以使它成为一个命令过程)，如果你明智地选择你的模拟器，在调试消息方面，你可以获得很多免费帮助。  [[:Category:Emulators | 这里]]&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;有一份仿真器列表。 也许最推荐给OSDev的两个是 &lt;/del&gt;[[Bochs]] 和 [[QEMU]]。 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;有关虚拟机测试的更多信息，请从相应的仿真器页面中获得。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;使用虚拟机进行测试的优点是，它可以用一个非常简单的过程来编译然后运行你的新内核 (shell脚本可以使它成为一个命令过程)，如果你明智地选择你的模拟器，在调试消息方面，你可以获得很多免费帮助。  [[:Category:Emulators|这里]]&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;有一份模拟器列表。 也许最推荐给OSDev开发者的两个是 &lt;/ins&gt;[[Bochs]] 和 [[QEMU]]。 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;有关虚拟机测试的更多信息，请从相应的模拟器页面中获得。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;使用虚拟机的一个缺点是硬件的选择受到限制。 例如，Bochs和QEMU的 [[VGA Hardware| VGA]] 和 [[:Category:Network devices|网络]] 设备的选择有限。 他们模拟的那些设备可能 (尽管不太可能) 有错误，并且不像真正的设备那样运行 (模拟器有时内存为零，而真正的机器通常没有)。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;使用虚拟机的一个缺点是硬件的选择受到限制。 例如，Bochs和QEMU的 [[VGA Hardware| VGA]] 和 [[:Category:Network devices|网络]] 设备的选择有限。 他们模拟的那些设备可能 (尽管不太可能) 有错误，并且不像真正的设备那样运行 (模拟器有时内存为零，而真正的机器通常没有)。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l29&quot;&gt;第29行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第29行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== 硬盘访问测试 ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== 硬盘访问测试 ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;测试硬盘访问会带来比通常测试问题更麻烦，因为这意味着不太可能使用你的主要开发平台作为测试平台 (&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;你可以坚持，但这通常是一个坏主意&lt;/del&gt;)。 但是，如果你确实需要 (由于缺少模拟器或第二台机器)，请参考以下指南:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;测试硬盘访问会带来比通常测试问题更麻烦，因为这意味着不太可能使用你的主要开发平台作为测试平台 (&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;你可以坚持，但这通常是一个坏主意。译者注：主要怕开发中的操作系统把在用硬盘弄坏了&lt;/ins&gt;)。 但是，如果你确实需要 (由于缺少模拟器或第二台机器)，请参考以下指南:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 你的内核应该非常稳定，以确保它不会写入内存中的随机位置，不是跟随空指针和其他类似的东西。 处于保护模式在这里是一个优势，因为你不会意外调用可能写入磁盘的BIOS代码。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 你的内核应该非常稳定，以确保它不会写入内存中的随机位置，不是跟随空指针和其他类似的东西。 处于保护模式在这里是一个优势，因为你不会意外调用可能写入磁盘的BIOS代码。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 首先在ramdisk上尝试文件系统代码。 ramdisk内容可以从头开始构建，也可以由引导加载程序加载的数据生成 ([[GRUB]] 的模块加载工具将是很好的工具) 确保你有能力检查ramdisk中写入的内容，而不必将ramdisk写入真实磁盘 (&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;否则你也可以在真正的磁盘上试过&lt;/del&gt;)。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 首先在ramdisk上尝试文件系统代码。 ramdisk内容可以从头开始构建，也可以由引导加载程序加载的数据生成 ([[GRUB]] 的模块加载工具将是很好的工具) 确保你有能力检查ramdisk中写入的内容，而不必将ramdisk写入真实磁盘 (&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;你也可以在真正的磁盘上先试过&lt;/ins&gt;)。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 在开发 “将” 执行磁盘访问的组件时，请确保首先在 [[:Category:Emulators|模拟器]] 上对其进行测试，并确保其行为符合预期。 在磁盘功能中强制执行边界检查，这样你就不会弄错分区或类似的东西。 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;你甚至可以在低级驱动程序中对边界进行硬编码，并报告致命情况，如果上层组件要求它脱离磁盘上的 &lt;/del&gt;“安全” &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;阵列。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 在开发 “将” 执行磁盘访问的组件时，请确保首先在 [[:Category:Emulators|模拟器]] 上对其进行测试，并确保其行为符合预期。 在磁盘功能中强制执行边界检查，这样你就不会弄错分区或类似的东西。 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;你甚至可以在低级驱动程序中对边界进行硬编码，如果上层组件要求它脱离磁盘上的 &lt;/ins&gt;“安全” &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;阵列，则报告致命情况。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 在一个与你的主磁盘单独的控制器 (例如不同的IDE电缆)尝试测试驱动器，这样你的代码将访问不会损害你的主磁盘的I/O端口。 如果所有其他方法都失败，请在专用的第二台计算机上进行测试。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 在一个与你的主磁盘单独的控制器 (例如不同的IDE电缆)尝试测试驱动器，这样你的代码将访问不会损害你的主磁盘的I/O端口。 如果所有其他方法都失败，请在专用的第二台计算机上进行测试。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== 寻找特定的硬件 ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== 寻找特定的硬件 ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;如果你需要为特定的硬件编写驱动程序，则有几种选择。 如果你尚未拥有旧的硬件设备，则可以在 [http://www.ebay.com eBay] (和其他类似的地方) 上购买。 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;你可能还想尝试 &lt;/del&gt;[[topic:2970|此]] 论坛主题，其中许多用户列出了一些用于测试其他用户操作系统的计算机。 [[:Category:Hardware|硬件分类]] &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;中列出的绝大多数硬件都相当普遍，并且将是开发的不错选择。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;如果你需要为特定的硬件编写驱动程序，则有几种选择。 如果你尚未拥有旧的硬件设备，则可以在 [http://www.ebay.com eBay] (和其他类似的地方) 上购买。 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;你还可以试试查看 &lt;/ins&gt;[[topic:2970|此]] 论坛主题，其中许多用户列出了一些用于测试其他用户操作系统的计算机。 [[:Category:Hardware|硬件分类]] &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;中列出的绝大多数硬件都相当普遍，并且是不错的开发选择。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== 单元测试 ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== 单元测试 ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Main|Unit Testing}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Main|Unit Testing}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;以上文章链接讨论了一种单独测试操作系统组件的方法，并安装测试驱动程序，以确保组件始终按预期工作 &lt;/del&gt;(&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;例如，修复一个错误不会引入另一个错误&lt;/del&gt;)。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;以上正文链接讨论了一种单独测试操作系统组件的方法，以及安装测试驱动（driver，译者注：单元测试需要driver和stub，分别模拟测试目标的上层和下层），以确保组件始终按预期工作 &lt;/ins&gt;(&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;比如，修复一个错误不会引入另一个错误&lt;/ins&gt;)。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 另见 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 另见 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhang3</name></author>
	</entry>
	<entry>
		<id>http://wiki.foofun.cn//index.php?title=Testing&amp;diff=387&amp;oldid=prev</id>
		<title>2022年2月6日 (日) 12:41 Zhang3</title>
		<link rel="alternate" type="text/html" href="http://wiki.foofun.cn//index.php?title=Testing&amp;diff=387&amp;oldid=prev"/>
		<updated>2022-02-06T12:41:39Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2022年2月6日 (日) 12:41的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;第1行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;除非有一种方法可以测试新版本的操作系统或内核，否则开发操作系统几乎是完全无用的练习。 设置测试环境有许多不同的方法。 广义上，它们可以分为两种方法:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;除非有一种方法可以测试新版本的操作系统或内核，否则开发操作系统几乎是完全无用的练习。 设置测试环境有许多不同的方法。 广义上，它们可以分为两种方法:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;物理机器&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;物理机&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[:Category:Emulators|&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;virtual machine&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[:Category:Emulators|&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;虚拟机&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;作为成功的测试环境要达到的要求 &lt;/del&gt;==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;作为成功测试环境要达到的要求 &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 速度。''' 你希望能够重新启动你的 (可能是虚拟的) 测试机，并在输入完命令之前将其准备好与新内核一起使用。 你还希望代码尽可能快地执行，这样你就可以回到编码，而不是等待 [[GRUB]] 加载。 物理机可以在这个指标上获胜，但这取决于硬件速度，当然 (软盘驱动器特别慢)。模拟486的Core 2 Duo可能会比486本身更快。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 速度。''' 你希望能够重新启动你的 (可能是虚拟的) 测试机，并在输入完命令之前将其准备好与新内核一起使用。 你还希望代码尽可能快地执行，这样你就可以回到编码，而不是等待 [[GRUB]] 加载。 物理机可以在这个指标上获胜，但这取决于硬件速度，当然 (软盘驱动器特别慢)。模拟486的Core 2 Duo可能会比486本身更快。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 易用性。''' 仅为了修改20种不同命令，就构建和运行新内核，肯定不太好玩，因此你可能希望编译构建的更少。 减少测试构建步骤是使错误漏出的好方法。 模拟器通常会在这里获胜，因为你可以设置makefile来构建磁盘映像，同时准备在模拟器中运行。 [[Diskless Booting]] 也是真实机器的一种选择。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''' 易用性。''' 仅为了修改20种不同命令，就构建和运行新内核，肯定不太好玩，因此你可能希望编译构建的更少。 减少测试构建步骤是使错误漏出的好方法。 模拟器通常会在这里获胜，因为你可以设置makefile来构建磁盘映像，同时准备在模拟器中运行。 [[Diskless Booting]] 也是真实机器的一种选择。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhang3</name></author>
	</entry>
	<entry>
		<id>http://wiki.foofun.cn//index.php?title=Testing&amp;diff=385&amp;oldid=prev</id>
		<title>Zhang3：创建页面，内容为“除非有一种方法可以测试新版本的操作系统或内核，否则开发操作系统几乎是完全无用的练习。 设置测试环境有许多不同的方法。 广义上，它们可以分为两种方法: * 物理机器 * virtual machine  == 作为成功的测试环境要达到的要求 == * ''' 速度。''' 你希望能够重新启动你的 (可能是虚拟的) 测试机，并在输入完命令之前将其准备好与新内…”</title>
		<link rel="alternate" type="text/html" href="http://wiki.foofun.cn//index.php?title=Testing&amp;diff=385&amp;oldid=prev"/>
		<updated>2022-02-06T12:39:07Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“除非有一种方法可以测试新版本的操作系统或内核，否则开发操作系统几乎是完全无用的练习。 设置测试环境有许多不同的方法。 广义上，它们可以分为两种方法: * 物理机器 * &lt;a href=&quot;/index.php?title=%E5%88%86%E7%B1%BB:Emulators&quot; title=&quot;分类:Emulators&quot;&gt;virtual machine&lt;/a&gt;  == 作为成功的测试环境要达到的要求 == * &amp;#039;&amp;#039;&amp;#039; 速度。&amp;#039;&amp;#039;&amp;#039; 你希望能够重新启动你的 (可能是虚拟的) 测试机，并在输入完命令之前将其准备好与新内…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;除非有一种方法可以测试新版本的操作系统或内核，否则开发操作系统几乎是完全无用的练习。 设置测试环境有许多不同的方法。 广义上，它们可以分为两种方法:&lt;br /&gt;
* 物理机器&lt;br /&gt;
* [[:Category:Emulators|virtual machine]]&lt;br /&gt;
&lt;br /&gt;
== 作为成功的测试环境要达到的要求 ==&lt;br /&gt;
* ''' 速度。''' 你希望能够重新启动你的 (可能是虚拟的) 测试机，并在输入完命令之前将其准备好与新内核一起使用。 你还希望代码尽可能快地执行，这样你就可以回到编码，而不是等待 [[GRUB]] 加载。 物理机可以在这个指标上获胜，但这取决于硬件速度，当然 (软盘驱动器特别慢)。模拟486的Core 2 Duo可能会比486本身更快。&lt;br /&gt;
* ''' 易用性。''' 仅为了修改20种不同命令，就构建和运行新内核，肯定不太好玩，因此你可能希望编译构建的更少。 减少测试构建步骤是使错误漏出的好方法。 模拟器通常会在这里获胜，因为你可以设置makefile来构建磁盘映像，同时准备在模拟器中运行。 [[Diskless Booting]] 也是真实机器的一种选择。&lt;br /&gt;
* ''' 与真实情况足够接近。''' 如果你的测试机器尽可能接近真实，这被认为是一件好事。 当然，物理机器最适合此，其次是 [[Bochs]]一类的虚拟机。&lt;br /&gt;
&lt;br /&gt;
== 使用物理机进行测试 ==&lt;br /&gt;
使用真实机器进行测试的主要优点是，如果你的操作系统在测试平台上运行，则很有可能也能在任何其他计算机上运行。 然而，如果你使用模拟器进行测试，它可能无法在真实的东西上工作。 缺点主要是你需要空间和金钱来维护第二台计算机，以及花费重新启动开发机器所花费的时间。 有了今天便宜的硬件，建议你有第二台物理计算机。 你可以花3000美元购买一台全新的测试计算机，也可以花20美元购买一台回收的 [[IA32_Architecture_Family#Intel_486|486]]。 一台计算机有几个组成部分，但是，以下是一个建议最低限度的清单:&lt;br /&gt;
* 软盘驱动器 (用于启动和测试FAT12驱动程序)。&lt;br /&gt;
* 一个 [[VGA Hardware|VGA]]-兼容视频卡。&lt;br /&gt;
* [[Serial ports|串口]]。&lt;br /&gt;
* 硬盘 (500MB绰绰有余)。&lt;br /&gt;
* [[PCI]]/[[ISA]] 总线。&lt;br /&gt;
* 网卡，例如 [[Ne2000|NE2000]] 或 [[3c90x]]。&lt;br /&gt;
&lt;br /&gt;
这种机器是一个很好的基础。 由此，你添加的任何其他内容都只是用来编写更多驱动程序的。 要执行测试，你可以从便携式介质 ([[Floppy]] 或 [[USB]]) 引导内核，或者使用 [[Diskless Booting]] 从开发PC下载内核。 从 [[Bootable CD|CD-ROM]] 引导是另一种选择，尽管它可能需要大量空白光盘 (或CD-RW)。 另一个很棒的技术是使用U盘: 只需在其上复制软盘映像，只要你使用BIOS routines来读取，BIOS就会为你模拟出一个软盘。&lt;br /&gt;
&lt;br /&gt;
Brendan在 [[topic:17948|这个]] 论坛主题中写了一篇关于购买和管理测试机的很好的指南。&lt;br /&gt;
&lt;br /&gt;
== 使用虚拟机进行测试 ==&lt;br /&gt;
使用虚拟机进行测试的优点是，它可以用一个非常简单的过程来编译然后运行你的新内核 (shell脚本可以使它成为一个命令过程)，如果你明智地选择你的模拟器，在调试消息方面，你可以获得很多免费帮助。  [[:Category:Emulators | 这里]]有一份仿真器列表。 也许最推荐给OSDev的两个是 [[Bochs]] 和 [[QEMU]]。 有关虚拟机测试的更多信息，请从相应的仿真器页面中获得。&lt;br /&gt;
&lt;br /&gt;
使用虚拟机的一个缺点是硬件的选择受到限制。 例如，Bochs和QEMU的 [[VGA Hardware| VGA]] 和 [[:Category:Network devices|网络]] 设备的选择有限。 他们模拟的那些设备可能 (尽管不太可能) 有错误，并且不像真正的设备那样运行 (模拟器有时内存为零，而真正的机器通常没有)。&lt;br /&gt;
&lt;br /&gt;
== 高级事项 ==&lt;br /&gt;
&lt;br /&gt;
=== 硬盘访问测试 ===&lt;br /&gt;
测试硬盘访问会带来比通常测试问题更麻烦，因为这意味着不太可能使用你的主要开发平台作为测试平台 (你可以坚持，但这通常是一个坏主意)。 但是，如果你确实需要 (由于缺少模拟器或第二台机器)，请参考以下指南:&lt;br /&gt;
* 你的内核应该非常稳定，以确保它不会写入内存中的随机位置，不是跟随空指针和其他类似的东西。 处于保护模式在这里是一个优势，因为你不会意外调用可能写入磁盘的BIOS代码。&lt;br /&gt;
* 首先在ramdisk上尝试文件系统代码。 ramdisk内容可以从头开始构建，也可以由引导加载程序加载的数据生成 ([[GRUB]] 的模块加载工具将是很好的工具) 确保你有能力检查ramdisk中写入的内容，而不必将ramdisk写入真实磁盘 (否则你也可以在真正的磁盘上试过)。&lt;br /&gt;
* 在开发 “将” 执行磁盘访问的组件时，请确保首先在 [[:Category:Emulators|模拟器]] 上对其进行测试，并确保其行为符合预期。 在磁盘功能中强制执行边界检查，这样你就不会弄错分区或类似的东西。 你甚至可以在低级驱动程序中对边界进行硬编码，并报告致命情况，如果上层组件要求它脱离磁盘上的 “安全” 阵列。&lt;br /&gt;
* 在一个与你的主磁盘单独的控制器 (例如不同的IDE电缆)尝试测试驱动器，这样你的代码将访问不会损害你的主磁盘的I/O端口。 如果所有其他方法都失败，请在专用的第二台计算机上进行测试。&lt;br /&gt;
&lt;br /&gt;
=== 寻找特定的硬件 ===&lt;br /&gt;
如果你需要为特定的硬件编写驱动程序，则有几种选择。 如果你尚未拥有旧的硬件设备，则可以在 [http://www.ebay.com eBay] (和其他类似的地方) 上购买。 你可能还想尝试 [[topic:2970|此]] 论坛主题，其中许多用户列出了一些用于测试其他用户操作系统的计算机。 [[:Category:Hardware|硬件分类]] 中列出的绝大多数硬件都相当普遍，并且将是开发的不错选择。&lt;br /&gt;
&lt;br /&gt;
=== 单元测试 ===&lt;br /&gt;
{{Main|Unit Testing}}&lt;br /&gt;
以上文章链接讨论了一种单独测试操作系统组件的方法，并安装测试驱动程序，以确保组件始终按预期工作 (例如，修复一个错误不会引入另一个错误)。&lt;br /&gt;
&lt;br /&gt;
== 另见 ==&lt;br /&gt;
=== 论坛主题 ===&lt;br /&gt;
*[[Topic:17948|Brendan's Guide to OS Testing]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Zhang3</name></author>
	</entry>
</feed>