Browse Source

tests: fw_cfg: add 'splash-time' test case

Signed-off-by: Li Qiang <liq3ea@163.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <2019042414.62457-6-liq3ea@163.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
master
Li Qiang 1 month ago
parent
commit
3ae9dd1a30
1 changed files with 20 additions and 0 deletions
  1. 20
    0
      tests/fw_cfg-test.c

+ 20
- 0
tests/fw_cfg-test.c View File

@@ -194,6 +194,25 @@ static void test_fw_cfg_reboot_timeout(void)
194 194
     qtest_quit(s);
195 195
 }
196 196
 
197
+static void test_fw_cfg_splash_time(void)
198
+{
199
+    QFWCFG *fw_cfg;
200
+    QTestState *s;
201
+    uint16_t splash_time = 0;
202
+    size_t filesize;
203
+
204
+    s = qtest_init("-boot splash-time=12");
205
+    fw_cfg = pc_fw_cfg_init(s);
206
+
207
+    filesize = qfw_cfg_get_file(fw_cfg, "etc/boot-menu-wait",
208
+                                &splash_time, sizeof(splash_time));
209
+    g_assert_cmpint(filesize, ==, sizeof(splash_time));
210
+    splash_time = le16_to_cpu(splash_time);
211
+    g_assert_cmpint(splash_time, ==, 12);
212
+    pc_fw_cfg_uninit(fw_cfg);
213
+    qtest_quit(s);
214
+}
215
+
197 216
 int main(int argc, char **argv)
198 217
 {
199 218
     g_test_init(&argc, &argv, NULL);
@@ -214,6 +233,7 @@ int main(int argc, char **argv)
214 233
     qtest_add_func("fw_cfg/numa", test_fw_cfg_numa);
215 234
     qtest_add_func("fw_cfg/boot_menu", test_fw_cfg_boot_menu);
216 235
     qtest_add_func("fw_cfg/reboot_timeout", test_fw_cfg_reboot_timeout);
236
+    qtest_add_func("fw_cfg/splash_time", test_fw_cfg_splash_time);
217 237
 
218 238
     return g_test_run();
219 239
 }

Loading…
Cancel
Save