SECURITY: Add SECURITY file
[grub.git] / grub-core / tests / videotest_checksum.c
bloba4bff5ed8754dbde4dc83511ff11e59f586a0781
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2013 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 /* All tests need to include test.h for GRUB testing framework. */
20 #include <grub/test.h>
21 #include <grub/dl.h>
22 #include <grub/video.h>
23 #include <grub/video_fb.h>
24 #include <grub/command.h>
25 #include <grub/font.h>
27 GRUB_MOD_LICENSE ("GPLv3+");
29 #define FONT_NAME "Unknown Regular 16"
31 /* Functional test main method. */
32 static void
33 videotest_checksum (void)
35 unsigned i;
36 grub_font_t font;
38 font = grub_font_get (FONT_NAME);
39 if (font && grub_strcmp (font->name, FONT_NAME) != 0)
40 font = 0;
41 if (!font)
42 font = grub_font_load ("unicode");
44 if (!font)
46 grub_test_assert (0, "unicode font not found: %s", grub_errmsg);
47 return;
50 for (i = 0; i < ARRAY_SIZE (grub_test_video_modes); i++)
52 grub_err_t err;
53 #if defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_IEEE1275)
54 if (grub_test_video_modes[i].width > 1024)
55 continue;
56 #endif
57 err = grub_video_capture_start (&grub_test_video_modes[i],
58 grub_video_fbstd_colors,
59 grub_test_video_modes[i].number_of_colors);
60 if (err)
62 grub_test_assert (0, "can't start capture: %s", grub_errmsg);
63 grub_print_error ();
64 continue;
66 grub_terminal_input_fake_sequence ((int []) { '\n' }, 1);
68 grub_video_checksum ("videotest");
70 char *args[] = { 0 };
71 grub_command_execute ("videotest", 0, args);
73 grub_terminal_input_fake_sequence_end ();
74 grub_video_checksum_end ();
75 grub_video_capture_end ();
79 /* Register example_test method as a functional test. */
80 GRUB_FUNCTIONAL_TEST (videotest_checksum, videotest_checksum);