Revisión | eda4e62cc2f5d12fcedcf799a5a3f9eba855ad77 (tree) |
---|---|
Tiempo | 2019-11-02 03:19:24 |
Autor | Philippe Mathieu-Daudé <philmd@redh...> |
Commiter | Philippe Mathieu-Daudé |
tests/fw_cfg: Test 'reboot-timeout=-1' special value
The special value -1 means "don't reboot" for QEMU/libvirt.
Add a trivial test.
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
@@ -194,6 +194,26 @@ static void test_fw_cfg_reboot_timeout(void) | ||
194 | 194 | qtest_quit(s); |
195 | 195 | } |
196 | 196 | |
197 | +static void test_fw_cfg_no_reboot_timeout(void) | |
198 | +{ | |
199 | + QFWCFG *fw_cfg; | |
200 | + QTestState *s; | |
201 | + uint32_t reboot_timeout = 0; | |
202 | + size_t filesize; | |
203 | + | |
204 | + /* Special value -1 means "don't reboot" */ | |
205 | + s = qtest_init("-boot reboot-timeout=-1"); | |
206 | + fw_cfg = pc_fw_cfg_init(s); | |
207 | + | |
208 | + filesize = qfw_cfg_get_file(fw_cfg, "etc/boot-fail-wait", | |
209 | + &reboot_timeout, sizeof(reboot_timeout)); | |
210 | + g_assert_cmpint(filesize, ==, sizeof(reboot_timeout)); | |
211 | + reboot_timeout = le32_to_cpu(reboot_timeout); | |
212 | + g_assert_cmpint(reboot_timeout, ==, UINT32_MAX); | |
213 | + pc_fw_cfg_uninit(fw_cfg); | |
214 | + qtest_quit(s); | |
215 | +} | |
216 | + | |
197 | 217 | static void test_fw_cfg_splash_time(void) |
198 | 218 | { |
199 | 219 | QFWCFG *fw_cfg; |
@@ -233,6 +253,7 @@ int main(int argc, char **argv) | ||
233 | 253 | qtest_add_func("fw_cfg/numa", test_fw_cfg_numa); |
234 | 254 | qtest_add_func("fw_cfg/boot_menu", test_fw_cfg_boot_menu); |
235 | 255 | qtest_add_func("fw_cfg/reboot_timeout", test_fw_cfg_reboot_timeout); |
256 | + qtest_add_func("fw_cfg/no_reboot_timeout", test_fw_cfg_no_reboot_timeout); | |
236 | 257 | qtest_add_func("fw_cfg/splash_time", test_fw_cfg_splash_time); |
237 | 258 | |
238 | 259 | return g_test_run(); |