summaryrefslogtreecommitdiffstats
path: root/grub-core/tests
diff options
context:
space:
mode:
Diffstat (limited to 'grub-core/tests')
-rw-r--r--grub-core/tests/boot/kbsd.init-i386.S107
-rw-r--r--grub-core/tests/boot/kbsd.init-x86_64.S94
-rw-r--r--grub-core/tests/boot/kbsd.spec.txt3
-rw-r--r--grub-core/tests/boot/kernel-8086.S50
-rw-r--r--grub-core/tests/boot/kernel-i386.S72
-rw-r--r--grub-core/tests/boot/kfreebsd-aout.cfg4
-rw-r--r--grub-core/tests/boot/kfreebsd.cfg8
-rw-r--r--grub-core/tests/boot/kfreebsd.init-i386.S109
-rw-r--r--grub-core/tests/boot/kfreebsd.init-x86_64.S90
-rw-r--r--grub-core/tests/boot/knetbsd.cfg5
-rw-r--r--grub-core/tests/boot/kopenbsd.cfg5
-rw-r--r--grub-core/tests/boot/kopenbsdlabel.txt3
-rw-r--r--grub-core/tests/boot/linux-ppc.cfg5
-rw-r--r--grub-core/tests/boot/linux.cfg5
-rw-r--r--grub-core/tests/boot/linux.init-i386.S61
-rw-r--r--grub-core/tests/boot/linux.init-mips.S61
-rw-r--r--grub-core/tests/boot/linux.init-ppc.S61
-rw-r--r--grub-core/tests/boot/linux.init-x86_64.S60
-rw-r--r--grub-core/tests/boot/linux16.cfg5
-rw-r--r--grub-core/tests/boot/multiboot.cfg4
-rw-r--r--grub-core/tests/boot/multiboot2.cfg4
-rw-r--r--grub-core/tests/boot/ntldr.cfg4
-rw-r--r--grub-core/tests/boot/pc-chainloader.cfg4
-rw-r--r--grub-core/tests/boot/qemu-shutdown-x86.S17
-rw-r--r--grub-core/tests/bswap_test.c121
-rw-r--r--grub-core/tests/checksums.h129
-rw-r--r--grub-core/tests/cmdline_cat_test.c125
-rw-r--r--grub-core/tests/cmp_test.c190
-rw-r--r--grub-core/tests/ctz_test.c111
-rw-r--r--grub-core/tests/div_test.c189
-rw-r--r--grub-core/tests/example_functional_test.c38
-rw-r--r--grub-core/tests/fake_input.c75
-rw-r--r--grub-core/tests/gfxterm_menu.c180
-rw-r--r--grub-core/tests/legacy_password_test.c68
-rw-r--r--grub-core/tests/lib/functional_test.c105
-rw-r--r--grub-core/tests/lib/test.c239
-rw-r--r--grub-core/tests/mul_test.c73
-rw-r--r--grub-core/tests/pbkdf2_test.c97
-rw-r--r--grub-core/tests/setjmp_test.c80
-rw-r--r--grub-core/tests/shift_test.c157
-rw-r--r--grub-core/tests/signature_test.c170
-rw-r--r--grub-core/tests/signatures.h211
-rw-r--r--grub-core/tests/sleep_test.c51
-rw-r--r--grub-core/tests/strtoull_test.c63
-rw-r--r--grub-core/tests/test_blockarg.c55
-rw-r--r--grub-core/tests/video_checksum.c813
-rw-r--r--grub-core/tests/videotest_checksum.c80
-rw-r--r--grub-core/tests/xnu_uuid_test.c58
48 files changed, 4319 insertions, 0 deletions
diff --git a/grub-core/tests/boot/kbsd.init-i386.S b/grub-core/tests/boot/kbsd.init-i386.S
new file mode 100644
index 0000000..72ddb7c
--- /dev/null
+++ b/grub-core/tests/boot/kbsd.init-i386.S
@@ -0,0 +1,107 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef TARGET_NETBSD
+#define SYSCALL_RESET 208
+#elif defined (TARGET_OPENBSD)
+#define SYSCALL_RESET 55
+#else
+#error unknown target
+#endif
+
+#define MODE_RDRW 2
+#define FLAGS_NONE 0
+#define SYSCALL_OPEN 5
+#define SYSCALL_WRITE 4
+#define SYSCALL_EXIT 1
+#define SYSCALL_ARCH 165
+#define SYSCALL_INT 0x80
+#define SYSCALL_ARCH_IOPL 2
+
+#define RESET_NOSYNC 0x4
+#define RESET_HALT 0x8
+#define RESET_POWEROFF 0x800
+
+ .section ".init", "ax"
+ .global start,_start
+start:
+_start:
+ /* open. */
+ movl $SYSCALL_OPEN, %eax
+ pushl $FLAGS_NONE
+ pushl $MODE_RDRW
+ leal device, %ebx
+ pushl %ebx
+ pushl $0
+ int $SYSCALL_INT
+ addl $16, %esp
+ movl %eax, %ecx
+
+ /* write. */
+ movl $SYSCALL_WRITE, %eax
+ pushl $(messageend-message)
+ leal message, %ebx
+ pushl %ebx
+ pushl %ecx
+ pushl $0
+ int $SYSCALL_INT
+ addl $16, %esp
+
+ /* IOPL. */
+ movl $SYSCALL_ARCH, %eax
+ pushl $iopl_arg
+ pushl $SYSCALL_ARCH_IOPL
+ pushl $0
+ int $SYSCALL_INT
+ addl $12, %esp
+
+#include "qemu-shutdown-x86.S"
+
+ /* shutdown. */
+ movl $SYSCALL_RESET, %eax
+ pushl $0
+ pushl $(RESET_POWEROFF|RESET_HALT|RESET_NOSYNC)
+ pushl $0
+ int $SYSCALL_INT
+ addl $8, %esp
+
+ /* exit (1). Shouldn't be reached. */
+ movl $SYSCALL_EXIT, %eax
+ pushl $1
+ pushl $0
+ int $SYSCALL_INT
+ .section ".fini", "ax"
+1: jmp 1b
+ .section ".text", "ax"
+1: jmp 1b
+ /* This section is needed for NetBSD to identify the binary. */
+ .section ".note.netbsd.ident", "a"
+ .long 0x7
+ .long 0x4
+ .long 0x1
+ .ascii "NetBSD"
+ .byte 0
+ .data
+device:
+ .ascii "/dev/console"
+ .byte 0
+message:
+ .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
+messageend:
+iopl_arg:
+ .long 3
diff --git a/grub-core/tests/boot/kbsd.init-x86_64.S b/grub-core/tests/boot/kbsd.init-x86_64.S
new file mode 100644
index 0000000..7486bc3
--- /dev/null
+++ b/grub-core/tests/boot/kbsd.init-x86_64.S
@@ -0,0 +1,94 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define MODE_RDRW 2
+#define FLAGS_NONE 0
+#define SYSCALL_OPEN 5
+#define SYSCALL_WRITE 4
+#ifdef TARGET_NETBSD
+#define SYSCALL_RESET 208
+#elif defined (TARGET_OPENBSD)
+#define SYSCALL_RESET 55
+#else
+#error unknown target
+#endif
+#define SYSCALL_EXIT 1
+#define SYSCALL_ARCH 165
+#define SYSCALL_INT 0x80
+#define SYSCALL_ARCH_IOPL 2
+
+#define RESET_NOSYNC 0x4
+#define RESET_HALT 0x8
+#define RESET_POWEROFF 0x800
+
+ .section ".init", "ax"
+ .global start,_start
+start:
+_start:
+ /* open. */
+ movq $SYSCALL_OPEN, %rax
+ leaq device, %rdi
+ movq $MODE_RDRW, %rsi
+ movq $FLAGS_NONE, %rdx
+ syscall
+ movq %rax, %rdi
+
+ /* write. */
+ movq $SYSCALL_WRITE, %rax
+ movq $(messageend-message), %rdx
+ leaq message, %rsi
+ syscall
+
+ /* IOPL. */
+ movq $SYSCALL_ARCH, %rax
+ movq $SYSCALL_ARCH_IOPL, %rdi
+ leaq iopl_arg, %rsi
+ syscall
+
+#include "qemu-shutdown-x86.S"
+
+ /* shutdown. */
+ movq $SYSCALL_RESET, %rax
+ movq $(RESET_POWEROFF|RESET_HALT|RESET_NOSYNC), %rdi
+ movq $0, %rsi
+ syscall
+
+ /* exit (1). Shouldn't be reached. */
+ movq $SYSCALL_EXIT, %rax
+ movq $1, %rdi
+ syscall
+ .section ".fini", "ax"
+1: jmp 1b
+ .section ".text", "ax"
+1: jmp 1b
+ /* This section is needed for NetBSD to identify the binary. */
+ .section ".note.netbsd.ident", "a"
+ .long 0x7
+ .long 0x4
+ .long 0x1
+ .ascii "NetBSD"
+ .byte 0
+ .data
+device:
+ .ascii "/dev/console"
+ .byte 0
+message:
+ .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
+messageend:
+iopl_arg:
+ .long 3
diff --git a/grub-core/tests/boot/kbsd.spec.txt b/grub-core/tests/boot/kbsd.spec.txt
new file mode 100644
index 0000000..af171bc
--- /dev/null
+++ b/grub-core/tests/boot/kbsd.spec.txt
@@ -0,0 +1,3 @@
+. type=dir
+ dev type=dir
+ console type=char device=0 mode=666 gid=0 uid=0
diff --git a/grub-core/tests/boot/kernel-8086.S b/grub-core/tests/boot/kernel-8086.S
new file mode 100644
index 0000000..5ec5368
--- /dev/null
+++ b/grub-core/tests/boot/kernel-8086.S
@@ -0,0 +1,50 @@
+
+ .text
+ .globl _start
+_start:
+base:
+ .code16
+ jmp cont
+
+serialmsg:
+1:
+ movb 0(%si), %bl
+ testb %bl, %bl
+ jz 1f
+ movw $0x3fd, %dx
+2:
+ inb %dx, %al
+ testb $0x20, %al
+ jz 2b
+
+ movw $0x3f8, %dx
+ movb %bl, %al
+ outb %al, %dx
+ incw %si
+ jmp 1b
+1:
+ ret
+
+cont:
+#ifdef TARGET_NTLDR
+ movw $0x2000, %ax
+#elif defined (TARGET_CHAINLOADER)
+ xorw %ax, %ax
+#else
+#error unsupported target
+#endif
+ movw %ax, %ds
+ lea message, %si
+ call serialmsg
+#include "qemu-shutdown-x86.S"
+
+1:
+ hlt
+ jmp 1b
+
+message:
+ .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
+ .byte 0
+
+ .org 510
+ .short 0xaa55
diff --git a/grub-core/tests/boot/kernel-i386.S b/grub-core/tests/boot/kernel-i386.S
new file mode 100644
index 0000000..2154d3b
--- /dev/null
+++ b/grub-core/tests/boot/kernel-i386.S
@@ -0,0 +1,72 @@
+#define ASM_FILE 1
+#ifdef TARGET_MULTIBOOT2
+#include <multiboot2.h>
+#elif defined (TARGET_MULTIBOOT)
+#include <multiboot.h>
+#endif
+
+ .text
+ /* Align 32 bits boundary. */
+ .align 8
+
+#ifdef TARGET_MULTIBOOT2
+ /* Multiboot header. */
+multiboot_header:
+ /* magic */
+ .long MULTIBOOT2_HEADER_MAGIC
+ /* ISA: i386 */
+ .long MULTIBOOT_ARCHITECTURE_I386
+ /* Header length. */
+ .long multiboot_header_end - multiboot_header
+ /* checksum */
+ .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + (multiboot_header_end - multiboot_header))
+ .short MULTIBOOT_HEADER_TAG_END
+ .short 0
+ .long 8
+multiboot_header_end:
+#elif defined (TARGET_MULTIBOOT)
+ /* Multiboot header. */
+multiboot_header:
+ /* magic */
+ .long MULTIBOOT_HEADER_MAGIC
+ /* flags */
+ .long 0
+ /* checksum */
+ .long -MULTIBOOT_HEADER_MAGIC
+#endif
+
+ .global start
+
+serialmsg:
+1:
+ movb 0(%esi), %bl
+ testb %bl, %bl
+ jz 1f
+ movw $0x3fd, %dx
+2:
+ inb %dx, %al
+ testb $0x20, %al
+ jz 2b
+
+ movw $0x3f8, %dx
+ movb %bl, %al
+ outb %al, %dx
+ incl %esi
+ jmp 1b
+1:
+ ret
+
+ .globl _start
+_start:
+ lea message, %esi
+ call serialmsg
+
+#include "qemu-shutdown-x86.S"
+
+1:
+ hlt
+ jmp 1b
+
+message:
+ .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
+ .byte 0
diff --git a/grub-core/tests/boot/kfreebsd-aout.cfg b/grub-core/tests/boot/kfreebsd-aout.cfg
new file mode 100644
index 0000000..31e34b4
--- /dev/null
+++ b/grub-core/tests/boot/kfreebsd-aout.cfg
@@ -0,0 +1,4 @@
+kfreebsd /kfreebsd.aout
+boot
+# Shouln't happen
+halt
diff --git a/grub-core/tests/boot/kfreebsd.cfg b/grub-core/tests/boot/kfreebsd.cfg
new file mode 100644
index 0000000..f28ee79
--- /dev/null
+++ b/grub-core/tests/boot/kfreebsd.cfg
@@ -0,0 +1,8 @@
+kfreebsd /kfreebsd -hv
+kfreebsd_loadenv /kfreebsd_env
+kfreebsd_module /mfsroot.gz type=mfs_root
+set kFreeBSD.hw.hasbrokenint12=1
+fakebios
+boot
+# Shouln't happen
+halt
diff --git a/grub-core/tests/boot/kfreebsd.init-i386.S b/grub-core/tests/boot/kfreebsd.init-i386.S
new file mode 100644
index 0000000..7a4baba
--- /dev/null
+++ b/grub-core/tests/boot/kfreebsd.init-i386.S
@@ -0,0 +1,109 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define MODE_RDRW 2
+#define FLAGS_NONE 0
+#define SYSCALL_OPEN 5
+#define SYSCALL_WRITE 4
+#define SYSCALL_RESET 55
+#define SYSCALL_FSYNC 95
+#define SYSCALL_ARCH 165
+#define SYSCALL_EXIT 1
+#define SYSCALL_ARCH_IOPERM 4
+#define SYSCALL_INT 0x80
+
+#define RESET_NOSYNC 0x4
+#define RESET_HALT 0x8
+#define RESET_POWEROFF 0x4000
+
+ .section ".init", "ax"
+ .global start,_start
+start:
+_start:
+ /* open. */
+ movl $SYSCALL_OPEN, %eax
+ pushl $FLAGS_NONE
+ pushl $MODE_RDRW
+ leal device, %ebx
+ pushl %ebx
+ pushl $0
+ int $SYSCALL_INT
+ addl $16, %esp
+ movl %eax, %ecx
+
+ /* write. */
+ movl $SYSCALL_WRITE, %eax
+ pushl $(messageend-message)
+ leal message, %ebx
+ pushl %ebx
+ pushl %ecx
+ pushl $0
+ int $SYSCALL_INT
+ addl $16, %esp
+
+ /* fsync. */
+ movl $SYSCALL_FSYNC, %eax
+ pushl %ecx
+ pushl $0
+ int $SYSCALL_INT
+ addl $8, %esp
+
+ /* IOPERM. */
+ movl $SYSCALL_ARCH, %eax
+ pushl $ioperm_arg1
+ pushl $SYSCALL_ARCH_IOPERM
+ pushl $0
+ int $SYSCALL_INT
+ addl $12, %esp
+
+ /* IOPERM. */
+ movl $SYSCALL_ARCH, %eax
+ pushl $ioperm_arg2
+ pushl $SYSCALL_ARCH_IOPERM
+ pushl $0
+ int $SYSCALL_INT
+ addl $12, %esp
+
+#include "qemu-shutdown-x86.S"
+
+ /* shutdown. */
+ movl $SYSCALL_RESET, %eax
+ pushl $(RESET_POWEROFF|RESET_HALT|RESET_NOSYNC)
+ pushl $0
+ int $SYSCALL_INT
+ addl $8, %esp
+
+ /* exit (1). Shouldn't be reached. */
+ movl $SYSCALL_EXIT, %eax
+ pushl $1
+ pushl $0
+ int $SYSCALL_INT
+device:
+ .ascii "/dev/console"
+ .byte 0
+message:
+ .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
+messageend:
+ioperm_arg1:
+ .long 0xcf8
+ .long 8
+ .long 1
+ioperm_arg2:
+ .long 0x7000
+ .long 8
+ .long 1
diff --git a/grub-core/tests/boot/kfreebsd.init-x86_64.S b/grub-core/tests/boot/kfreebsd.init-x86_64.S
new file mode 100644
index 0000000..05e5760
--- /dev/null
+++ b/grub-core/tests/boot/kfreebsd.init-x86_64.S
@@ -0,0 +1,90 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define MODE_RDRW 2
+#define FLAGS_NONE 0
+#define SYSCALL_ARCH 165
+#define SYSCALL_OPEN 5
+#define SYSCALL_WRITE 4
+#define SYSCALL_RESET 55
+#define SYSCALL_EXIT 1
+#define SYSCALL_ARCH_IOPERM 4
+#define SYSCALL_FSYNC 95
+
+#define RESET_NOSYNC 0x4
+#define RESET_HALT 0x8
+#define RESET_POWEROFF 0x4000
+
+ .section ".init", "ax"
+ .global start,_start
+start:
+_start:
+ /* open. */
+ movq $SYSCALL_OPEN, %rax
+ leaq device, %rdi
+ movq $MODE_RDRW, %rsi
+ movq $FLAGS_NONE, %rdx
+ syscall
+ movq %rax, %rdi
+
+ /* write. */
+ leaq message, %rsi
+ movq $SYSCALL_WRITE, %rax
+ movq $(messageend - message), %rdx
+ syscall
+
+ /* fsync. */
+ movq $SYSCALL_FSYNC, %rax
+ syscall
+
+ /* IOPERM. */
+ movq $SYSCALL_ARCH, %rax
+ movq $SYSCALL_ARCH_IOPERM, %rdi
+ leaq ioperm_arg1, %rsi
+ syscall
+
+ movq $SYSCALL_ARCH, %rax
+ movq $SYSCALL_ARCH_IOPERM, %rdi
+ leaq ioperm_arg2, %rsi
+ syscall
+
+#include "qemu-shutdown-x86.S"
+
+ /* shutdown. */
+ movq $SYSCALL_RESET, %rax
+ movq $(RESET_POWEROFF|RESET_HALT|RESET_NOSYNC), %rdi
+ syscall
+
+ /* exit (1). Shouldn't be reached. */
+ movq $SYSCALL_EXIT, %rax
+ movq $1, %rdi
+ syscall
+device:
+ .ascii "/dev/console"
+ .byte 0
+message:
+ .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
+messageend:
+ioperm_arg1:
+ .long 0xcf8
+ .long 8
+ .long 1
+ioperm_arg2:
+ .long 0x7000
+ .long 8
+ .long 1
diff --git a/grub-core/tests/boot/knetbsd.cfg b/grub-core/tests/boot/knetbsd.cfg
new file mode 100644
index 0000000..f88a846
--- /dev/null
+++ b/grub-core/tests/boot/knetbsd.cfg
@@ -0,0 +1,5 @@
+knetbsd /knetbsd -h
+knetbsd_module_elf /miniroot.gz
+boot
+# Shouln't happen
+halt
diff --git a/grub-core/tests/boot/kopenbsd.cfg b/grub-core/tests/boot/kopenbsd.cfg
new file mode 100644
index 0000000..132bec4
--- /dev/null
+++ b/grub-core/tests/boot/kopenbsd.cfg
@@ -0,0 +1,5 @@
+kopenbsd /kopenbsd -h
+kopenbsd_ramdisk /ramdisk
+boot
+# Shouln't happen
+halt
diff --git a/grub-core/tests/boot/kopenbsdlabel.txt b/grub-core/tests/boot/kopenbsdlabel.txt
new file mode 100644
index 0000000..bb14113
--- /dev/null
+++ b/grub-core/tests/boot/kopenbsdlabel.txt
@@ -0,0 +1,3 @@
+# size offset fstype [fsize bsize bps/cpg]
+ a: 256 0 4.2BSD 0 0 1
+ c: 256 0 unused 0 0 # "raw" part, don't edit
diff --git a/grub-core/tests/boot/linux-ppc.cfg b/grub-core/tests/boot/linux-ppc.cfg
new file mode 100644
index 0000000..3ceabc3
--- /dev/null
+++ b/grub-core/tests/boot/linux-ppc.cfg
@@ -0,0 +1,5 @@
+linux /linux console=ttyPZ1 root=/dev/ram0
+initrd /initrd
+boot
+# Shouln't happen
+halt
diff --git a/grub-core/tests/boot/linux.cfg b/grub-core/tests/boot/linux.cfg
new file mode 100644
index 0000000..f5bf6ac
--- /dev/null
+++ b/grub-core/tests/boot/linux.cfg
@@ -0,0 +1,5 @@
+linux /linux console=ttyS0 root=/dev/ram0
+initrd /initrd
+boot
+# Shouln't happen
+halt
diff --git a/grub-core/tests/boot/linux.init-i386.S b/grub-core/tests/boot/linux.init-i386.S
new file mode 100644
index 0000000..c0983ac
--- /dev/null
+++ b/grub-core/tests/boot/linux.init-i386.S
@@ -0,0 +1,61 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define SYSCALL_WRITE 4
+#define SYSCALL_RESET 88
+#define SYSCALL_IOPL 110
+#define SYSCALL_EXIT 1
+#define SYSCALL_INT 0x80
+
+#define STDOUT 1
+#define SHUTDOWN_MAGIC1 0xfee1dead
+#define SHUTDOWN_MAGIC2 0x28121969
+#define SHUTDOWN_MAGIC3 0x4321fedc
+
+ .text
+ .global start, _start
+_start:
+start:
+ /* write. */
+ movl $SYSCALL_WRITE, %eax
+ movl $STDOUT, %ebx
+ leal message, %ecx
+ movl $(messageend-message), %edx
+ int $SYSCALL_INT
+
+ movl $SYSCALL_IOPL, %eax
+ movl $3, %ebx
+ int $SYSCALL_INT
+
+#include "qemu-shutdown-x86.S"
+
+ /* shutdown. */
+ movl $SYSCALL_RESET, %eax
+ movl $SHUTDOWN_MAGIC1, %ebx
+ movl $SHUTDOWN_MAGIC2, %ecx
+ movl $SHUTDOWN_MAGIC3, %edx
+ int $SYSCALL_INT
+
+ /* exit (1). Shouldn't be reached. */
+ movl $SYSCALL_EXIT, %eax
+ movl $1, %ebx
+ int $SYSCALL_INT
+ .data
+message:
+ .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
+messageend:
diff --git a/grub-core/tests/boot/linux.init-mips.S b/grub-core/tests/boot/linux.init-mips.S
new file mode 100644
index 0000000..5ef4c37
--- /dev/null
+++ b/grub-core/tests/boot/linux.init-mips.S
@@ -0,0 +1,61 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define SYSCALL_WRITE 4004
+#define SYSCALL_RESET 4088
+#define SYSCALL_EXIT 4001
+
+#define STDOUT 1
+#define SHUTDOWN_MAGIC1 0xfee1dead
+#define SHUTDOWN_MAGIC2 0x28121969
+#ifdef REBOOT
+#define SHUTDOWN_MAGIC3 0x01234567
+#else
+#define SHUTDOWN_MAGIC3 0x4321fedc
+#endif
+ .text
+ .global start, _start, __start
+__start:
+_start:
+start:
+ /* write. */
+ li $v0, SYSCALL_WRITE
+ li $a0, STDOUT
+ lui $a1, %hi(message)
+ addiu $a1, %lo(message)
+ lui $a2, %hi(messageend)
+ addiu $a2, %lo(messageend)
+ subu $a2, $a2, $a1
+ syscall
+
+ /* shutdown. */
+ li $v0, SYSCALL_RESET
+ li $a0, SHUTDOWN_MAGIC1
+ li $a1, SHUTDOWN_MAGIC2
+ li $a2, SHUTDOWN_MAGIC3
+ syscall
+
+ /* exit(1). Shouldn't be reached. */
+ li $v0, SYSCALL_EXIT
+ li $a0, 1
+ syscall
+
+ .data
+message:
+ .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
+messageend:
diff --git a/grub-core/tests/boot/linux.init-ppc.S b/grub-core/tests/boot/linux.init-ppc.S
new file mode 100644
index 0000000..8c9aa44
--- /dev/null
+++ b/grub-core/tests/boot/linux.init-ppc.S
@@ -0,0 +1,61 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2012 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define SYSCALL_WRITE 4
+#define SYSCALL_RESET 88
+#define SYSCALL_EXIT 1
+
+#define STDOUT 1
+#define SHUTDOWN_MAGIC1 0xfee1dead
+#define SHUTDOWN_MAGIC2 0x28121969
+#define SHUTDOWN_MAGIC3 0x4321fedc
+
+ .text
+ .global start, _start, __start
+__start:
+_start:
+start:
+ /* write. */
+ li %r0, SYSCALL_WRITE
+ li %r3, STDOUT
+ lis %r4, message@h
+ ori %r4, %r4, message@l
+ lis %r5, messageend@h
+ ori %r5, %r5, messageend@l
+ sub %r5, %r5, %r4
+ sc
+
+ /* shutdown. */
+ li %r0, SYSCALL_RESET
+ lis %r3, SHUTDOWN_MAGIC1@h
+ ori %r3, %r3, SHUTDOWN_MAGIC1@l
+ lis %r4, SHUTDOWN_MAGIC2@h
+ ori %r4, %r4, SHUTDOWN_MAGIC2@l
+ lis %r5, SHUTDOWN_MAGIC3@h
+ ori %r5, %r5, SHUTDOWN_MAGIC3@l
+ sc
+
+ /* exit(1). Shouldn't be reached. */
+ li %r0, SYSCALL_EXIT
+ li %r3, 1
+ sc
+
+ .data
+message:
+ .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
+messageend:
diff --git a/grub-core/tests/boot/linux.init-x86_64.S b/grub-core/tests/boot/linux.init-x86_64.S
new file mode 100644
index 0000000..90bdcc3
--- /dev/null
+++ b/grub-core/tests/boot/linux.init-x86_64.S
@@ -0,0 +1,60 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define SYSCALL_WRITE 1
+#define SYSCALL_RESET 169
+#define SYSCALL_IOPL 172
+#define SYSCALL_EXIT 60
+
+#define STDOUT 1
+#define SHUTDOWN_MAGIC1 0xfee1dead
+#define SHUTDOWN_MAGIC2 0x28121969
+#define SHUTDOWN_MAGIC3 0x4321fedc
+
+ .text
+ .global start, _start
+_start:
+start:
+ /* write. */
+ movq $SYSCALL_WRITE, %rax
+ movq $STDOUT, %rdi
+ leaq message, %rsi
+ movq $(messageend-message), %rdx
+ syscall
+
+ movq $SYSCALL_IOPL, %rax
+ movq $3, %rdi
+ syscall
+
+#include "qemu-shutdown-x86.S"
+
+ /* shutdown. */
+ movq $SYSCALL_RESET, %rax
+ movq $SHUTDOWN_MAGIC1, %rdi
+ movq $SHUTDOWN_MAGIC2, %rsi
+ movq $SHUTDOWN_MAGIC3, %rdx
+ syscall
+
+ /* exit(1). Shouldn't be reached. */
+ movq $SYSCALL_EXIT, %rax
+ movq $1, %rdi
+ syscall
+ .data
+message:
+ .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
+messageend:
diff --git a/grub-core/tests/boot/linux16.cfg b/grub-core/tests/boot/linux16.cfg
new file mode 100644
index 0000000..d7fbf96
--- /dev/null
+++ b/grub-core/tests/boot/linux16.cfg
@@ -0,0 +1,5 @@
+linux16 /linux console=ttyS0 root=/dev/ram0
+initrd16 /initrd
+boot
+# Shouln't happen
+halt
diff --git a/grub-core/tests/boot/multiboot.cfg b/grub-core/tests/boot/multiboot.cfg
new file mode 100644
index 0000000..0942ec6
--- /dev/null
+++ b/grub-core/tests/boot/multiboot.cfg
@@ -0,0 +1,4 @@
+multiboot /multiboot.elf
+boot
+# Shouln't happen
+halt
diff --git a/grub-core/tests/boot/multiboot2.cfg b/grub-core/tests/boot/multiboot2.cfg
new file mode 100644
index 0000000..2bec9e6
--- /dev/null
+++ b/grub-core/tests/boot/multiboot2.cfg
@@ -0,0 +1,4 @@
+multiboot2 /multiboot2.elf
+boot
+# Shouln't happen
+halt
diff --git a/grub-core/tests/boot/ntldr.cfg b/grub-core/tests/boot/ntldr.cfg
new file mode 100644
index 0000000..cd438a4
--- /dev/null
+++ b/grub-core/tests/boot/ntldr.cfg
@@ -0,0 +1,4 @@
+ntldr /ntldr.bin
+boot
+# Shouln't happen
+halt
diff --git a/grub-core/tests/boot/pc-chainloader.cfg b/grub-core/tests/boot/pc-chainloader.cfg
new file mode 100644
index 0000000..1e80a5b
--- /dev/null
+++ b/grub-core/tests/boot/pc-chainloader.cfg
@@ -0,0 +1,4 @@
+chainloader /pc-chainloader.bin
+boot
+# Shouln't happen
+halt
diff --git a/grub-core/tests/boot/qemu-shutdown-x86.S b/grub-core/tests/boot/qemu-shutdown-x86.S
new file mode 100644
index 0000000..e37f5df
--- /dev/null
+++ b/grub-core/tests/boot/qemu-shutdown-x86.S
@@ -0,0 +1,17 @@
+ movl $0x80000b80, %eax
+ movw $0xcf8, %dx
+ outl %eax, %dx
+ movw $0xcfc, %dx
+ inb %dx, %al
+ orb $1, %al
+ outb %al, %dx
+
+ movl $0x80000b40, %eax
+ movw $0xcf8, %dx
+ outl %eax, %dx
+ movl $0x7001, %eax
+ movw $0xcfc, %dx
+ outl %eax, %dx
+ movw $0x2000, %ax
+ movw $0x7004, %dx
+ outw %ax, %dx
diff --git a/grub-core/tests/bswap_test.c b/grub-core/tests/bswap_test.c
new file mode 100644
index 0000000..4eb3a98
--- /dev/null
+++ b/grub-core/tests/bswap_test.c
@@ -0,0 +1,121 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2015 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/misc.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static grub_uint64_t vectors[] = {
+ 0xffffffffffffffffULL, 1, 2, 0, 0x0102030405060708ULL
+};
+
+static void
+test16 (grub_uint16_t a)
+{
+ grub_uint16_t b, c;
+ grub_uint8_t *ap, *bp;
+ int i;
+ b = grub_swap_bytes16 (a);
+ c = grub_swap_bytes16 (b);
+ grub_test_assert (a == c, "bswap not idempotent: 0x%llx, 0x%llx, 0x%llx",
+ (long long) a, (long long) b, (long long) c);
+ ap = (grub_uint8_t *) &a;
+ bp = (grub_uint8_t *) &b;
+ for (i = 0; i < 2; i++)
+ {
+ grub_test_assert (ap[i] == bp[1 - i],
+ "bswap bytes wrong: 0x%llx, 0x%llx",
+ (long long) a, (long long) b);
+ }
+}
+
+static void
+test32 (grub_uint32_t a)
+{
+ grub_uint32_t b, c;
+ grub_uint8_t *ap, *bp;
+ int i;
+ b = grub_swap_bytes32 (a);
+ c = grub_swap_bytes32 (b);
+ grub_test_assert (a == c, "bswap not idempotent: 0x%llx, 0x%llx, 0x%llx",
+ (long long) a, (long long) b, (long long) c);
+ ap = (grub_uint8_t *) &a;
+ bp = (grub_uint8_t *) &b;
+ for (i = 0; i < 4; i++)
+ {
+ grub_test_assert (ap[i] == bp[3 - i],
+ "bswap bytes wrong: 0x%llx, 0x%llx",
+ (long long) a, (long long) b);
+ }
+}
+
+static void
+test64 (grub_uint64_t a)
+{
+ grub_uint64_t b, c;
+ grub_uint8_t *ap, *bp;
+ int i;
+ b = grub_swap_bytes64 (a);
+ c = grub_swap_bytes64 (b);
+ grub_test_assert (a == c, "bswap not idempotent: 0x%llx, 0x%llx, 0x%llx",
+ (long long) a, (long long) b, (long long) c);
+ ap = (grub_uint8_t *) &a;
+ bp = (grub_uint8_t *) &b;
+ for (i = 0; i < 4; i++)
+ {
+ grub_test_assert (ap[i] == bp[7 - i],
+ "bswap bytes wrong: 0x%llx, 0x%llx",
+ (long long) a, (long long) b);
+ }
+}
+
+static void
+test_all(grub_uint64_t a)
+{
+ test64 (a);
+ test32 (a);
+ test16 (a);
+}
+
+static void
+bswap_test (void)
+{
+ grub_uint64_t a = 404, b = 7;
+ grub_size_t i;
+
+ for (i = 0; i < ARRAY_SIZE (vectors); i++)
+ {
+ test_all (vectors[i]);
+ }
+ for (i = 0; i < 40000; i++)
+ {
+ a = 17 * a + 13 * b;
+ b = 23 * a + 29 * b;
+ if (b == 0)
+ b = 1;
+ if (a == 0)
+ a = 1;
+ test_all (a);
+ test_all (b);
+ }
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (bswap_test, bswap_test);
diff --git a/grub-core/tests/checksums.h b/grub-core/tests/checksums.h
new file mode 100644
index 0000000..8273bd1
--- /dev/null
+++ b/grub-core/tests/checksums.h
@@ -0,0 +1,129 @@
+ { "cmdline_cat", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xc69be699, 0xc69be699, 0xe17fc97c, 0xe17fc97c, 0xc2512486, 0xc2512486, 0x20260761, 0x20260761, 0xe3485349, 0xe3485349, 0x6020b4d9, 0x6020b4d9, 0x1605db98, 0x1605db98, 0xdca51b58, 0xdca51b58, 0xf3d66441, 0xf3d66441, 0x18cb7ce2, 0x18cb7ce2, 0x23b616d9, 0x23b616d9, 0xa1bf5dbf, 0xa1bf5dbf, 0x5e4a8b3d, 0x5e4a8b3d, 0x9933b3d8, 0x9933b3d8, 0xce7be2de, 0xce7be2de, 0x62531729, 0x62531729, 0xc39d3788, 0xc39d3788, 0xf7aee2fe, 0xf7aee2fe, 0xc66f4903, 0xc66f4903, 0x536c922f, 0x536c922f, 0xcb231652, 0x4ae07b67, 0x146816d5, 0x146816d5, }, 45 },
+ { "cmdline_cat", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x29d0cfb7, 0x29d0cfb7, 0x4d57ad88, 0x4d57ad88, 0xaf7591cb, 0xaf7591cb, 0xb88e3c0, 0xb88e3c0, 0x5d55a031, 0x5d55a031, 0x4363bcff, 0x4363bcff, 0xe1142833, 0xe1142833, 0x9578c80d, 0x9578c80d, 0xff1f5174, 0xff1f5174, 0x6828d47, 0x6828d47, 0x2a849ae3, 0x2a849ae3, 0x27a811d9, 0x27a811d9, 0x6c42e1cb, 0x6c42e1cb, 0x5bba61f5, 0x5bba61f5, 0xc02ab705, 0xc02ab705, 0xeb3e0e05, 0xeb3e0e05, 0x6f4ce3c, 0x6f4ce3c, 0x2075c50e, 0x2075c50e, 0x54ac7fba, 0x54ac7fba, 0x335d1c21, 0x335d1c21, 0xf923fbd1, 0x1b489d4d, 0x1253eb5e, 0x1253eb5e, }, 45 },
+ { "cmdline_cat", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x6ff92a98, 0x6ff92a98, 0xbd8264b3, 0xbd8264b3, 0x5c50282c, 0x5c50282c, 0xd18d6a5a, 0xd18d6a5a, 0x99cea139, 0x99cea139, 0x2590c545, 0x2590c545, 0x55c86045, 0x55c86045, 0xad53ef1e, 0xad53ef1e, 0x5b44a23a, 0x5b44a23a, 0xa255f863, 0xa255f863, 0x85b0bdca, 0x85b0bdca, 0x4220ee1f, 0x4220ee1f, 0xeb991a9f, 0xeb991a9f, 0x86f366dd, 0x86f366dd, 0xfa176b7d, 0xfa176b7d, 0xd7384ca9, 0xd7384ca9, 0xceebf5c1, 0xceebf5c1, 0xae62b268, 0xae62b268, 0x6e89bbd6, 0x6e89bbd6, 0x3fe07c8e, 0x3fe07c8e, 0xee5358fe, 0x162d1a8a, 0x876f8d10, 0x876f8d10, }, 45 },
+ { "cmdline_cat", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xb96afaea, 0xb96afaea, 0xaa16ab1e, 0xaa16ab1e, 0x51ff382, 0x51ff382, 0xec74f127, 0xec74f127, 0xde4bca99, 0xde4bca99, 0x8ef3e8a5, 0x8ef3e8a5, 0x2daeb0b4, 0x2daeb0b4, 0x7cf5e243, 0x7cf5e243, 0x11fd57c6, 0x11fd57c6, 0x140723af, 0x140723af, 0x2bd93833, 0x2bd93833, 0xd731f4ac, 0xd731f4ac, 0x5fcd7114, 0x5fcd7114, 0xd1fea24a, 0xd1fea24a, 0x4083d53a, 0x4083d53a, 0x2e372605, 0x2e372605, 0x8e6316a7, 0x8e6316a7, 0x283ef6cc, 0x283ef6cc, 0x20cee9de, 0x20cee9de, 0xad6fa187, 0xad6fa187, 0xd691f438, 0xf3257e63, 0x4786ba7, 0x4786ba7, }, 45 },
+ { "cmdline_cat", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x48acf1bf, 0x48acf1bf, 0xb8777469, 0xb8777469, 0xad2fad44, 0xad2fad44, 0xa415ac59, 0xa415ac59, 0x5a7bfb26, 0x5a7bfb26, 0xccb6016, 0xccb6016, 0x77a80cb3, 0x77a80cb3, 0x2034c102, 0x2034c102, 0x444b4ccd, 0x444b4ccd, 0xe6c31bea, 0xe6c31bea, 0x8408036e, 0x8408036e, 0x9e7c556f, 0x9e7c556f, 0x445dc388, 0x445dc388, 0x94b3f850, 0x94b3f850, 0xf6f15341, 0xf6f15341, 0xcb939b5f, 0xcb939b5f, 0xbe88067d, 0xbe88067d, 0x1efc4734, 0x1efc4734, 0x7f5dfca8, 0x7f5dfca8, 0xb7b10eb9, 0xb7b10eb9, 0xb94cb441, 0x9571329, 0x8a26912b, 0x8a26912b, }, 45 },
+ { "cmdline_cat", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xc508d04e, 0xc508d04e, 0x6dbccbfe, 0x6dbccbfe, 0xbf06ff60, 0xbf06ff60, 0xbc5ab06, 0xbc5ab06, 0x97eeab3c, 0x97eeab3c, 0x62663589, 0x62663589, 0xb03e21e2, 0xb03e21e2, 0xea196bb6, 0xea196bb6, 0x672c16c4, 0x672c16c4, 0xefbca2cd, 0xefbca2cd, 0x1af5b410, 0x1af5b410, 0xc7a80569, 0xc7a80569, 0x4926a16, 0x4926a16, 0xee29c99c, 0xee29c99c, 0xffb15985, 0xffb15985, 0x4f608e46, 0x4f608e46, 0x3e450fd2, 0x3e450fd2, 0xac45215f, 0xac45215f, 0x789b0ce7, 0x789b0ce7, 0x4cedfe22, 0x4cedfe22, 0xa005588c, 0x701da05c, 0x6f25cec1, 0x6f25cec1, }, 45 },
+ { "cmdline_cat", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x29e7a7f, 0x29e7a7f, 0xbd221052, 0xbd221052, 0x3b18b64, 0x3b18b64, 0x7f1e8462, 0x7f1e8462, 0xf28d5124, 0xf28d5124, 0xc336f170, 0xc336f170, 0xfe3bf988, 0xfe3bf988, 0x7bf89e05, 0x7bf89e05, 0x7857a3f8, 0x7857a3f8, 0x272c1a36, 0x272c1a36, 0xe8adb445, 0xe8adb445, 0x70cfe280, 0x70cfe280, 0x4f2b6120, 0x4f2b6120, 0xbaf5caa5, 0xbaf5caa5, 0x4b6bcab2, 0x4b6bcab2, 0x2bef7b92, 0x2bef7b92, 0x17b381dc, 0x17b381dc, 0x884c9c35, 0x884c9c35, 0x2f9eb909, 0x2f9eb909, 0xa811b3af, 0xa811b3af, 0x4c39478f, 0x5a72c3ab, 0x8071678a, 0x8071678a, }, 45 },
+ { "gfxterm_menu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xd9f04953, 0xbf3fa5d0, 0xd9f04953, 0x9a068414, 0x59c36f00, 0x59c36f00, 0x620c0067, 0x620c0067, 0x620c0067, 0x1c8c6d01, 0x1c8c6d01, 0x1c8c6d01, 0xc3269013, 0xc3269013, 0xc3269013, 0x59c36f00, 0x9a068414, 0x9a068414, 0x59c36f00, }, 20 },
+ { "gfxterm_menu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x9254157f, 0x367e92c7, 0x9254157f, 0xbc519000, 0xaa4593fe, 0xaa4593fe, 0xa8a596c8, 0xa8a596c8, 0xa8a596c8, 0xe509baf, 0xe509baf, 0xe509baf, 0x16f0dc06, 0x16f0dc06, 0x16f0dc06, 0xaa4593fe, 0xbc519000, 0xbc519000, 0xaa4593fe, }, 20 },
+ { "gfxterm_menu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x354b1976, 0x8fc746ae, 0x354b1976, 0x685c74f2, 0xc9cbf769, 0xc9cbf769, 0x3ce35e1d, 0x3ce35e1d, 0x3ce35e1d, 0xc23b9fd1, 0xc23b9fd1, 0xc23b9fd1, 0x5b18528e, 0x5b18528e, 0x5b18528e, 0xc9cbf769, 0x685c74f2, 0x685c74f2, 0xc9cbf769, }, 20 },
+ { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x1c9ec014, 0xaf3ec923, 0x1c9ec014, 0x43f5296, 0x9813a416, 0x9813a416, 0x43fda3fa, 0x43fda3fa, 0x43fda3fa, 0xd22625c9, 0xd22625c9, 0xd22625c9, 0x76a62c0a, 0x76a62c0a, 0x76a62c0a, 0x9813a416, 0x43f5296, 0x43f5296, 0x9813a416, }, 20 },
+ { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xa704f7ea, 0xb7f2ec8b, 0xa704f7ea, 0xb279bf59, 0x5fcf013d, 0x5fcf013d, 0xf3582c48, 0xf3582c48, 0xf3582c48, 0x2148343e, 0x2148343e, 0x2148343e, 0x9c719024, 0x9c719024, 0x9c719024, 0x5fcf013d, 0xb279bf59, 0xb279bf59, 0x5fcf013d, }, 20 },
+ { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xf293ce36, 0xa6eb6ae8, 0xf293ce36, 0xcd87647e, 0xdd28f52b, 0xdd28f52b, 0xb3c7ef80, 0xb3c7ef80, 0xb3c7ef80, 0x92fb1664, 0x92fb1664, 0x92fb1664, 0xd15b5e2e, 0xd15b5e2e, 0xd15b5e2e, 0xdd28f52b, 0xcd87647e, 0xcd87647e, 0xdd28f52b, }, 20 },
+ { "gfxterm_menu", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x31e75bd7, 0x9a768c6a, 0x31e75bd7, 0xa8fc31a6, 0x43d1f34, 0x43d1f34, 0xa0717008, 0xa0717008, 0xa0717008, 0xdf7bd9a0, 0xdf7bd9a0, 0xdf7bd9a0, 0x8e5a9312, 0x8e5a9312, 0x8e5a9312, 0x43d1f34, 0xa8fc31a6, 0xa8fc31a6, 0x43d1f34, }, 20 },
+ { "gfxmenu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x1ce7bd78, 0x682580f5, 0x1ce7bd78, 0x490ad6fe, 0x9a2e0d26, 0x64eb71ba, 0x64eb71ba, 0x64eb71ba, 0x3833877a, 0x3833877a, 0x3833877a, 0xcfc14f0a, 0xcfc14f0a, 0xcfc14f0a, 0x59c36f00, 0x490ad6fe, 0x490ad6fe, }, 18 },
+ { "gfxmenu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x2b6ff87d, 0x63ce2ca2, 0x2b6ff87d, 0xf00f044e, 0xa9d58ccd, 0xe2c46577, 0xe2c46577, 0xe2c46577, 0xb79bcf7d, 0xb79bcf7d, 0xb79bcf7d, 0xbc30ed71, 0xbc30ed71, 0xbc30ed71, 0xaa4593fe, 0xf00f044e, 0xf00f044e, }, 18 },
+ { "gfxmenu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xe61cadba, 0x9880b727, 0xe61cadba, 0xdf5f2fc0, 0x5411be8b, 0x4449774e, 0x4449774e, 0x4449774e, 0x3bf7d1da, 0x3bf7d1da, 0x3bf7d1da, 0xd2ddee01, 0xd2ddee01, 0xd2ddee01, 0xc9cbf769, 0xdf5f2fc0, 0xdf5f2fc0, }, 18 },
+ { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x1c3742c9, 0xbe54acf7, 0x9b4ce770, 0xbe54acf7, 0x3111489, 0x740d78cf, 0x314c4c59, 0x314c4c59, 0x314c4c59, 0xdae9a625, 0xdae9a625, 0xdae9a625, 0xcbf8af57, 0xcbf8af57, 0xcbf8af57, 0x1c3742c9, 0x3111489, 0x3111489, }, 18 },
+ { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0xee571de5, 0x568aaeff, 0xee571de5, 0xe328b7a7, 0xbcda144c, 0xf56e1b60, 0xf56e1b60, 0xf56e1b60, 0x9a27c771, 0x9a27c771, 0x9a27c771, 0xd6d05397, 0xd6d05397, 0xd6d05397, 0xcc5a7bed, 0xe328b7a7, 0xe328b7a7, }, 18 },
+ { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xef4a3312, 0x1db9877c, 0x7e1afeae, 0x1db9877c, 0x8fc0c430, 0x5d55a141, 0x96f335c6, 0x96f335c6, 0x96f335c6, 0x504171d8, 0x504171d8, 0x504171d8, 0x69f71c0, 0x69f71c0, 0x69f71c0, 0xef4a3312, 0x8fc0c430, 0x8fc0c430, }, 18 },
+ { "gfxmenu", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x54e48d80, 0x151819bd, 0xea8d4865, 0x151819bd, 0x11d75fd2, 0x6d6bb4bc, 0x650ccd09, 0x650ccd09, 0x650ccd09, 0xe4ff3bd8, 0xe4ff3bd8, 0xe4ff3bd8, 0xc5308b73, 0xc5308b73, 0xc5308b73, 0x54e48d80, 0x11d75fd2, 0x11d75fd2, }, 18 },
+ { "gfxterm_ar", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xd0b06c3d, 0xde50d1a5, 0xd0b06c3d, 0x9346a17a, 0x59c36f00, 0x59c36f00, 0xacff5d47, 0xacff5d47, 0xacff5d47, 0xd27f3021, 0xd27f3021, 0xd27f3021, 0xdd5cd33, 0xdd5cd33, 0xdd5cd33, 0x59c36f00, 0x9346a17a, 0x9346a17a, 0x59c36f00, }, 20 },
+ { "gfxterm_ar", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xf32d50c1, 0x730a7ed, 0xf32d50c1, 0xdd28d5be, 0xaa4593fe, 0xaa4593fe, 0xba8a2d4c, 0xba8a2d4c, 0xba8a2d4c, 0x1c7f202b, 0x1c7f202b, 0x1c7f202b, 0x4df6782, 0x4df6782, 0x4df6782, 0xaa4593fe, 0xdd28d5be, 0xdd28d5be, 0xaa4593fe, }, 20 },
+ { "gfxterm_ar", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x711a4ac1, 0x6396f14c, 0x711a4ac1, 0x2c0d2745, 0xc9cbf769, 0xc9cbf769, 0x6b6ccbb0, 0x6b6ccbb0, 0x6b6ccbb0, 0x95b40a7c, 0x95b40a7c, 0x95b40a7c, 0xc97c723, 0xc97c723, 0xc97c723, 0xc9cbf769, 0x2c0d2745, 0x2c0d2745, 0xc9cbf769, }, 20 },
+ { "gfxterm_ar", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x29baad6a, 0x348b1f2b, 0x29baad6a, 0x311b3fe8, 0x9813a416, 0x9813a416, 0xe8e982cc, 0xe8e982cc, 0xe8e982cc, 0x793204ff, 0x793204ff, 0x793204ff, 0xddb20d3c, 0xddb20d3c, 0xddb20d3c, 0x9813a416, 0x311b3fe8, 0x311b3fe8, 0x9813a416, }, 20 },
+ { "gfxterm_ar", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xf834b3bb, 0x3951bd1a, 0xf834b3bb, 0xed49fb08, 0x5fcf013d, 0x5fcf013d, 0x5aefa2a7, 0x5aefa2a7, 0x5aefa2a7, 0x88ffbad1, 0x88ffbad1, 0x88ffbad1, 0x35c61ecb, 0x35c61ecb, 0x35c61ecb, 0x5fcf013d, 0xed49fb08, 0xed49fb08, 0x5fcf013d, }, 20 },
+ { "gfxterm_ar", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x7e9a7a47, 0xb1651b5a, 0x7e9a7a47, 0x418ed00f, 0xdd28f52b, 0xdd28f52b, 0x83f9db69, 0x83f9db69, 0x83f9db69, 0xa2c5228d, 0xa2c5228d, 0xa2c5228d, 0xe1656ac7, 0xe1656ac7, 0xe1656ac7, 0xdd28f52b, 0x418ed00f, 0x418ed00f, 0xdd28f52b, }, 20 },
+ { "gfxterm_ar", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xc6a0340, 0x7dd5855c, 0xc6a0340, 0x95716931, 0x43d1f34, 0x43d1f34, 0x5f1c24c0, 0x5f1c24c0, 0x5f1c24c0, 0x20168d68, 0x20168d68, 0x20168d68, 0x7137c7da, 0x7137c7da, 0x7137c7da, 0x43d1f34, 0x95716931, 0x95716931, 0x43d1f34, }, 20 },
+ { "gfxterm_cyr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xd3798aaa, 0xab48784c, 0xd3798aaa, 0x908f47ed, 0x59c36f00, 0x59c36f00, 0x1688ec7c, 0x1688ec7c, 0x1688ec7c, 0x6808811a, 0x6808811a, 0x6808811a, 0xb7a27c08, 0xb7a27c08, 0xb7a27c08, 0x59c36f00, 0x908f47ed, 0x908f47ed, 0x59c36f00, }, 20 },
+ { "gfxterm_cyr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xc30d9d2a, 0x60b9ed26, 0xc30d9d2a, 0xed081855, 0xaa4593fe, 0xaa4593fe, 0x3eba2192, 0x3eba2192, 0x3eba2192, 0x984f2cf5, 0x984f2cf5, 0x984f2cf5, 0x80ef6b5c, 0x80ef6b5c, 0x80ef6b5c, 0xaa4593fe, 0xed081855, 0xed081855, 0xaa4593fe, }, 20 },
+ { "gfxterm_cyr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xe469e6af, 0x46ac2012, 0xe469e6af, 0xb97e8b2b, 0xc9cbf769, 0xc9cbf769, 0x60f0d993, 0x60f0d993, 0x60f0d993, 0x9e28185f, 0x9e28185f, 0x9e28185f, 0x70bd500, 0x70bd500, 0x70bd500, 0xc9cbf769, 0xb97e8b2b, 0xb97e8b2b, 0xc9cbf769, }, 20 },
+ { "gfxterm_cyr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x8538d2ef, 0xab143284, 0x8538d2ef, 0x9d99406d, 0x9813a416, 0x9813a416, 0x7e8326ec, 0x7e8326ec, 0x7e8326ec, 0xef58a0df, 0xef58a0df, 0xef58a0df, 0x4bd8a91c, 0x4bd8a91c, 0x4bd8a91c, 0x9813a416, 0x9d99406d, 0x9d99406d, 0x9813a416, }, 20 },
+ { "gfxterm_cyr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x8115198c, 0x1abdaee1, 0x8115198c, 0x9468513f, 0x5fcf013d, 0x5fcf013d, 0xa5e86484, 0xa5e86484, 0xa5e86484, 0x77f87cf2, 0x77f87cf2, 0x77f87cf2, 0xcac1d8e8, 0xcac1d8e8, 0xcac1d8e8, 0x5fcf013d, 0x9468513f, 0x9468513f, 0x5fcf013d, }, 20 },
+ { "gfxterm_cyr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xea03b805, 0x74148290, 0xea03b805, 0xd517124d, 0xdd28f52b, 0xdd28f52b, 0x8f6eee40, 0x8f6eee40, 0x8f6eee40, 0xae5217a4, 0xae5217a4, 0xae5217a4, 0xedf25fee, 0xedf25fee, 0xedf25fee, 0xdd28f52b, 0xd517124d, 0xd517124d, 0xdd28f52b, }, 20 },
+ { "gfxterm_cyr", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xa044490f, 0xe23458db, 0xa044490f, 0x395f237e, 0x43d1f34, 0x43d1f34, 0xe1ca82c2, 0xe1ca82c2, 0xe1ca82c2, 0x9ec02b6a, 0x9ec02b6a, 0x9ec02b6a, 0xcfe161d8, 0xcfe161d8, 0xcfe161d8, 0x43d1f34, 0x395f237e, 0x395f237e, 0x43d1f34, }, 20 },
+ { "gfxterm_heb", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xf3259b30, 0xf1f01411, 0xf3259b30, 0xb0d35677, 0x59c36f00, 0x59c36f00, 0x97895f8e, 0x97895f8e, 0x97895f8e, 0xe90932e8, 0xe90932e8, 0xe90932e8, 0x36a3cffa, 0x36a3cffa, 0x36a3cffa, 0x59c36f00, 0xb0d35677, 0xb0d35677, 0x59c36f00, }, 20 },
+ { "gfxterm_heb", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x53a43759, 0xe0f26bfa, 0x53a43759, 0x7da1b226, 0xaa4593fe, 0xaa4593fe, 0xbf482a4e, 0xbf482a4e, 0xbf482a4e, 0x19bd2729, 0x19bd2729, 0x19bd2729, 0x11d6080, 0x11d6080, 0x11d6080, 0xaa4593fe, 0x7da1b226, 0x7da1b226, 0xaa4593fe, }, 20 },
+ { "gfxterm_heb", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xd7ff8d53, 0x665b2728, 0xd7ff8d53, 0x8ae8e0d7, 0xc9cbf769, 0xc9cbf769, 0x5a693e73, 0x5a693e73, 0x5a693e73, 0xa4b1ffbf, 0xa4b1ffbf, 0xa4b1ffbf, 0x3d9232e0, 0x3d9232e0, 0x3d9232e0, 0xc9cbf769, 0x8ae8e0d7, 0x8ae8e0d7, 0xc9cbf769, }, 20 },
+ { "gfxterm_heb", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x99fddcbe, 0x6d5c8895, 0x99fddcbe, 0x815c4e3c, 0x9813a416, 0x9813a416, 0x9bcf9821, 0x9bcf9821, 0x9bcf9821, 0xa141e12, 0xa141e12, 0xa141e12, 0xae9417d1, 0xae9417d1, 0xae9417d1, 0x9813a416, 0x815c4e3c, 0x815c4e3c, 0x9813a416, }, 20 },
+ { "gfxterm_heb", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x5797846, 0x25a6ad40, 0x5797846, 0x100430f5, 0x5fcf013d, 0x5fcf013d, 0xddc86daf, 0xddc86daf, 0xddc86daf, 0xfd875d9, 0xfd875d9, 0xfd875d9, 0xb2e1d1c3, 0xb2e1d1c3, 0xb2e1d1c3, 0x5fcf013d, 0x100430f5, 0x100430f5, 0x5fcf013d, }, 20 },
+ { "gfxterm_heb", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x30653ae8, 0x7fcd187, 0x30653ae8, 0xf7190a0, 0xdd28f52b, 0xdd28f52b, 0x24c3d325, 0x24c3d325, 0x24c3d325, 0x5ff2ac1, 0x5ff2ac1, 0x5ff2ac1, 0x465f628b, 0x465f628b, 0x465f628b, 0xdd28f52b, 0xf7190a0, 0xf7190a0, 0xdd28f52b, }, 20 },
+ { "gfxterm_heb", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x3bd91638, 0x1d74dd4a, 0x3bd91638, 0xa2c27c49, 0x43d1f34, 0x43d1f34, 0x53d1ad3d, 0x53d1ad3d, 0x53d1ad3d, 0x2cdb0495, 0x2cdb0495, 0x2cdb0495, 0x7dfa4e27, 0x7dfa4e27, 0x7dfa4e27, 0x43d1f34, 0xa2c27c49, 0xa2c27c49, 0x43d1f34, }, 20 },
+ { "gfxterm_gre", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xbe2c351a, 0x2692720, 0xbe2c351a, 0xfddaf85d, 0x59c36f00, 0x59c36f00, 0x1b2e2301, 0x1b2e2301, 0x1b2e2301, 0x65ae4e67, 0x65ae4e67, 0x65ae4e67, 0xba04b375, 0xba04b375, 0xba04b375, 0x59c36f00, 0xfddaf85d, 0xfddaf85d, 0x59c36f00, }, 20 },
+ { "gfxterm_gre", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x1eca82e1, 0xe8fa59cc, 0x1eca82e1, 0x30cf079e, 0xaa4593fe, 0xaa4593fe, 0xaf27ddc5, 0xaf27ddc5, 0xaf27ddc5, 0x9d2d0a2, 0x9d2d0a2, 0x9d2d0a2, 0x1172970b, 0x1172970b, 0x1172970b, 0xaa4593fe, 0x30cf079e, 0x30cf079e, 0xaa4593fe, }, 20 },
+ { "gfxterm_gre", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xa9ccd435, 0x1ac646eb, 0xa9ccd435, 0xf4dbb9b1, 0xc9cbf769, 0xc9cbf769, 0x86d69aa0, 0x86d69aa0, 0x86d69aa0, 0x780e5b6c, 0x780e5b6c, 0x780e5b6c, 0xe12d9633, 0xe12d9633, 0xe12d9633, 0xc9cbf769, 0xf4dbb9b1, 0xf4dbb9b1, 0xc9cbf769, }, 20 },
+ { "gfxterm_gre", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xf96d568, 0x7ad05c1b, 0xf96d568, 0x173747ea, 0x9813a416, 0x9813a416, 0xacf9792a, 0xacf9792a, 0xacf9792a, 0x3d22ff19, 0x3d22ff19, 0x3d22ff19, 0x99a2f6da, 0x99a2f6da, 0x99a2f6da, 0x9813a416, 0x173747ea, 0x173747ea, 0x9813a416, }, 20 },
+ { "gfxterm_gre", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xa0dc6b9c, 0xc2761148, 0xa0dc6b9c, 0xb5a1232f, 0x5fcf013d, 0x5fcf013d, 0x4e05748b, 0x4e05748b, 0x4e05748b, 0x9c156cfd, 0x9c156cfd, 0x9c156cfd, 0x212cc8e7, 0x212cc8e7, 0x212cc8e7, 0x5fcf013d, 0xb5a1232f, 0xb5a1232f, 0x5fcf013d, }, 20 },
+ { "gfxterm_gre", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xcd722f7d, 0xe4df8d6b, 0xcd722f7d, 0xf2668535, 0xdd28f52b, 0xdd28f52b, 0xbdbb8019, 0xbdbb8019, 0xbdbb8019, 0x9c8779fd, 0x9c8779fd, 0x9c8779fd, 0xdf2731b7, 0xdf2731b7, 0xdf2731b7, 0xdd28f52b, 0xf2668535, 0xf2668535, 0xdd28f52b, }, 20 },
+ { "gfxterm_gre", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xa6c99d2f, 0x1de04317, 0xa6c99d2f, 0x3fd2f75e, 0x43d1f34, 0x43d1f34, 0x3f85b7d3, 0x3f85b7d3, 0x3f85b7d3, 0x408f1e7b, 0x408f1e7b, 0x408f1e7b, 0x11ae54c9, 0x11ae54c9, 0x11ae54c9, 0x43d1f34, 0x3fd2f75e, 0x3fd2f75e, 0x43d1f34, }, 20 },
+ { "gfxterm_ru", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x1e35b709, 0x2683bf92, 0x1e35b709, 0x5dc37a4e, 0x59c36f00, 0x59c36f00, 0xd697967f, 0xd697967f, 0xd697967f, 0xa817fb19, 0xa817fb19, 0xa817fb19, 0x77bd060b, 0x77bd060b, 0x77bd060b, 0x59c36f00, 0x5dc37a4e, 0x5dc37a4e, 0x59c36f00, }, 20 },
+ { "gfxterm_ru", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x53ff7735, 0x8cbf197c, 0x53ff7735, 0x7dfaf24a, 0xaa4593fe, 0xaa4593fe, 0x389a922, 0x389a922, 0x389a922, 0xa57ca445, 0xa57ca445, 0xa57ca445, 0xbddce3ec, 0xbddce3ec, 0xbddce3ec, 0xaa4593fe, 0x7dfaf24a, 0x7dfaf24a, 0xaa4593fe, }, 20 },
+ { "gfxterm_ru", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x5217c47d, 0x7c8ae63e, 0x5217c47d, 0xf00a9f9, 0xc9cbf769, 0xc9cbf769, 0x3995409, 0x3995409, 0x3995409, 0xfd4195c5, 0xfd4195c5, 0xfd4195c5, 0x6462589a, 0x6462589a, 0x6462589a, 0xc9cbf769, 0xf00a9f9, 0xf00a9f9, 0xc9cbf769, }, 20 },
+ { "gfxterm_ru", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x45b67706, 0x375fb5db, 0x45b67706, 0x5d17e584, 0x9813a416, 0x9813a416, 0x8195719b, 0x8195719b, 0x8195719b, 0x104ef7a8, 0x104ef7a8, 0x104ef7a8, 0xb4cefe6b, 0xb4cefe6b, 0xb4cefe6b, 0x9813a416, 0x5d17e584, 0x5d17e584, 0x9813a416, }, 20 },
+ { "gfxterm_ru", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xfc209a25, 0xd5c20779, 0xfc209a25, 0xe95dd296, 0x5fcf013d, 0x5fcf013d, 0xe5699efe, 0xe5699efe, 0xe5699efe, 0x37798688, 0x37798688, 0x37798688, 0x8a402292, 0x8a402292, 0x8a402292, 0x5fcf013d, 0xe95dd296, 0xe95dd296, 0x5fcf013d, }, 20 },
+ { "gfxterm_ru", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x77f956f0, 0xfb0cc079, 0x77f956f0, 0x48edfcb8, 0xdd28f52b, 0xdd28f52b, 0xd51b1dc9, 0xd51b1dc9, 0xd51b1dc9, 0xf427e42d, 0xf427e42d, 0xf427e42d, 0xb787ac67, 0xb787ac67, 0xb787ac67, 0xdd28f52b, 0x48edfcb8, 0x48edfcb8, 0xdd28f52b, }, 20 },
+ { "gfxterm_ru", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x1d9ac82a, 0xa254aa53, 0x1d9ac82a, 0x8481a25b, 0x43d1f34, 0x43d1f34, 0xc304df68, 0xc304df68, 0xc304df68, 0xbc0e76c0, 0xbc0e76c0, 0xbc0e76c0, 0xed2f3c72, 0xed2f3c72, 0xed2f3c72, 0x43d1f34, 0x8481a25b, 0x8481a25b, 0x43d1f34, }, 20 },
+ { "gfxterm_fr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa6239a89, 0x8dc4bfbb, 0xa6239a89, 0xe5d557ce, 0x59c36f00, 0x59c36f00, 0x244cf807, 0x244cf807, 0x244cf807, 0x5acc9561, 0x5acc9561, 0x5acc9561, 0x85666873, 0x85666873, 0x85666873, 0x59c36f00, 0xe5d557ce, 0xe5d557ce, 0x59c36f00, }, 20 },
+ { "gfxterm_fr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x742cede9, 0x83bb7a50, 0x742cede9, 0x5a296896, 0xaa4593fe, 0xaa4593fe, 0xd83f8aeb, 0xd83f8aeb, 0xd83f8aeb, 0x7eca878c, 0x7eca878c, 0x7eca878c, 0x666ac025, 0x666ac025, 0x666ac025, 0xaa4593fe, 0x5a296896, 0x5a296896, 0xaa4593fe, }, 20 },
+ { "gfxterm_fr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xe20a98b0, 0x7e8cedef, 0xe20a98b0, 0xbf1df534, 0xc9cbf769, 0xc9cbf769, 0x2748b88c, 0x2748b88c, 0x2748b88c, 0xd9907940, 0xd9907940, 0xd9907940, 0x40b3b41f, 0x40b3b41f, 0x40b3b41f, 0xc9cbf769, 0xbf1df534, 0xbf1df534, 0xc9cbf769, }, 20 },
+ { "gfxterm_fr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x8f911ca4, 0xcbf1d895, 0x8f911ca4, 0x97308e26, 0x9813a416, 0x9813a416, 0x5b359bf4, 0x5b359bf4, 0x5b359bf4, 0xcaee1dc7, 0xcaee1dc7, 0xcaee1dc7, 0x6e6e1404, 0x6e6e1404, 0x6e6e1404, 0x9813a416, 0x97308e26, 0x97308e26, 0x9813a416, }, 20 },
+ { "gfxterm_fr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x1bf82c82, 0xc7b39627, 0x1bf82c82, 0xe856431, 0x5fcf013d, 0x5fcf013d, 0xa9dbae99, 0xa9dbae99, 0xa9dbae99, 0x7bcbb6ef, 0x7bcbb6ef, 0x7bcbb6ef, 0xc6f212f5, 0xc6f212f5, 0xc6f212f5, 0x5fcf013d, 0xe856431, 0xe856431, 0x5fcf013d, }, 20 },
+ { "gfxterm_fr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xfae19a5c, 0xd1e8fabb, 0xfae19a5c, 0xc5f53014, 0xdd28f52b, 0xdd28f52b, 0xfa2c5565, 0xfa2c5565, 0xfa2c5565, 0xdb10ac81, 0xdb10ac81, 0xdb10ac81, 0x98b0e4cb, 0x98b0e4cb, 0x98b0e4cb, 0xdd28f52b, 0xc5f53014, 0xc5f53014, 0xdd28f52b, }, 20 },
+ { "gfxterm_fr", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x9a18f7bc, 0x5fcecc43, 0x9a18f7bc, 0x3039dcd, 0x43d1f34, 0x43d1f34, 0x287a2b96, 0x287a2b96, 0x287a2b96, 0x5770823e, 0x5770823e, 0x5770823e, 0x651c88c, 0x651c88c, 0x651c88c, 0x43d1f34, 0x3039dcd, 0x3039dcd, 0x43d1f34, }, 20 },
+ { "gfxterm_quot", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x65112dfc, 0x3dec17f, 0x65112dfc, 0x26e7e0bb, 0x59c36f00, 0x59c36f00, 0x620c0067, 0x620c0067, 0x620c0067, 0x1c8c6d01, 0x1c8c6d01, 0x1c8c6d01, 0xc3269013, 0xc3269013, 0xc3269013, 0x59c36f00, 0x26e7e0bb, 0x26e7e0bb, 0x59c36f00, }, 20 },
+ { "gfxterm_quot", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x2b3430fb, 0x8f1eb743, 0x2b3430fb, 0x531b584, 0xaa4593fe, 0xaa4593fe, 0xa8a596c8, 0xa8a596c8, 0xa8a596c8, 0xe509baf, 0xe509baf, 0xe509baf, 0x16f0dc06, 0x16f0dc06, 0x16f0dc06, 0xaa4593fe, 0x531b584, 0x531b584, 0xaa4593fe, }, 20 },
+ { "gfxterm_quot", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xb523e920, 0xfafb6f8, 0xb523e920, 0xe83484a4, 0xc9cbf769, 0xc9cbf769, 0x3ce35e1d, 0x3ce35e1d, 0x3ce35e1d, 0xc23b9fd1, 0xc23b9fd1, 0xc23b9fd1, 0x5b18528e, 0x5b18528e, 0x5b18528e, 0xc9cbf769, 0xe83484a4, 0xe83484a4, 0xc9cbf769, }, 20 },
+ { "gfxterm_quot", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xa9bf7336, 0x1a1f7a01, 0xa9bf7336, 0xb11ee1b4, 0x9813a416, 0x9813a416, 0x43fda3fa, 0x43fda3fa, 0x43fda3fa, 0xd22625c9, 0xd22625c9, 0xd22625c9, 0x76a62c0a, 0x76a62c0a, 0x76a62c0a, 0x9813a416, 0xb11ee1b4, 0xb11ee1b4, 0x9813a416, }, 20 },
+ { "gfxterm_quot", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xe5271912, 0xf5d10273, 0xe5271912, 0xf05a51a1, 0x5fcf013d, 0x5fcf013d, 0xf3582c48, 0xf3582c48, 0xf3582c48, 0x2148343e, 0x2148343e, 0x2148343e, 0x9c719024, 0x9c719024, 0x9c719024, 0x5fcf013d, 0xf05a51a1, 0xf05a51a1, 0x5fcf013d, }, 20 },
+ { "gfxterm_quot", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x66a34f49, 0x32dbeb97, 0x66a34f49, 0x59b7e501, 0xdd28f52b, 0xdd28f52b, 0xb3c7ef80, 0xb3c7ef80, 0xb3c7ef80, 0x92fb1664, 0x92fb1664, 0x92fb1664, 0xd15b5e2e, 0xd15b5e2e, 0xd15b5e2e, 0xdd28f52b, 0x59b7e501, 0x59b7e501, 0xdd28f52b, }, 20 },
+ { "gfxterm_quot", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x7c2f19da, 0xd7bece67, 0x7c2f19da, 0xe53473ab, 0x43d1f34, 0x43d1f34, 0xa0717008, 0xa0717008, 0xa0717008, 0xdf7bd9a0, 0xdf7bd9a0, 0xdf7bd9a0, 0x8e5a9312, 0x8e5a9312, 0x8e5a9312, 0x43d1f34, 0xe53473ab, 0xe53473ab, 0x43d1f34, }, 20 },
+ { "gfxterm_piglatin", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x37943894, 0x78248c70, 0x37943894, 0x7462f5d3, 0x59c36f00, 0x59c36f00, 0xf4be229a, 0xf4be229a, 0xf4be229a, 0x8a3e4ffc, 0x8a3e4ffc, 0x8a3e4ffc, 0x5594b2ee, 0x5594b2ee, 0x5594b2ee, 0x59c36f00, 0x7462f5d3, 0x7462f5d3, 0x59c36f00, }, 20 },
+ { "gfxterm_piglatin", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xd5158e6c, 0xdc71ba0f, 0xd5158e6c, 0xfb100b13, 0xaa4593fe, 0xaa4593fe, 0xd3ed72a3, 0xd3ed72a3, 0xd3ed72a3, 0x75187fc4, 0x75187fc4, 0x75187fc4, 0x6db8386d, 0x6db8386d, 0x6db8386d, 0xaa4593fe, 0xfb100b13, 0xfb100b13, 0xaa4593fe, }, 20 },
+ { "gfxterm_piglatin", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x6277a9e6, 0xa3265ffb, 0x6277a9e6, 0x3f60c462, 0xc9cbf769, 0xc9cbf769, 0x2dcf8a8d, 0x2dcf8a8d, 0x2dcf8a8d, 0xd3174b41, 0xd3174b41, 0xd3174b41, 0x4a34861e, 0x4a34861e, 0x4a34861e, 0xc9cbf769, 0x3f60c462, 0x3f60c462, 0xc9cbf769, }, 20 },
+ { "gfxterm_piglatin", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x81115dc4, 0xddf3f768, 0x81115dc4, 0x99b0cf46, 0x9813a416, 0x9813a416, 0x9b9d96df, 0x9b9d96df, 0x9b9d96df, 0xa4610ec, 0xa4610ec, 0xa4610ec, 0xaec6192f, 0xaec6192f, 0xaec6192f, 0x9813a416, 0x99b0cf46, 0x99b0cf46, 0x9813a416, }, 20 },
+ { "gfxterm_piglatin", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x5e96a904, 0x27864d3d, 0x5e96a904, 0x4bebe1b7, 0x5fcf013d, 0x5fcf013d, 0x18cae7f4, 0x18cae7f4, 0x18cae7f4, 0xcadaff82, 0xcadaff82, 0xcadaff82, 0x77e35b98, 0x77e35b98, 0x77e35b98, 0x5fcf013d, 0x4bebe1b7, 0x4bebe1b7, 0x5fcf013d, }, 20 },
+ { "gfxterm_piglatin", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xd00b19f8, 0xba73a9c6, 0xd00b19f8, 0xef1fb3b0, 0xdd28f52b, 0xdd28f52b, 0xb660046d, 0xb660046d, 0xb660046d, 0x975cfd89, 0x975cfd89, 0x975cfd89, 0xd4fcb5c3, 0xd4fcb5c3, 0xd4fcb5c3, 0xdd28f52b, 0xef1fb3b0, 0xef1fb3b0, 0xdd28f52b, }, 20 },
+ { "gfxterm_piglatin", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x8b4b98cd, 0x78ddc6e4, 0x8b4b98cd, 0x1250f2bc, 0x43d1f34, 0x43d1f34, 0x4889d3fd, 0x4889d3fd, 0x4889d3fd, 0x37837a55, 0x37837a55, 0x37837a55, 0x66a230e7, 0x66a230e7, 0x66a230e7, 0x43d1f34, 0x1250f2bc, 0x1250f2bc, 0x43d1f34, }, 20 },
+ { "gfxterm_ch", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xfecb570e, 0xccb97a7a, 0xfecb570e, 0xbd3d9a49, 0x59c36f00, 0x59c36f00, 0x40281258, 0x40281258, 0x40281258, 0x3ea87f3e, 0x3ea87f3e, 0x3ea87f3e, 0xe102822c, 0xe102822c, 0xe102822c, 0x59c36f00, 0xbd3d9a49, 0xbd3d9a49, 0x59c36f00, }, 20 },
+ { "gfxterm_ch", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x897d1fac, 0xaa982529, 0x897d1fac, 0xa7789ad3, 0xaa4593fe, 0xaa4593fe, 0xa482510, 0xa482510, 0xa482510, 0xacbd2877, 0xacbd2877, 0xacbd2877, 0xb41d6fde, 0xb41d6fde, 0xb41d6fde, 0xaa4593fe, 0xa7789ad3, 0xa7789ad3, 0xaa4593fe, }, 20 },
+ { "gfxterm_ch", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xd02a5297, 0xe627ab58, 0xd02a5297, 0x8d3d3f13, 0xc9cbf769, 0xc9cbf769, 0xbf0a8b7f, 0xbf0a8b7f, 0xbf0a8b7f, 0x41d24ab3, 0x41d24ab3, 0x41d24ab3, 0xd8f187ec, 0xd8f187ec, 0xd8f187ec, 0xc9cbf769, 0x8d3d3f13, 0x8d3d3f13, 0xc9cbf769, }, 20 },
+ { "gfxterm_ch", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xa653dcda, 0x3392e976, 0xa653dcda, 0xbef24e58, 0x9813a416, 0x9813a416, 0x4f2bc106, 0x4f2bc106, 0x4f2bc106, 0xdef04735, 0xdef04735, 0xdef04735, 0x7a704ef6, 0x7a704ef6, 0x7a704ef6, 0x9813a416, 0xbef24e58, 0xbef24e58, 0x9813a416, }, 20 },
+ { "gfxterm_ch", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xe2d7b585, 0x35241f36, 0xe2d7b585, 0xf7aafd36, 0x5fcf013d, 0x5fcf013d, 0xf2bd04db, 0xf2bd04db, 0xf2bd04db, 0x20ad1cad, 0x20ad1cad, 0x20ad1cad, 0x9d94b8b7, 0x9d94b8b7, 0x9d94b8b7, 0x5fcf013d, 0xf7aafd36, 0xf7aafd36, 0x5fcf013d, }, 20 },
+ { "gfxterm_ch", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x72ff749c, 0xeda8c283, 0x72ff749c, 0x4debded4, 0xdd28f52b, 0xdd28f52b, 0xb8c9cc22, 0xb8c9cc22, 0xb8c9cc22, 0x99f535c6, 0x99f535c6, 0x99f535c6, 0xda557d8c, 0xda557d8c, 0xda557d8c, 0xdd28f52b, 0x4debded4, 0x4debded4, 0xdd28f52b, }, 20 },
+ { "gfxterm_ch", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xb7cac764, 0xeb4bf417, 0xb7cac764, 0x2ed1ad15, 0x43d1f34, 0x43d1f34, 0xce718801, 0xce718801, 0xce718801, 0xb17b21a9, 0xb17b21a9, 0xb17b21a9, 0xe05a6b1b, 0xe05a6b1b, 0xe05a6b1b, 0x43d1f34, 0x2ed1ad15, 0x2ed1ad15, 0x43d1f34, }, 20 },
+ { "gfxterm_red", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x930e8e13, 0xf5c16290, 0x930e8e13, 0x27f5f1c0, 0x59c36f00, 0x59c36f00, 0xbad4e11, 0xbad4e11, 0xbad4e11, 0x752d2377, 0x752d2377, 0x752d2377, 0xaa87de65, 0xaa87de65, 0xaa87de65, 0x59c36f00, 0x27f5f1c0, 0x27f5f1c0, 0x59c36f00, }, 20 },
+ { "gfxterm_red", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xff9301f2, 0x5bb9864a, 0xff9301f2, 0x31c145de, 0xaa4593fe, 0xaa4593fe, 0x23bf2c32, 0x23bf2c32, 0x23bf2c32, 0x854a2155, 0x854a2155, 0x854a2155, 0x9dea66fc, 0x9dea66fc, 0x9dea66fc, 0xaa4593fe, 0x31c145de, 0x31c145de, 0xaa4593fe, }, 20 },
+ { "gfxterm_red", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xfc5938ef, 0x46d56737, 0xfc5938ef, 0x23cf2668, 0xc9cbf769, 0xc9cbf769, 0xa8c549aa, 0xa8c549aa, 0xa8c549aa, 0x561d8866, 0x561d8866, 0x561d8866, 0xcf3e4539, 0xcf3e4539, 0xcf3e4539, 0xc9cbf769, 0x23cf2668, 0x23cf2668, 0xc9cbf769, }, 20 },
+ { "gfxterm_red", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xe7160822, 0x54b60115, 0xe7160822, 0x168efa6f, 0x9813a416, 0x9813a416, 0xb774a5aa, 0xb774a5aa, 0xb774a5aa, 0x26af2399, 0x26af2399, 0x26af2399, 0x822f2a5a, 0x822f2a5a, 0x822f2a5a, 0x9813a416, 0x168efa6f, 0x168efa6f, 0x9813a416, }, 20 },
+ { "gfxterm_red", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xf655f9b2, 0xe6a3e2d3, 0xf655f9b2, 0xd1d7405f, 0x5fcf013d, 0x5fcf013d, 0x2accaa08, 0x2accaa08, 0x2accaa08, 0xf8dcb27e, 0xf8dcb27e, 0xf8dcb27e, 0x45e51664, 0x45e51664, 0x45e51664, 0x5fcf013d, 0xd1d7405f, 0xd1d7405f, 0x5fcf013d, }, 20 },
+ { "gfxterm_red", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x2d85ebdc, 0x79fd4f02, 0x2d85ebdc, 0xc48ae2b6, 0xdd28f52b, 0xdd28f52b, 0x76b28a95, 0x76b28a95, 0x76b28a95, 0x578e7371, 0x578e7371, 0x578e7371, 0x142e3b3b, 0x142e3b3b, 0x142e3b3b, 0xdd28f52b, 0xc48ae2b6, 0xc48ae2b6, 0xdd28f52b, }, 20 },
+ { "gfxterm_red", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x29c00f98, 0x8251d825, 0x29c00f98, 0x35a750d1, 0x43d1f34, 0x43d1f34, 0x48b70bc8, 0x48b70bc8, 0x48b70bc8, 0x37bda260, 0x37bda260, 0x37bda260, 0x669ce8d2, 0x669ce8d2, 0x669ce8d2, 0x43d1f34, 0x35a750d1, 0x35a750d1, 0x43d1f34, }, 20 },
+ { "gfxterm_high", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x4afab717, 0x2c355b94, 0x4afab717, 0x1166d9d0, 0x59c36f00, 0x59c36f00, 0x620c0067, 0x620c0067, 0x620c0067, 0x1c8c6d01, 0x1c8c6d01, 0x1c8c6d01, 0xc3269013, 0xc3269013, 0xc3269013, 0x59c36f00, 0x1166d9d0, 0x1166d9d0, 0x59c36f00, }, 20 },
+ { "gfxterm_high", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xe3daadd4, 0x47f02a6c, 0xe3daadd4, 0x5ea9fb21, 0xaa4593fe, 0xaa4593fe, 0xa8a596c8, 0xa8a596c8, 0xa8a596c8, 0xe509baf, 0xe509baf, 0xe509baf, 0x16f0dc06, 0x16f0dc06, 0x16f0dc06, 0xaa4593fe, 0x5ea9fb21, 0x5ea9fb21, 0xaa4593fe, }, 20 },
+ { "gfxterm_high", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xf140d1df, 0x4bcc8e07, 0xf140d1df, 0x7c962dcb, 0xc9cbf769, 0xc9cbf769, 0x3ce35e1d, 0x3ce35e1d, 0x3ce35e1d, 0xc23b9fd1, 0xc23b9fd1, 0xc23b9fd1, 0x5b18528e, 0x5b18528e, 0x5b18528e, 0xc9cbf769, 0x7c962dcb, 0x7c962dcb, 0xc9cbf769, }, 20 },
+ { "gfxterm_high", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xe709a12d, 0x54a9a81a, 0xe709a12d, 0xde04d65c, 0x9813a416, 0x9813a416, 0x43fda3fa, 0x43fda3fa, 0x43fda3fa, 0xd22625c9, 0xd22625c9, 0xd22625c9, 0x76a62c0a, 0x76a62c0a, 0x76a62c0a, 0x9813a416, 0xde04d65c, 0xde04d65c, 0x9813a416, }, 20 },
+ { "gfxterm_high", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x65eff77c, 0x7519ec1d, 0x65eff77c, 0x1cd7d353, 0x5fcf013d, 0x5fcf013d, 0xf3582c48, 0xf3582c48, 0xf3582c48, 0x2148343e, 0x2148343e, 0x2148343e, 0x9c719024, 0x9c719024, 0x9c719024, 0x5fcf013d, 0x1cd7d353, 0x1cd7d353, 0x5fcf013d, }, 20 },
+ { "gfxterm_high", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x7318831a, 0x276027c4, 0x7318831a, 0xd7e4f5bb, 0xdd28f52b, 0xdd28f52b, 0xb3c7ef80, 0xb3c7ef80, 0xb3c7ef80, 0x92fb1664, 0x92fb1664, 0x92fb1664, 0xd15b5e2e, 0xd15b5e2e, 0xd15b5e2e, 0xdd28f52b, 0xd7e4f5bb, 0xd7e4f5bb, 0xdd28f52b, }, 20 },
+ { "gfxterm_high", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x6927a7d4, 0xc2b67069, 0x6927a7d4, 0xfc345163, 0x43d1f34, 0x43d1f34, 0xa0717008, 0xa0717008, 0xa0717008, 0xdf7bd9a0, 0xdf7bd9a0, 0xdf7bd9a0, 0x8e5a9312, 0x8e5a9312, 0x8e5a9312, 0x43d1f34, 0xfc345163, 0xfc345163, 0x43d1f34, }, 20 },
+ { "videotest", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0xe6012f70, 0xe6012f70, 0xe6012f70, 0xe6012f70, 0xe6012f70, }, 5 },
+ { "videotest", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xfb6be77b, 0xfb6be77b, 0xfb6be77b, 0xfb6be77b, 0xfb6be77b, }, 5 },
+ { "videotest", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0x67c0629f, 0x67c0629f, 0x67c0629f, 0x67c0629f, 0x67c0629f, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x8f20afbb, 0xd8f7abc, 0x8f937344, 0xd3ca643, 0x8e471645, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0xdca764da, 0x9f76da9a, 0x5b04185a, 0x18d5a61a, 0xd60deb2b, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0x7b87af36, 0x7cb96093, 0x75fa307c, 0x72c4ffd9, 0x677c91a2, }, 5 },
+ { "videotest", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x72981c65, 0x50120635, 0x378c28c5, 0x15063295, 0xf8b07525, }, 5 },
+ { "videotest", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0xc8f64b58, 0xc8f64b58, 0xc8f64b58, 0xc8f64b58, 0xc8f64b58, }, 5 },
+ { "videotest", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0x2b499dfa, 0x2b499dfa, 0x2b499dfa, 0x2b499dfa, 0x2b499dfa, }, 5 },
+ { "videotest", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0x6156b420, 0x6156b420, 0x6156b420, 0x6156b420, 0x6156b420, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x363285ca, 0x363285ca, 0x363285ca, 0x363285ca, 0x363285ca, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0x25bb37f4, 0x25bb37f4, 0x25bb37f4, 0x25bb37f4, 0x25bb37f4, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0xeeab9e91, 0xeeab9e91, 0xeeab9e91, 0xeeab9e91, 0xeeab9e91, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x26a9a50b, 0x26a9a50b, 0x26a9a50b, 0x26a9a50b, 0x26a9a50b, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0x2c0f4fe7, 0x2c0f4fe7, 0x2c0f4fe7, 0x2c0f4fe7, 0x2c0f4fe7, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x46c11052, 0x46c11052, 0x46c11052, 0x46c11052, 0x46c11052, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0xe56cf615, 0xcd2be572, 0xb5e2d0db, 0x9da5c3bc, 0x4470bb89, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x2a25b871, 0x4bf85361, 0xe99e6e51, 0x88438541, 0xa8be62c0, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x81523037, 0xd8c0bfd3, 0x32772fff, 0x6be5a01b, 0xe2f47956, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x1833bb41, 0x1833bb41, 0x1833bb41, 0x1833bb41, 0x1833bb41, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0x2c39a0e8, 0x2c39a0e8, 0x2c39a0e8, 0x2c39a0e8, 0x2c39a0e8, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0xf0d4c23, 0xf0d4c23, 0xf0d4c23, 0xf0d4c23, 0xf0d4c23, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x456d063c, 0x456d063c, 0x456d063c, 0x456d063c, 0x456d063c, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0x47e15a2e, 0x47e15a2e, 0x47e15a2e, 0x47e15a2e, 0x47e15a2e, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x54d7300d, 0x54d7300d, 0x54d7300d, 0x54d7300d, 0x54d7300d, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x770da211, 0x8ef2528e, 0x811e35de, 0x78e1c541, 0x9ec6fb7e, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0xeb181fbc, 0xae648cc1, 0x61e13946, 0x249daa3b, 0xfb0624b9, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x2b6f64dc, 0xc25f8431, 0xfce2d3f7, 0x15d2331a, 0x81987c7b, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0xa260f7dd, 0x3e2f4980, 0x9f13fd96, 0x35c43cb, 0xd886e34b, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x41a9bff8, 0xa0d3f7c3, 0x86b1597f, 0x67cb1144, 0xca740407, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0x8f7a3b6d, 0xcb84c6e3, 0x687c071, 0x42793dff, 0x996dbba4, }, 5 },
diff --git a/grub-core/tests/cmdline_cat_test.c b/grub-core/tests/cmdline_cat_test.c
new file mode 100644
index 0000000..baea768
--- /dev/null
+++ b/grub-core/tests/cmdline_cat_test.c
@@ -0,0 +1,125 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* All tests need to include test.h for GRUB testing framework. */
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/video.h>
+#include <grub/video_fb.h>
+#include <grub/command.h>
+#include <grub/font.h>
+#include <grub/procfs.h>
+#include <grub/env.h>
+#include <grub/normal.h>
+#include <grub/time.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+
+static const char testfile[] =
+ /* Chinese & UTF-8 test from Carbon Jiao. */
+ "从硬盘的第一主分区启动\n"
+ "The quick brown fox jumped over the lazy dog.\n"
+ /* Characters used:
+ Code point Description UTF-8 encoding
+ ----------- ------------------------------ --------------
+ U+263A unfilled smiley face E2 98 BA
+ U+00A1 inverted exclamation point C2 A1
+ U+00A3 British pound currency symbol C2 A3
+ U+03C4 Greek tau CF 84
+ U+00E4 lowercase letter a with umlaut C3 A4
+ U+2124 set 'Z' symbol (integers) E2 84 A4
+ U+2286 subset symbol E2 8A 86
+ U+211D set 'R' symbol (real numbers) E2 84 9D */
+ "Unicode test: happy\xE2\x98\xBA \xC2\xA3 5.00"
+ " \xC2\xA1\xCF\x84\xC3\xA4u! "
+ " \xE2\x84\xA4\xE2\x8A\x86\xE2\x84\x9D\n"
+ /* Test handling of bad (non-UTF8) sequences*/
+ "\x99Hello\xc2Hello\xc1\x81Hello\n";
+;
+
+static char *
+get_test_txt (grub_size_t *sz)
+{
+ *sz = grub_strlen (testfile);
+ return grub_strdup (testfile);
+}
+
+struct grub_procfs_entry test_txt =
+{
+ .name = "test.txt",
+ .get_contents = get_test_txt
+};
+
+#define FONT_NAME "Unknown Regular 16"
+
+/* Functional test main method. */
+static void
+cmdline_cat_test (void)
+{
+ unsigned i;
+ grub_font_t font;
+
+ grub_dl_load ("gfxterm");
+ grub_errno = GRUB_ERR_NONE;
+
+ font = grub_font_get (FONT_NAME);
+ if (font && grub_strcmp (font->name, FONT_NAME) != 0)
+ font = 0;
+ if (!font)
+ font = grub_font_load ("unicode");
+
+ if (!font)
+ {
+ grub_test_assert (0, "unicode font not found: %s", grub_errmsg);
+ return;
+ }
+
+ grub_procfs_register ("test.txt", &test_txt);
+
+ for (i = 0; i < GRUB_TEST_VIDEO_SMALL_N_MODES; i++)
+ {
+ grub_video_capture_start (&grub_test_video_modes[i],
+ grub_video_fbstd_colors,
+ grub_test_video_modes[i].number_of_colors);
+ grub_terminal_input_fake_sequence ((int [])
+ { 'c', 'a', 't', ' ',
+ '(', 'p', 'r', 'o', 'c', ')',
+ '/', 't', 'e', 's', 't', '.',
+ 't', 'x', 't', '\n',
+ GRUB_TERM_NO_KEY,
+ GRUB_TERM_NO_KEY, GRUB_TERM_ESC},
+ 23);
+
+ grub_video_checksum ("cmdline_cat");
+
+ if (!grub_test_use_gfxterm ())
+ grub_cmdline_run (1, 0);
+
+ grub_test_use_gfxterm_end ();
+
+ grub_terminal_input_fake_sequence_end ();
+ grub_video_checksum_end ();
+ grub_video_capture_end ();
+ }
+
+ grub_procfs_unregister (&test_txt);
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (cmdline_cat_test, cmdline_cat_test);
diff --git a/grub-core/tests/cmp_test.c b/grub-core/tests/cmp_test.c
new file mode 100644
index 0000000..af5b395
--- /dev/null
+++ b/grub-core/tests/cmp_test.c
@@ -0,0 +1,190 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2015 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/misc.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static grub_uint64_t vectors[][2] = {
+ { 0xffffffffffffffffULL, 1},
+ { 1, 0xffffffffffffffffULL},
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL},
+ { 1, 1 },
+ { 2, 1 }
+};
+
+/* Don't change those to use shift as shift may call to compile rt
+ functions and we're not testing them now.
+ */
+static int
+leading_bit64 (grub_uint64_t a)
+{
+ return !!(a & 0x8000000000000000LL);
+}
+
+static int
+leading_bit32 (grub_uint32_t a)
+{
+ return !!(a & 0x80000000);
+}
+
+/* Computes (a < b) without involving comparison operator. */
+static int
+is_less32 (grub_uint32_t a, grub_uint32_t b)
+{
+ if (leading_bit32(a) && !leading_bit32(b))
+ return 0;
+ if (!leading_bit32(a) && leading_bit32(b))
+ return 1;
+ return leading_bit32(a - b);
+}
+
+static void
+test32 (grub_uint32_t a, grub_uint32_t b)
+{
+ grub_test_assert ((a < b) == is_less32(a, b), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((a > b) == is_less32(b, a), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((b < a) == is_less32(b, a), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((b > a) == is_less32(a, b), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert (!(is_less32(a, b) && is_less32(b, a)), "comparison inconsistent: %lld, %lld",
+ (long long) a, (long long) b);
+}
+
+/* Computes (a > b) without involving comparison operator. */
+static int
+is_less32s (grub_int32_t a, grub_int32_t b)
+{
+ if (leading_bit32(a) && !leading_bit32(b))
+ return 1; /* a < 0 && b >= 0. */
+ if (!leading_bit32(a) && leading_bit32(b))
+ return 0; /* b < 0 && a >= 0. */
+ return leading_bit32(a - b);
+}
+
+static void
+test32s (grub_int32_t a, grub_int32_t b)
+{
+ grub_test_assert ((a < b) == is_less32s(a, b), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((a > b) == is_less32s(b, a), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((b < a) == is_less32s(b, a), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((b > a) == is_less32s(a, b), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert (!(is_less32s(a, b) && is_less32s(b, a)), "comparison inconsistent: %lld, %lld",
+ (long long) a, (long long) b);
+}
+
+/* Computes (a > b) without involving comparison operator. */
+static int
+is_less64 (grub_uint64_t a, grub_uint64_t b)
+{
+ if (leading_bit64(a) && !leading_bit64(b))
+ return 0;
+ if (!leading_bit64(a) && leading_bit64(b))
+ return 1;
+ return leading_bit64(a - b);
+}
+
+static void
+test64 (grub_uint64_t a, grub_uint64_t b)
+{
+ grub_test_assert ((a < b) == is_less64(a, b), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((a > b) == is_less64(b, a), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((b < a) == is_less64(b, a), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((b > a) == is_less64(a, b), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert (!(is_less64(a, b) && is_less64(b, a)), "comparison inconsistent: %lld, %lld",
+ (long long) a, (long long) b);
+}
+
+/* Computes (a > b) without involving comparison operator. */
+static int
+is_less64s (grub_int64_t a, grub_int64_t b)
+{
+ if (leading_bit64(a) && !leading_bit64(b))
+ return 1; /* a < 0 && b >= 0. */
+ if (!leading_bit64(a) && leading_bit64(b))
+ return 0; /* b < 0 && a >= 0. */
+ return leading_bit64(a - b);
+}
+
+static void
+test64s (grub_int64_t a, grub_int64_t b)
+{
+ grub_test_assert ((a < b) == is_less64s(a, b), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((a > b) == is_less64s(b, a), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((b < a) == is_less64s(b, a), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert ((b > a) == is_less64s(a, b), "comparison result mismatch: %lld, %lld",
+ (long long) a, (long long) b);
+ grub_test_assert (!(is_less64s(a, b) && is_less64s(b, a)), "comparison inconsistent: %lld, %lld",
+ (long long) a, (long long) b);
+}
+
+static void
+test_all(grub_uint64_t a, grub_uint64_t b)
+{
+ test64 (a, b);
+ test32 (a, b);
+ test64s (a, b);
+ test32s (a, b);
+ test64s (a, -b);
+ test32s (a, -b);
+ test64s (-a, b);
+ test32s (-a, b);
+ test64s (-a, -b);
+ test32s (-a, -b);
+}
+
+static void
+cmp_test (void)
+{
+ grub_uint64_t a = 404, b = 7;
+ grub_size_t i;
+
+ for (i = 0; i < ARRAY_SIZE (vectors); i++)
+ {
+ test_all (vectors[i][0], vectors[i][1]);
+ }
+ for (i = 0; i < 40000; i++)
+ {
+ a = 17 * a + 13 * b;
+ b = 23 * a + 29 * b;
+ if (b == 0)
+ b = 1;
+ if (a == 0)
+ a = 1;
+ test_all (a, b);
+ }
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (cmp_test, cmp_test);
diff --git a/grub-core/tests/ctz_test.c b/grub-core/tests/ctz_test.c
new file mode 100644
index 0000000..eb7a1df
--- /dev/null
+++ b/grub-core/tests/ctz_test.c
@@ -0,0 +1,111 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/misc.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+/* ull version is not used on i386 other than in this test.
+ Avoid requiring extra function.
+ */
+#if defined (__i386__)
+#define SKIP_ULL 1
+#endif
+
+static grub_uint64_t vectors[] = {
+ 0xffffffffffffffffULL, 1, 2, 0, 0x0102030405060708ULL
+};
+
+static void
+test_ui (unsigned int a)
+{
+ int i;
+ a |= 1;
+ for (i = 0; i < (int) (8 * sizeof (a)); i++)
+ {
+ grub_test_assert (__builtin_ctz(a << i) == i,
+ "ctz mismatch: ctz(0x%llx) != 0x%x",
+ (long long) (a << i), __builtin_ctz(a << i));
+ }
+}
+
+static void
+test_ul (unsigned long a)
+{
+ int i;
+ a |= 1;
+ for (i = 0; i < (int) (8 * sizeof (a)); i++)
+ {
+ grub_test_assert (__builtin_ctzl(a << i) == i,
+ "ctzl mismatch: ctzl(0x%llx) != 0x%x",
+ (long long) (a << i), __builtin_ctz(a << i));
+ }
+}
+
+#ifndef SKIP_ULL
+static void
+test_ull (unsigned long long a)
+{
+ int i;
+ a |= 1;
+ for (i = 0; i < (int) (8 * sizeof (a)); i++)
+ {
+ grub_test_assert (__builtin_ctzll(a << i) == i,
+ "ctzll mismatch: ctzll(0x%llx) != 0x%x",
+ (long long) (a << i), __builtin_ctz(a << i));
+ }
+}
+#endif
+
+static void
+test_all(grub_uint64_t a)
+{
+ test_ui (a);
+ test_ul (a);
+#ifndef SKIP_ULL
+ test_ull (a);
+#endif
+}
+
+static void
+ctz_test (void)
+{
+ grub_uint64_t a = 404, b = 7;
+ grub_size_t i;
+
+ for (i = 0; i < ARRAY_SIZE (vectors); i++)
+ {
+ test_all (vectors[i]);
+ }
+ for (i = 0; i < 40000; i++)
+ {
+ a = 17 * a + 13 * b;
+ b = 23 * a + 29 * b;
+ if (b == 0)
+ b = 1;
+ if (a == 0)
+ a = 1;
+ test_all (a);
+ test_all (b);
+ }
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (ctz_test, ctz_test);
diff --git a/grub-core/tests/div_test.c b/grub-core/tests/div_test.c
new file mode 100644
index 0000000..9abc6d5
--- /dev/null
+++ b/grub-core/tests/div_test.c
@@ -0,0 +1,189 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/misc.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static grub_uint64_t vectors[][2] = {
+ { 0xffffffffffffffffULL, 1},
+ { 1, 0xffffffffffffffffULL},
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL},
+ { 1, 1 },
+ { 2, 1 }
+};
+
+static void
+test32 (grub_uint32_t a, grub_uint32_t b)
+{
+ grub_uint64_t q, r;
+ if (b == 0)
+ return;
+ q = grub_divmod64 (a, b, &r);
+ grub_test_assert (r < b, "remainder is larger than dividend: 0x%llx %% 0x%llx = 0x%llx",
+ (long long) a, (long long) b, (long long) r);
+ grub_test_assert (q * b + r == a, "division doesn't satisfy base property: 0x%llx * 0x%llx + 0x%llx != 0x%llx", (long long) q, (long long) b, (long long) r,
+ (long long) a);
+ /* Overflow check. */
+ grub_test_assert ((q >> 32) == 0,
+ "division overflow in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ grub_test_assert ((r >> 32) == 0,
+ "division overflow in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ /* q * b + r is at most:
+ 0xffffffff * 0xffffffff + 0xffffffff = 0xffffffff00000000
+ so no overflow
+ */
+ grub_test_assert (q == (a / b),
+ "C compiler division failure in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ grub_test_assert (r == (a % b),
+ "C compiler modulo failure in 0x%llx, 0x%llx", (long long) a, (long long) b);
+}
+
+static void
+test64 (grub_uint64_t a, grub_uint64_t b)
+{
+ grub_uint64_t q, r;
+ grub_uint64_t x1, x2;
+ q = grub_divmod64 (a, b, &r);
+ grub_test_assert (r < b, "remainder is larger than dividend: 0x%llx %% 0x%llx = 0x%llx",
+ (long long) a, (long long) b, (long long) r);
+ grub_test_assert (q * b + r == a, "division doesn't satisfy base property: 0x%llx * 0x%llx + 0x%llx != 0x%llx", (long long) q, (long long) b, (long long) r,
+ (long long) a);
+ /* Overflow checks. */
+ grub_test_assert ((q >> 32) * (b >> 32) == 0,
+ "division overflow in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ x1 = (q >> 32) * (b & 0xffffffff);
+ grub_test_assert (x1 < (1LL << 32),
+ "division overflow in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ x1 <<= 32;
+ x2 = (b >> 32) * (q & 0xffffffff);
+ grub_test_assert (x2 < (1LL << 32),
+ "division overflow in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ x2 <<= 32;
+ grub_test_assert (x1 <= ~x2,
+ "division overflow in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ x1 += x2;
+ x2 = (q & 0xffffffff) * (b & 0xffffffff);
+ grub_test_assert (x1 <= ~x2,
+ "division overflow in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ x1 += x2;
+ grub_test_assert (x1 <= ~r,
+ "division overflow in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ x1 += r;
+ grub_test_assert (a == x1,
+ "division overflow test failure in 0x%llx, 0x%llx", (long long) a, (long long) b);
+#if GRUB_TARGET_SIZEOF_VOID_P == 8
+ grub_test_assert (q == (a / b),
+ "C compiler division failure in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ grub_test_assert (r == (a % b),
+ "C compiler modulo failure in 0x%llx, 0x%llx", (long long) a, (long long) b);
+#endif
+}
+
+static grub_int64_t
+abs64(grub_int64_t a)
+{
+ return a > 0 ? a : -a;
+}
+
+static void
+test32s (grub_int32_t a, grub_int32_t b)
+{
+ grub_int64_t q, r;
+ if (b == 0)
+ return;
+
+ q = grub_divmod64s (a, b, &r);
+ grub_test_assert (a > 0 ? r >= 0 : r <= 0, "remainder sign mismatch: %lld %% %lld = %lld",
+ (long long) a, (long long) b, (long long) r);
+ grub_test_assert (((a > 0) == (b > 0)) ? q >= 0 : q <= 0, "quotient sign mismatch: %lld / %lld = %lld",
+ (long long) a, (long long) b, (long long) q);
+ grub_test_assert (abs64(r) < abs64(b), "remainder is larger than dividend: %lld %% %lld = %lld",
+ (long long) a, (long long) b, (long long) r);
+ grub_test_assert (q * b + r == a, "division doesn't satisfy base property: %lld * %lld + %lld != %lld", (long long) q, (long long) b, (long long) r,
+ (long long) a);
+ if (0) { grub_test_assert (q == (a / b),
+ "C compiler division failure in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ grub_test_assert (r == (a % b),
+ "C compiler modulo failure in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ }
+}
+
+static void
+test64s (grub_int64_t a, grub_int64_t b)
+{
+ grub_int64_t q, r;
+ q = grub_divmod64s (a, b, &r);
+
+ grub_test_assert (a > 0 ? r >= 0 : r <= 0, "remainder sign mismatch: %lld %% %lld = %lld",
+ (long long) a, (long long) b, (long long) r);
+ grub_test_assert (((a > 0) == (b > 0)) ? q >= 0 : q <= 0, "quotient sign mismatch: %lld / %lld = %lld",
+ (long long) a, (long long) b, (long long) q);
+ grub_test_assert (abs64(r) < abs64(b), "remainder is larger than dividend: %lld %% %lld = %lld",
+ (long long) a, (long long) b, (long long) r);
+ grub_test_assert (q * b + r == a, "division doesn't satisfy base property: 0x%llx * 0x%llx + 0x%llx != 0x%llx", (long long) q, (long long) b, (long long) r,
+ (long long) a);
+#if GRUB_TARGET_SIZEOF_VOID_P == 8
+ grub_test_assert (q == (a / b),
+ "C compiler division failure in 0x%llx, 0x%llx", (long long) a, (long long) b);
+ grub_test_assert (r == (a % b),
+ "C compiler modulo failure in 0x%llx, 0x%llx", (long long) a, (long long) b);
+#endif
+}
+
+static void
+test_all(grub_uint64_t a, grub_uint64_t b)
+{
+ test64 (a, b);
+ test32 (a, b);
+ test64s (a, b);
+ test32s (a, b);
+ test64s (a, -b);
+ test32s (a, -b);
+ test64s (-a, b);
+ test32s (-a, b);
+ test64s (-a, -b);
+ test32s (-a, -b);
+}
+
+static void
+div_test (void)
+{
+ grub_uint64_t a = 404, b = 7;
+ grub_size_t i;
+
+ for (i = 0; i < ARRAY_SIZE (vectors); i++)
+ {
+ test_all (vectors[i][0], vectors[i][1]);
+ }
+ for (i = 0; i < 40000; i++)
+ {
+ a = 17 * a + 13 * b;
+ b = 23 * a + 29 * b;
+ if (b == 0)
+ b = 1;
+ if (a == 0)
+ a = 1;
+ test_all (a, b);
+ }
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (div_test, div_test);
diff --git a/grub-core/tests/example_functional_test.c b/grub-core/tests/example_functional_test.c
new file mode 100644
index 0000000..999f6d2
--- /dev/null
+++ b/grub-core/tests/example_functional_test.c
@@ -0,0 +1,38 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* All tests need to include test.h for GRUB testing framework. */
+#include <grub/test.h>
+#include <grub/dl.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+/* Functional test main method. */
+static void
+example_test (void)
+{
+ /* Check if 1st argument is true and report with default error message. */
+ grub_test_assert (1 == 1, "1 equal 1 expected");
+
+ /* Check if 1st argument is true and report with custom error message. */
+ grub_test_assert (2 == 2, "2 equal 2 expected");
+ grub_test_assert (2 != 3, "2 matches %d", 3);
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (exfctest, example_test);
diff --git a/grub-core/tests/fake_input.c b/grub-core/tests/fake_input.c
new file mode 100644
index 0000000..b5eb516
--- /dev/null
+++ b/grub-core/tests/fake_input.c
@@ -0,0 +1,75 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/term.h>
+#include <grub/mm.h>
+#include <grub/dl.h>
+#include <grub/test.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static int *seq;
+static int seqptr, nseq;
+static struct grub_term_input *saved;
+static int fake_input;
+
+static int
+fake_getkey (struct grub_term_input *term __attribute__ ((unused)))
+{
+ if (seq && seqptr < nseq)
+ return seq[seqptr++];
+ return -1;
+}
+
+static struct grub_term_input fake_input_term =
+ {
+ .name = "fake",
+ .getkey = fake_getkey
+ };
+
+void
+grub_terminal_input_fake_sequence (int *seq_in, int nseq_in)
+{
+ if (!fake_input)
+ saved = grub_term_inputs;
+ if (seq)
+ grub_free (seq);
+ seq = grub_calloc (nseq_in, sizeof (seq[0]));
+ if (!seq)
+ return;
+
+ grub_term_inputs = &fake_input_term;
+ grub_memcpy (seq, seq_in, nseq_in * sizeof (seq[0]));
+
+ nseq = nseq_in;
+ seqptr = 0;
+ fake_input = 1;
+}
+
+void
+grub_terminal_input_fake_sequence_end (void)
+{
+ if (!fake_input)
+ return;
+ fake_input = 0;
+ grub_term_inputs = saved;
+ grub_free (seq);
+ seq = 0;
+ nseq = 0;
+ seqptr = 0;
+}
diff --git a/grub-core/tests/gfxterm_menu.c b/grub-core/tests/gfxterm_menu.c
new file mode 100644
index 0000000..12836fb
--- /dev/null
+++ b/grub-core/tests/gfxterm_menu.c
@@ -0,0 +1,180 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* All tests need to include test.h for GRUB testing framework. */
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/video.h>
+#include <grub/video_fb.h>
+#include <grub/command.h>
+#include <grub/font.h>
+#include <grub/procfs.h>
+#include <grub/env.h>
+#include <grub/normal.h>
+#include <grub/time.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+
+static const char testfile[] =
+ "menuentry \"test\" {\n"
+ "\ttrue\n"
+ "}\n"
+ "menuentry \"s̛ ơ t o̒ s̒ u o̕̚ 8.04 m̂ñåh̊z̆x̣ a̡ b̢g̢ u᷎ô᷎ ô᷎ O̷ a̖̣ ȃ̐\" --class ubuntu --class linux --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ "menuentry \" הַרמלל(טוֹבָ) לֶךְ\" --class opensuse --class linux --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ "menuentry \"الرملل جِداً لِكَ\" --class gentoo --class linux --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ "menuentry \"ὑπόγυͅον\" --class kubuntu --class linux --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ "menuentry \"سَّ نِّ نَّ نٌّ نّْ\" --class linuxmint --class linux --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ /* Chinese & UTF-8 test from Carbon Jiao. */
+ "menuentry \"从硬盘的第一主分区启动\" --class \"windows xp\" --class windows --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ "timeout=3\n";
+
+static char *
+get_test_cfg (grub_size_t *sz)
+{
+ *sz = grub_strlen (testfile);
+ return grub_strdup (testfile);
+}
+
+struct grub_procfs_entry test_cfg =
+{
+ .name = "test.cfg",
+ .get_contents = get_test_cfg
+};
+
+struct
+{
+ const char *name;
+ const char *var;
+ const char *val;
+} tests[] =
+ {
+ { "gfxterm_menu", NULL, NULL },
+ { "gfxmenu", "theme", "starfield/theme.txt" },
+ { "gfxterm_ar", "lang", "en@arabic" },
+ { "gfxterm_cyr", "lang", "en@cyrillic" },
+ { "gfxterm_heb", "lang", "en@hebrew" },
+ { "gfxterm_gre", "lang", "en@greek" },
+ { "gfxterm_ru", "lang", "ru" },
+ { "gfxterm_fr", "lang", "fr" },
+ { "gfxterm_quot", "lang", "en@quot" },
+ { "gfxterm_piglatin", "lang", "en@piglatin" },
+ { "gfxterm_ch", "lang", "de_CH" },
+ { "gfxterm_red", "menu_color_normal", "red/blue" },
+ { "gfxterm_high", "menu_color_highlight", "blue/red" },
+ };
+
+#define FONT_NAME "Unknown Regular 16"
+
+/* Functional test main method. */
+static void
+gfxterm_menu (void)
+{
+ unsigned i, j;
+ grub_font_t font;
+
+ grub_dl_load ("png");
+ grub_dl_load ("gettext");
+ grub_dl_load ("gfxterm");
+
+ grub_errno = GRUB_ERR_NONE;
+
+ grub_dl_load ("gfxmenu");
+
+ font = grub_font_get (FONT_NAME);
+ if (font && grub_strcmp (font->name, FONT_NAME) != 0)
+ font = 0;
+ if (!font)
+ font = grub_font_load ("unicode");
+
+ if (!font)
+ {
+ grub_test_assert (0, "unicode font not found: %s", grub_errmsg);
+ return;
+ }
+
+ grub_procfs_register ("test.cfg", &test_cfg);
+
+ for (j = 0; j < ARRAY_SIZE (tests); j++)
+ for (i = 0; i < GRUB_TEST_VIDEO_SMALL_N_MODES; i++)
+ {
+ grub_uint64_t start;
+
+#if defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_IEEE1275)
+ if (grub_test_video_modes[i].width > 1024)
+ continue;
+ if (grub_strcmp (tests[j].name, "gfxmenu") == 0
+ && grub_test_video_modes[i].width > 800)
+ continue;
+#endif
+ start = grub_get_time_ms ();
+
+ grub_video_capture_start (&grub_test_video_modes[i],
+ grub_video_fbstd_colors,
+ grub_test_video_modes[i].number_of_colors);
+ if (grub_errno)
+ {
+ grub_test_assert (0, "can't start capture: %d: %s",
+ grub_errno, grub_errmsg);
+ return;
+ }
+ grub_terminal_input_fake_sequence ((int []) { -1, -1, -1, GRUB_TERM_KEY_DOWN, -1, 'e',
+ -1, GRUB_TERM_KEY_RIGHT, -1, 'x', -1, GRUB_TERM_ESC, -1, GRUB_TERM_ESC }, 14);
+
+ grub_video_checksum (tests[j].name);
+
+ if (grub_test_use_gfxterm ())
+ return;
+
+ grub_env_context_open ();
+ if (tests[j].var)
+ grub_env_set (tests[j].var, tests[j].val);
+ grub_normal_execute ("(proc)/test.cfg", 1, 0);
+ grub_env_context_close ();
+
+ grub_test_use_gfxterm_end ();
+
+ grub_terminal_input_fake_sequence_end ();
+ grub_video_checksum_end ();
+ grub_video_capture_end ();
+
+ if (tests[j].var)
+ grub_env_unset (tests[j].var);
+ grub_printf ("%s %dx%dx%s done %lld ms\n", tests[j].name,
+ grub_test_video_modes[i].width,
+ grub_test_video_modes[i].height,
+ grub_video_checksum_get_modename (), (long long) (grub_get_time_ms () - start));
+ }
+
+ grub_procfs_unregister (&test_cfg);
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (gfxterm_menu, gfxterm_menu);
diff --git a/grub-core/tests/legacy_password_test.c b/grub-core/tests/legacy_password_test.c
new file mode 100644
index 0000000..2546033
--- /dev/null
+++ b/grub-core/tests/legacy_password_test.c
@@ -0,0 +1,68 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/misc.h>
+#include <grub/crypto.h>
+#include <grub/legacy_parse.h>
+#include <grub/auth.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static struct
+{
+ char **args;
+ int argc;
+ char entered[GRUB_AUTH_MAX_PASSLEN];
+ int exp;
+} vectors[] = {
+ { (char * []) { (char *) "hello", NULL }, 1, "hello", 1 },
+ { (char * []) { (char *) "hello", NULL }, 1, "hi", 0 },
+ { (char * []) { (char *) "hello", NULL }, 1, "hillo", 0 },
+ { (char * []) { (char *) "hello", NULL }, 1, "hellw", 0 },
+ { (char * []) { (char *) "hello", NULL }, 1, "hell", 0 },
+ { (char * []) { (char *) "hello", NULL }, 1, "h", 0 },
+ { (char * []) { (char *) "--md5", (char *) "$1$maL$OKEF0PD2k6eQ0Po8u4Gjr/",
+ NULL }, 2, "hello", 1 },
+ { (char * []) { (char *) "--md5", (char *) "$1$maL$OKEF0PD2k6eQ0Po8u4Gjr/",
+ NULL }, 2, "hell", 0 },
+ { (char * []) { (char *) "--md5", (char *) "$1$naL$BaFO8zGgmss1E76GsrAec1",
+ NULL }, 2, "hello", 1 },
+ { (char * []) { (char *) "--md5", (char *) "$1$naL$BaFO8zGgmss1E76GsrAec1",
+ NULL }, 2, "hell", 0 },
+ { (char * []) { (char *) "--md5", (char *) "$1$oaL$eyrazuM7TkxVkKgBim1WH1",
+ NULL }, 2, "hi", 1 },
+ { (char * []) { (char *) "--md5", (char *) "$1$oaL$eyrazuM7TkxVkKgBim1WH1",
+ NULL }, 2, "hello", 0 },
+};
+
+static void
+legacy_password_test (void)
+{
+ grub_size_t i;
+
+ for (i = 0; i < ARRAY_SIZE (vectors); i++)
+ grub_test_assert (grub_legacy_check_md5_password (vectors[i].argc,
+ vectors[i].args,
+ vectors[i].entered)
+ == vectors[i].exp, "Bad password check (%d)", (int) i);
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (legacy_password_test, legacy_password_test);
diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c
new file mode 100644
index 0000000..96781fb
--- /dev/null
+++ b/grub-core/tests/lib/functional_test.c
@@ -0,0 +1,105 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/mm.h>
+#include <grub/misc.h>
+#include <grub/extcmd.h>
+#include <grub/test.h>
+#include <grub/dl.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static grub_err_t
+grub_functional_test (grub_extcmd_context_t ctxt __attribute__ ((unused)),
+ int argc,
+ char **args)
+{
+ grub_test_t test;
+ int ok = 1;
+ int i;
+
+ FOR_LIST_ELEMENTS (test, grub_test_list)
+ {
+ if (argc != 0)
+ {
+ for (i = 0; i < argc; i++)
+ if (grub_strcmp(args[i], test->name) == 0)
+ break;
+ if (i == argc)
+ continue;
+ }
+ grub_errno = 0;
+ ok = ok && !grub_test_run (test);
+ grub_errno = 0;
+ }
+ if (ok)
+ grub_printf ("ALL TESTS PASSED\n");
+ else
+ grub_printf ("TEST FAILURE\n");
+ return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)),
+ int argc __attribute__ ((unused)),
+ char **args __attribute__ ((unused)))
+{
+ grub_test_t test;
+ int ok = 1;
+
+ grub_dl_load ("legacy_password_test");
+ grub_errno = GRUB_ERR_NONE;
+ grub_dl_load ("exfctest");
+ grub_dl_load ("videotest_checksum");
+ grub_dl_load ("gfxterm_menu");
+ grub_dl_load ("setjmp_test");
+ grub_dl_load ("cmdline_cat_test");
+ grub_dl_load ("div_test");
+ grub_dl_load ("xnu_uuid_test");
+ grub_dl_load ("pbkdf2_test");
+ grub_dl_load ("signature_test");
+ grub_dl_load ("sleep_test");
+ grub_dl_load ("bswap_test");
+ grub_dl_load ("ctz_test");
+ grub_dl_load ("cmp_test");
+ grub_dl_load ("mul_test");
+ grub_dl_load ("shift_test");
+
+ FOR_LIST_ELEMENTS (test, grub_test_list)
+ ok = !grub_test_run (test) && ok;
+ if (ok)
+ grub_printf ("ALL TESTS PASSED\n");
+ else
+ grub_printf ("TEST FAILURE\n");
+ return GRUB_ERR_NONE;
+}
+
+static grub_extcmd_t cmd;
+
+GRUB_MOD_INIT (functional_test)
+{
+ cmd = grub_register_extcmd ("functional_test", grub_functional_test, 0, 0,
+ "Run all loaded functional tests.", 0);
+ cmd = grub_register_extcmd ("all_functional_test", grub_functional_all_tests, 0, 0,
+ "Run all functional tests.", 0);
+}
+
+GRUB_MOD_FINI (functional_test)
+{
+ grub_unregister_extcmd (cmd);
+}
diff --git a/grub-core/tests/lib/test.c b/grub-core/tests/lib/test.c
new file mode 100644
index 0000000..3000fc8
--- /dev/null
+++ b/grub-core/tests/lib/test.c
@@ -0,0 +1,239 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/mm.h>
+#include <grub/misc.h>
+#include <grub/test.h>
+
+struct grub_test_failure
+{
+ /* The next failure. */
+ struct grub_test_failure *next;
+ struct grub_test_failure **prev;
+
+ /* The test source file name. */
+ char *file;
+
+ /* The test function name. */
+ char *funp;
+
+ /* The test call line number. */
+ grub_uint32_t line;
+
+ /* The test failure message. */
+ char *message;
+};
+typedef struct grub_test_failure *grub_test_failure_t;
+
+grub_test_t grub_test_list;
+static grub_test_failure_t failure_list;
+
+static grub_test_failure_t
+failure_start(const char *file, const char *funp, grub_uint32_t line);
+static grub_test_failure_t
+failure_start(const char *file, const char *funp, grub_uint32_t line)
+{
+ grub_test_failure_t failure;
+
+ failure = (grub_test_failure_t) grub_malloc (sizeof (*failure));
+ if (!failure)
+ return NULL;
+
+ failure->file = grub_strdup (file ? : "<unknown_file>");
+ if (!failure->file)
+ {
+ grub_free(failure);
+ return NULL;
+ }
+
+ failure->funp = grub_strdup (funp ? : "<unknown_function>");
+ if (!failure->funp)
+ {
+ grub_free(failure->file);
+ grub_free(failure);
+ return NULL;
+ }
+
+ failure->line = line;
+
+ failure->message = NULL;
+
+ return failure;
+}
+
+static void
+failure_append_vtext(grub_test_failure_t failure, const char *fmt, va_list args);
+static void
+failure_append_vtext(grub_test_failure_t failure, const char *fmt, va_list args)
+{
+ char *msg = grub_xvasprintf(fmt, args);
+ if (failure->message)
+ {
+ char *oldmsg = failure->message;
+
+ failure->message = grub_xasprintf("%s%s", oldmsg, msg);
+ grub_free (oldmsg);
+ grub_free (msg);
+ }
+ else
+ {
+ failure->message = msg;
+ }
+}
+
+static void
+failure_append_text(grub_test_failure_t failure, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ failure_append_vtext(failure, fmt, args);
+ va_end(args);
+}
+
+static void
+add_failure (const char *file,
+ const char *funp,
+ grub_uint32_t line, const char *fmt, va_list args)
+{
+ grub_test_failure_t failure = failure_start(file, funp, line);
+ failure_append_text(failure, fmt, args);
+ grub_list_push (GRUB_AS_LIST_P (&failure_list), GRUB_AS_LIST (failure));
+}
+
+static void
+free_failures (void)
+{
+ grub_test_failure_t item;
+
+ while (failure_list)
+ {
+ item = failure_list;
+ failure_list = item->next;
+ if (item->message)
+ grub_free (item->message);
+
+ if (item->funp)
+ grub_free (item->funp);
+
+ if (item->file)
+ grub_free (item->file);
+
+ grub_free (item);
+ }
+ failure_list = 0;
+}
+
+void
+grub_test_nonzero (int cond,
+ const char *file,
+ const char *funp, grub_uint32_t line, const char *fmt, ...)
+{
+ va_list ap;
+
+ if (cond)
+ return;
+
+ va_start (ap, fmt);
+ add_failure (file, funp, line, fmt, ap);
+ va_end (ap);
+}
+
+void
+grub_test_assert_helper (int cond, const char *file, const char *funp,
+ grub_uint32_t line, const char *condstr,
+ const char *fmt, ...)
+{
+ va_list ap;
+ grub_test_failure_t failure;
+
+ if (cond)
+ return;
+
+ failure = failure_start(file, funp, line);
+ failure_append_text(failure, "assert failed: %s ", condstr);
+
+ va_start(ap, fmt);
+
+ failure_append_vtext(failure, fmt, ap);
+
+ va_end(ap);
+
+ grub_list_push (GRUB_AS_LIST_P (&failure_list), GRUB_AS_LIST (failure));
+}
+
+void
+grub_test_register (const char *name, void (*test_main) (void))
+{
+ grub_test_t test;
+
+ test = (grub_test_t) grub_malloc (sizeof (*test));
+ if (!test)
+ return;
+
+ test->name = grub_strdup (name);
+ test->main = test_main;
+
+ grub_list_push (GRUB_AS_LIST_P (&grub_test_list), GRUB_AS_LIST (test));
+}
+
+void
+grub_test_unregister (const char *name)
+{
+ grub_test_t test;
+
+ test = (grub_test_t) grub_named_list_find
+ (GRUB_AS_NAMED_LIST (grub_test_list), name);
+
+ if (test)
+ {
+ grub_list_remove (GRUB_AS_LIST (test));
+
+ if (test->name)
+ grub_free (test->name);
+
+ grub_free (test);
+ }
+}
+
+int
+grub_test_run (grub_test_t test)
+{
+ grub_test_failure_t failure;
+
+ test->main ();
+
+ grub_printf ("%s:\n", test->name);
+ FOR_LIST_ELEMENTS (failure, failure_list)
+ grub_printf (" %s:%s:%u: %s\n",
+ (failure->file ? : "<unknown_file>"),
+ (failure->funp ? : "<unknown_function>"),
+ failure->line, (failure->message ? : "<no message>"));
+
+ if (!failure_list)
+ {
+ grub_printf ("%s: PASS\n", test->name);
+ return GRUB_ERR_NONE;
+ }
+ else
+ {
+ grub_printf ("%s: FAIL\n", test->name);
+ free_failures ();
+ return GRUB_ERR_TEST_FAILURE;
+ }
+}
diff --git a/grub-core/tests/mul_test.c b/grub-core/tests/mul_test.c
new file mode 100644
index 0000000..cd64231
--- /dev/null
+++ b/grub-core/tests/mul_test.c
@@ -0,0 +1,73 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/misc.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static grub_uint64_t vectors[][2] = {
+ { 0xffffffffffffffffULL, 1},
+ { 1, 0xffffffffffffffffULL},
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL},
+ { 1, 1 },
+ { 2, 1 }
+};
+
+static void
+test64(grub_uint64_t a, grub_uint64_t b)
+{
+ grub_uint64_t r1 = a * b, r2 = 0, r3;
+ int i;
+ for (i = 0; i < 64; i++)
+ if ((a & (1LL << i)))
+ r2 += b << i;
+ r3 = ((grub_int64_t) a) * ((grub_int64_t) b);
+ grub_test_assert (r1 == r2,
+ "multiplication mismatch (u): 0x%llx x 0x%llx = 0x%llx != 0x%llx",
+ (long long) a, (long long) b, (long long) r2, (long long) r1);
+ grub_test_assert (r3 == r2,
+ "multiplication mismatch (s): 0x%llx x 0x%llx = 0x%llx != 0x%llx",
+ (long long) a, (long long) b, (long long) r2, (long long) r3);
+}
+
+static void
+mul_test (void)
+{
+ grub_uint64_t a = 404, b = 7;
+ grub_size_t i;
+
+ for (i = 0; i < ARRAY_SIZE (vectors); i++)
+ {
+ test64 (vectors[i][0], vectors[i][1]);
+ }
+ for (i = 0; i < 40000; i++)
+ {
+ a = 17 * a + 13 * b;
+ b = 23 * a + 29 * b;
+ if (b == 0)
+ b = 1;
+ if (a == 0)
+ a = 1;
+ test64 (a, b);
+ }
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (mul_test, mul_test);
diff --git a/grub-core/tests/pbkdf2_test.c b/grub-core/tests/pbkdf2_test.c
new file mode 100644
index 0000000..4eeb8b8
--- /dev/null
+++ b/grub-core/tests/pbkdf2_test.c
@@ -0,0 +1,97 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/misc.h>
+#include <grub/crypto.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static struct
+{
+ const char *P;
+ grub_size_t Plen;
+ const char *S;
+ grub_size_t Slen;
+ unsigned int c;
+ grub_size_t dkLen;
+ const char *DK;
+} vectors[] = {
+ /* RFC6070. */
+ {
+ "password", 8,
+ "salt", 4,
+ 1, 20,
+ "\x0c\x60\xc8\x0f\x96\x1f\x0e\x71\xf3\xa9\xb5\x24\xaf\x60\x12"
+ "\x06\x2f\xe0\x37\xa6"
+ },
+ {
+ "password", 8,
+ "salt", 4,
+ 2, 20,
+ "\xea\x6c\x01\x4d\xc7\x2d\x6f\x8c"
+ "\xcd\x1e\xd9\x2a\xce\x1d\x41\xf0"
+ "\xd8\xde\x89\x57"
+ },
+ {
+ "password", 8,
+ "salt", 4,
+ 4096, 20,
+ "\x4b\x00\x79\x01\xb7\x65\x48\x9a\xbe\xad\x49\xd9\x26\xf7"
+ "\x21\xd0\x65\xa4\x29\xc1"
+ },
+ {
+ "passwordPASSWORDpassword", 24,
+ "saltSALTsaltSALTsaltSALTsaltSALTsalt", 36,
+ 4096, 25,
+ "\x3d\x2e\xec\x4f\xe4\x1c\x84\x9b\x80\xc8\xd8\x36\x62\xc0"
+ "\xe4\x4a\x8b\x29\x1a\x96\x4c\xf2\xf0\x70\x38"
+ },
+ {
+ "pass\0word", 9,
+ "sa\0lt", 5,
+ 4096, 16,
+ "\x56\xfa\x6a\xa7\x55\x48\x09\x9d\xcc\x37\xd7\xf0\x34\x25\xe0\xc3"
+ }
+};
+
+static void
+pbkdf2_test (void)
+{
+ grub_size_t i;
+
+ for (i = 0; i < ARRAY_SIZE (vectors); i++)
+ {
+ gcry_err_code_t err;
+ grub_uint8_t DK[32];
+ err = grub_crypto_pbkdf2 (GRUB_MD_SHA1,
+ (const grub_uint8_t *) vectors[i].P,
+ vectors[i].Plen,
+ (const grub_uint8_t *) vectors[i].S,
+ vectors[i].Slen,
+ vectors[i].c,
+ DK, vectors[i].dkLen);
+ grub_test_assert (err == 0, "gcry error %d", err);
+ grub_test_assert (grub_memcmp (DK, vectors[i].DK, vectors[i].dkLen) == 0,
+ "PBKDF2 mismatch");
+ }
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (pbkdf2_test, pbkdf2_test);
diff --git a/grub-core/tests/setjmp_test.c b/grub-core/tests/setjmp_test.c
new file mode 100644
index 0000000..604a6ce
--- /dev/null
+++ b/grub-core/tests/setjmp_test.c
@@ -0,0 +1,80 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/setjmp.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static grub_jmp_buf jmp_point;
+static int expected, ctr;
+
+/* This fixes GCC7 "unintentional fallthrough" warning */
+static void jmp0 (void) __attribute__ ((noreturn));
+static void jmp1 (void) __attribute__ ((noreturn));
+static void jmp2 (void) __attribute__ ((noreturn));
+
+static void
+jmp0 (void)
+{
+ grub_longjmp (jmp_point, 0);
+}
+
+static void
+jmp1 (void)
+{
+ grub_longjmp (jmp_point, 1);
+}
+
+static void
+jmp2 (void)
+{
+ grub_longjmp (jmp_point, 2);
+}
+
+static void
+setjmp_test (void)
+{
+ int val;
+
+ expected = 0;
+ ctr = 0;
+ val = grub_setjmp (jmp_point);
+
+ grub_test_assert (val == expected, "setjmp returned %d instead of %d",
+ val, expected);
+ switch (ctr++)
+ {
+ case 0:
+ expected = 1;
+ jmp0 ();
+ case 1:
+ expected = 1;
+ jmp1 ();
+ case 2:
+ expected = 2;
+ jmp2 ();
+ case 3:
+ return;
+ }
+ grub_test_assert (0, "setjmp didn't return enough times");
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (setjmp_test, setjmp_test);
diff --git a/grub-core/tests/shift_test.c b/grub-core/tests/shift_test.c
new file mode 100644
index 0000000..4120f52
--- /dev/null
+++ b/grub-core/tests/shift_test.c
@@ -0,0 +1,157 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2015 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/misc.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static grub_uint64_t vectors[] = {
+ 0xffffffffffffffffULL, 1, 2, 0, 0x0102030405060708ULL
+};
+
+/* We're testing shifts, don't replace access to this with a shift. */
+static const grub_uint8_t bitmask[] =
+ { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
+
+typedef union {
+ grub_uint64_t v64;
+ grub_uint8_t v8[8];
+} grub_raw_u64_t;
+
+static int
+get_bit64 (grub_uint64_t v, int b)
+{
+ grub_raw_u64_t vr = { .v64 = v };
+ grub_uint8_t *p = vr.v8;
+ if (b >= 64)
+ return 0;
+#ifdef GRUB_CPU_WORDS_BIGENDIAN
+ p += 7 - b / 8;
+#else
+ p += b / 8;
+#endif
+ return !!(*p & bitmask[b % 8]);
+}
+
+static grub_uint64_t
+set_bit64 (grub_uint64_t v, int b)
+{
+ grub_raw_u64_t vr = { .v64 = v };
+ grub_uint8_t *p = vr.v8;
+ if (b >= 64)
+ return v;
+#ifdef GRUB_CPU_WORDS_BIGENDIAN
+ p += 7 - b / 8;
+#else
+ p += b / 8;
+#endif
+ *p |= bitmask[b % 8];
+ return vr.v64;
+}
+
+static grub_uint64_t
+left_shift64 (grub_uint64_t v, int s)
+{
+ grub_uint64_t r = 0;
+ int i;
+ for (i = 0; i + s < 64; i++)
+ if (get_bit64 (v, i))
+ r = set_bit64 (r, i + s);
+ return r;
+}
+
+static grub_uint64_t
+right_shift64 (grub_uint64_t v, int s)
+{
+ grub_uint64_t r = 0;
+ int i;
+ for (i = s; i < 64; i++)
+ if (get_bit64 (v, i))
+ r = set_bit64 (r, i - s);
+ return r;
+}
+
+static grub_uint64_t
+arithmetic_right_shift64 (grub_uint64_t v, int s)
+{
+ grub_uint64_t r = 0;
+ int i;
+ for (i = s; i < 64; i++)
+ if (get_bit64 (v, i))
+ r = set_bit64 (r, i - s);
+ if (get_bit64 (v, 63))
+ for (i -= s; i < 64; i++)
+ r = set_bit64 (r, i);
+
+ return r;
+}
+
+static void
+test64 (grub_uint64_t v)
+{
+ int i;
+ for (i = 0; i < 64; i++)
+ {
+ grub_test_assert ((v << i) == left_shift64 (v, i),
+ "lshift wrong: 0x%llx << %d: 0x%llx, 0x%llx",
+ (long long) v, i,
+ (long long) (v << i), (long long) left_shift64 (v, i));
+ grub_test_assert ((v >> i) == right_shift64 (v, i),
+ "rshift wrong: 0x%llx >> %d: 0x%llx, 0x%llx",
+ (long long) v, i,
+ (long long) (v >> i), (long long) right_shift64 (v, i));
+ grub_test_assert ((((grub_int64_t) v) >> i) == (grub_int64_t) arithmetic_right_shift64 (v, i),
+ "arithmetic rshift wrong: ((grub_int64_t) 0x%llx) >> %d: 0x%llx, 0x%llx",
+ (long long) v, i,
+ (long long) (((grub_int64_t) v) >> i), (long long) arithmetic_right_shift64 (v, i));
+ }
+}
+
+static void
+test_all(grub_uint64_t a)
+{
+ test64 (a);
+}
+
+static void
+shift_test (void)
+{
+ grub_uint64_t a = 404, b = 7;
+ grub_size_t i;
+
+ for (i = 0; i < ARRAY_SIZE (vectors); i++)
+ {
+ test_all (vectors[i]);
+ }
+ for (i = 0; i < 4000; i++)
+ {
+ a = 17 * a + 13 * b;
+ b = 23 * a + 29 * b;
+ if (b == 0)
+ b = 1;
+ if (a == 0)
+ a = 1;
+ test_all (a);
+ test_all (b);
+ }
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (shift_test, shift_test);
diff --git a/grub-core/tests/signature_test.c b/grub-core/tests/signature_test.c
new file mode 100644
index 0000000..aa49393
--- /dev/null
+++ b/grub-core/tests/signature_test.c
@@ -0,0 +1,170 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/time.h>
+#include <grub/misc.h>
+#include <grub/dl.h>
+#include <grub/command.h>
+#include <grub/env.h>
+#include <grub/test.h>
+#include <grub/mm.h>
+#include <grub/procfs.h>
+
+#include "signatures.h"
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static char *
+get_hi_dsa_sig (grub_size_t *sz)
+{
+ char *ret;
+ *sz = sizeof (hi_dsa_sig);
+ ret = grub_malloc (sizeof (hi_dsa_sig));
+ if (ret)
+ grub_memcpy (ret, hi_dsa_sig, sizeof (hi_dsa_sig));
+ return ret;
+}
+
+static struct grub_procfs_entry hi_dsa_sig_entry =
+{
+ .name = "hi_dsa.sig",
+ .get_contents = get_hi_dsa_sig
+};
+
+static char *
+get_hi_dsa_pub (grub_size_t *sz)
+{
+ char *ret;
+ *sz = sizeof (hi_dsa_pub);
+ ret = grub_malloc (sizeof (hi_dsa_pub));
+ if (ret)
+ grub_memcpy (ret, hi_dsa_pub, sizeof (hi_dsa_pub));
+ return ret;
+}
+
+static struct grub_procfs_entry hi_dsa_pub_entry =
+{
+ .name = "hi_dsa.pub",
+ .get_contents = get_hi_dsa_pub
+};
+
+static char *
+get_hi_rsa_sig (grub_size_t *sz)
+{
+ char *ret;
+ *sz = sizeof (hi_rsa_sig);
+ ret = grub_malloc (sizeof (hi_rsa_sig));
+ if (ret)
+ grub_memcpy (ret, hi_rsa_sig, sizeof (hi_rsa_sig));
+ return ret;
+}
+
+static struct grub_procfs_entry hi_rsa_sig_entry =
+{
+ .name = "hi_rsa.sig",
+ .get_contents = get_hi_rsa_sig
+};
+
+static char *
+get_hi_rsa_pub (grub_size_t *sz)
+{
+ char *ret;
+ *sz = sizeof (hi_rsa_pub);
+ ret = grub_malloc (sizeof (hi_rsa_pub));
+ if (ret)
+ grub_memcpy (ret, hi_rsa_pub, sizeof (hi_rsa_pub));
+ return ret;
+}
+
+static struct grub_procfs_entry hi_rsa_pub_entry =
+{
+ .name = "hi_rsa.pub",
+ .get_contents = get_hi_rsa_pub
+};
+
+static char *
+get_hi (grub_size_t *sz)
+{
+ *sz = 3;
+ return grub_strdup ("hi\n");
+}
+
+struct grub_procfs_entry hi =
+{
+ .name = "hi",
+ .get_contents = get_hi
+};
+
+static char *
+get_hj (grub_size_t *sz)
+{
+ *sz = 3;
+ return grub_strdup ("hj\n");
+}
+
+struct grub_procfs_entry hj =
+{
+ .name = "hj",
+ .get_contents = get_hj
+};
+
+static void
+do_verify (const char *f, const char *sig, const char *pub, int is_valid)
+{
+ grub_command_t cmd;
+ char *args[] = { (char *) f, (char *) sig,
+ (char *) pub, NULL };
+ grub_err_t err;
+
+ cmd = grub_command_find ("verify_detached");
+ if (!cmd)
+ {
+ grub_test_assert (0, "can't find command `%s'", "verify_detached");
+ return;
+ }
+ err = (cmd->func) (cmd, 3, args);
+
+ grub_test_assert (err == (is_valid ? 0 : GRUB_ERR_BAD_SIGNATURE),
+ "verification failed: %d: %s", grub_errno, grub_errmsg);
+ grub_errno = GRUB_ERR_NONE;
+
+}
+static void
+signature_test (void)
+{
+ grub_procfs_register ("hi", &hi);
+ grub_procfs_register ("hj", &hj);
+ grub_procfs_register ("hi_dsa.pub", &hi_dsa_pub_entry);
+ grub_procfs_register ("hi_dsa.sig", &hi_dsa_sig_entry);
+ grub_procfs_register ("hi_rsa.pub", &hi_rsa_pub_entry);
+ grub_procfs_register ("hi_rsa.sig", &hi_rsa_sig_entry);
+
+ do_verify ("(proc)/hi", "(proc)/hi_dsa.sig", "(proc)/hi_dsa.pub", 1);
+ do_verify ("(proc)/hi", "(proc)/hi_dsa.sig", "(proc)/hi_dsa.pub", 1);
+ do_verify ("(proc)/hj", "(proc)/hi_dsa.sig", "(proc)/hi_dsa.pub", 0);
+
+ do_verify ("(proc)/hi", "(proc)/hi_rsa.sig", "(proc)/hi_rsa.pub", 1);
+ do_verify ("(proc)/hj", "(proc)/hi_rsa.sig", "(proc)/hi_rsa.pub", 0);
+
+ grub_procfs_unregister (&hi);
+ grub_procfs_unregister (&hj);
+ grub_procfs_unregister (&hi_dsa_sig_entry);
+ grub_procfs_unregister (&hi_dsa_pub_entry);
+}
+
+GRUB_FUNCTIONAL_TEST (signature_test, signature_test);
diff --git a/grub-core/tests/signatures.h b/grub-core/tests/signatures.h
new file mode 100644
index 0000000..d78c2b6
--- /dev/null
+++ b/grub-core/tests/signatures.h
@@ -0,0 +1,211 @@
+static unsigned char hi_rsa_sig[] =
+{
+0x89, 0x02, 0x1c, 0x04, 0x00, 0x01, 0x02, 0x00, 0x06, 0x05, 0x02, 0x52, 0x82, 0x2d, 0x16, 0x00,
+0x0a, 0x09, 0x10, 0x0f, 0xcc, 0xf3, 0x21, 0x77, 0x83, 0x6a, 0x0d, 0xdb, 0x5e, 0x10, 0x00, 0x80,
+0x36, 0x2c, 0xb0, 0xbf, 0x26, 0x36, 0xf2, 0x9d, 0x93, 0xa0, 0xbf, 0xcb, 0xa7, 0x0d, 0xbe, 0x67,
+0x33, 0xf6, 0xba, 0xec, 0x2b, 0xe9, 0x7e, 0x0e, 0xec, 0x51, 0xd5, 0xdd, 0x2d, 0x9a, 0x96, 0x09,
+0x8a, 0x7f, 0x02, 0xd5, 0xbc, 0xdb, 0xc9, 0xef, 0xd8, 0x90, 0x8a, 0xa8, 0x71, 0x6f, 0xaf, 0x8c,
+0xe5, 0x6a, 0xc4, 0xda, 0x2a, 0x1f, 0x17, 0xb1, 0x70, 0x69, 0x06, 0x2b, 0x2f, 0x18, 0x72, 0x72,
+0x28, 0xd6, 0x32, 0xa1, 0x96, 0x14, 0xd5, 0x2a, 0x52, 0x35, 0x4a, 0x3b, 0x8b, 0x6f, 0x0c, 0x24,
+0x97, 0xb7, 0x7f, 0xf6, 0x15, 0x8c, 0xbf, 0x69, 0x73, 0xee, 0x15, 0x0f, 0x07, 0x7e, 0x5e, 0x07,
+0x9b, 0x81, 0x28, 0x74, 0x49, 0x94, 0xd3, 0x05, 0xeb, 0xc9, 0x63, 0x70, 0x89, 0x91, 0x68, 0xe6,
+0x20, 0x32, 0x95, 0x00, 0x00, 0xc8, 0xba, 0xbd, 0x45, 0x77, 0x6b, 0x60, 0xa4, 0xa3, 0x05, 0x6b,
+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xfa, 0xab, 0x96, 0x99, 0x2b,
+0x91, 0xda, 0xe1, 0x69, 0x6f, 0xd8, 0x1b, 0x28, 0x73, 0xb2, 0x51, 0xfa, 0xcf, 0xa7, 0x9e
+};
+
+static unsigned char hi_rsa_pub[] =
+{
+0x99, 0x02, 0x0d, 0x04, 0x52, 0x82, 0x2c, 0xee, 0x01, 0x10, 0x00, 0xbe, 0x0d, 0x60, 0xa0, 0x12,
+0x2f, 0x3c, 0x6a, 0x72, 0x29, 0x61, 0x26, 0xdd, 0x2e, 0x4e, 0x62, 0xad, 0xa6, 0xb3, 0x2b, 0x45,
+0x94, 0x94, 0x99, 0x2a, 0x6e, 0xd0, 0xda, 0x5f, 0xf6, 0x99, 0xee, 0xbe, 0x0e, 0x10, 0x42, 0xea,
+0x0b, 0x44, 0xac, 0x76, 0x06, 0x0b, 0x30, 0xd0, 0x2e, 0xd9, 0xe9, 0x2d, 0xfb, 0x5a, 0x3f, 0xfb,
+0xb5, 0xbc, 0xea, 0x8a, 0x2a, 0xfa, 0xe9, 0xef, 0x77, 0x94, 0x81, 0xc6, 0xbb, 0x4b, 0x12, 0x78,
+0xf3, 0xfe, 0x06, 0x93, 0x37, 0xa7, 0x38, 0x52, 0xab, 0xaa, 0xa3, 0xb4, 0x11, 0xbe, 0x5e, 0x77,
+0xdd, 0xe4, 0x98, 0x4c, 0x74, 0x4e, 0x1c, 0x62, 0xa8, 0x7a, 0x65, 0x6b, 0x09, 0xd7, 0x29, 0xae,
+0xaf, 0xe9, 0x7f, 0x94, 0x07, 0x01, 0x76, 0xfb, 0x7d, 0x2c, 0xf8, 0xe5, 0xce, 0x33, 0xb2, 0x7e,
+0x4c, 0x28, 0x41, 0x2c, 0xba, 0x73, 0x83, 0x2f, 0x61, 0x5e, 0xd9, 0x5c, 0xa6, 0x44, 0x54, 0x40,
+0xae, 0x7c, 0xa8, 0x0b, 0x01, 0x0f, 0x84, 0x1f, 0xfe, 0x72, 0x06, 0x51, 0xda, 0x15, 0x88, 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x00, 0x01,
+0xb4, 0x22, 0x47, 0x4e, 0x55, 0x20, 0x47, 0x52, 0x55, 0x42, 0x20, 0x52, 0x53, 0x41, 0x20, 0x73,
+0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67,
+0x20, 0x6b, 0x65, 0x79, 0x89, 0x02, 0x38, 0x04, 0x13, 0x01, 0x02, 0x00, 0x22, 0x05, 0x02, 0x52,
+0x82, 0x2c, 0xee, 0x02, 0x1b, 0x03, 0x06, 0x0b, 0x09, 0x08, 0x07, 0x03, 0x02, 0x06, 0x15, 0x08,
+0x02, 0x09, 0x0a, 0x0b, 0x04, 0x16, 0x02, 0x03, 0x01, 0x02, 0x1e, 0x01, 0x02, 0x17, 0x80, 0x00,
+0x0a, 0x09, 0x10, 0x0f, 0xcc, 0xf3, 0x21, 0x77, 0x83, 0x6a, 0x0d, 0x14, 0x0a, 0x0f, 0xff, 0x45,
+0x11, 0xf5, 0x1a, 0x37, 0x13, 0xe8, 0x9a, 0x51, 0x1d, 0x77, 0x67, 0xa4, 0x71, 0xf1, 0x74, 0xaa,
+0xcf, 0xc7, 0xab, 0x34, 0x11, 0x01, 0x9b, 0xab, 0x45, 0x6d, 0xf6, 0x5e, 0xd4, 0x74, 0x42, 0x37,
+0x22, 0x8b, 0x8b, 0xb3, 0xf1, 0x36, 0x33, 0x25, 0xf0, 0x7d, 0x9b, 0xa7, 0xb6, 0x9b, 0x4e, 0xc2,
+0x22, 0xab, 0x02, 0x66, 0x60, 0x4a, 0xd3, 0xe9, 0xcb, 0xe6, 0xde, 0x72, 0x7a, 0x33, 0x62, 0x84,
+0x5e, 0x7b, 0xd8, 0x1f, 0xce, 0x7d, 0x37, 0x17, 0xee, 0xbe, 0x4b, 0x31, 0xe2, 0x1a, 0xf9, 0x8e,
+0x9b, 0xec, 0xc2, 0x9f, 0x35, 0xa6, 0x28, 0xc1, 0x81, 0x76, 0xdd,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12, 0x0c, 0x1d, 0x23, 0x51, 0x47, 0x53, 0x0b, 0x72,
+0xc2, 0xd3, 0x39, 0xbb, 0xa9, 0xea, 0x8c, 0x16, 0x93, 0x67, 0xb1, 0xcf, 0x8a, 0x96, 0xba, 0x1e,
+0xef, 0x20, 0x3f, 0xee, 0xda, 0x69, 0xd1, 0x4d, 0xf4, 0x9c, 0x41, 0x73, 0xcb, 0xaf, 0x1b, 0x29,
+0x22, 0x1f, 0x94, 0xa4, 0x67, 0xd7, 0x53, 0xb1, 0x65, 0x23, 0x69, 0x05, 0x31, 0x2e, 0xd4
+};
+
+static unsigned char hi_dsa_sig[] =
+{
+0x88, 0x5e, 0x04, 0x00, 0x11, 0x08, 0x00, 0x06, 0x05, 0x02, 0x52, 0x82, 0x2c, 0x7f, 0x00, 0x0a,
+0x09, 0x10, 0xef, 0xe0, 0xfc, 0x1f, 0xf6, 0xe7, 0xf5, 0xad, 0xb0, 0x47, 0x01, 0x00, 0xcd, 0xfd,
+0x1f, 0x8b, 0x16, 0x7f, 0x31, 0x7f, 0xc3, 0xe1, 0x6d, 0xcd, 0xc5, 0x4f, 0xf4, 0x1b, 0xf5, 0x4e,
+0x61, 0x79, 0xb5, 0x14, 0xdd, 0xf5, 0xe5, 0x27, 0x21, 0xf6, 0xc7, 0x95, 0xc6, 0x9b, 0x00, 0xff,
+0x61, 0x4d, 0x01, 0x6f, 0xbb, 0x88, 0xf9, 0x38, 0x84, 0x00, 0xab, 0xab, 0x2f, 0x16, 0x53, 0x5c,
+0xe9, 0x3d, 0x85, 0x34, 0x0d, 0x36, 0x80, 0x77, 0x62, 0x4e, 0x4f, 0xdb, 0x48, 0x64, 0x58, 0x82
+};
+
+static unsigned char hi_dsa_pub[] =
+{
+0x99, 0x04, 0xae, 0x04, 0x52, 0x82, 0x2b, 0xe6, 0x11, 0x0c, 0x00, 0xcc, 0x6b, 0xfe, 0xc3, 0xed,
+0x23, 0xb8, 0x09, 0xa8, 0xcd, 0x00, 0x8a, 0x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, 0x7a, 0xf2, 0x48, 0x31, 0x04, 0x40, 0x09,
+0x02, 0x0b, 0xe3, 0x3c, 0x65, 0xf5, 0x39, 0xae, 0x25, 0x2e, 0x42, 0xa3, 0x43, 0x50, 0x80, 0xbb,
+0x36, 0x4c, 0xf9, 0x04, 0xec, 0x52, 0x37, 0xc1, 0x00, 0x92, 0x4a, 0x5a, 0x56, 0xfb, 0x50, 0x54,
+0x26, 0x3c, 0xa5, 0x3a, 0x22, 0x4f, 0x6b, 0x17, 0x5b, 0x64, 0xd5, 0xfd, 0xa4, 0x1b, 0x32, 0x22,
+0x16, 0x97, 0x0e, 0xfd, 0x92, 0xae, 0x5e, 0xd0, 0x5b, 0x4b, 0xf9, 0x26, 0x2e, 0x46, 0x12, 0x8d,
+0x91, 0x80, 0xe8, 0x71, 0xbf, 0xf7, 0xc2, 0x8e, 0xed, 0x60, 0xd2, 0x17, 0x53, 0xd1, 0x8b, 0xc9,
+0x08, 0xb4, 0x1d, 0x47, 0x4e, 0x55, 0x20, 0x47, 0x52, 0x55, 0x42, 0x20, 0x44, 0x53, 0x41, 0x20,
+0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x6b, 0x65, 0x79,
+0x88, 0x7a, 0x04, 0x13, 0x11, 0x08, 0x00, 0x22, 0x05, 0x02, 0x52, 0x82, 0x2b, 0xe6, 0x02, 0x1b,
+0x03, 0x06, 0x0b, 0x09, 0x08, 0x07, 0x03, 0x02, 0x06, 0x15, 0x08, 0x02, 0x09, 0x0a, 0x0b, 0x04,
+0x16, 0x02, 0x03, 0x01, 0x02, 0x1e, 0x01, 0x02, 0x17, 0x80, 0x00, 0x0a, 0x09, 0x10, 0xef, 0xe0,
+0xfc, 0x1f, 0xf6, 0xe7, 0xf5, 0xad, 0xd6, 0x91, 0x01, 0x00, 0x94, 0x10, 0x43, 0xf9, 0xc9, 0x37,
+0x40, 0x47, 0xe1, 0xba, 0xf7, 0x92, 0x4b, 0xe1, 0xea, 0x94, 0xee, 0x81, 0x90, 0x8f, 0xe7, 0x76,
+0xc8, 0x30, 0x3d, 0x7e, 0xa0, 0xf5, 0xad, 0x2a, 0x52, 0x60, 0x00, 0xff, 0x75, 0x6c, 0x2d, 0xf5,
+0xab, 0x41, 0x83, 0x29, 0x4f, 0x37, 0x16, 0x1b, 0x26, 0x28, 0x55, 0x03, 0xfe, 0x30, 0x89, 0xce,
+0x70, 0x6e, 0x1a, 0x11, 0x4a, 0xb6, 0xa5, 0x17, 0x9f, 0xbe, 0x3d, 0x1d
+};
diff --git a/grub-core/tests/sleep_test.c b/grub-core/tests/sleep_test.c
new file mode 100644
index 0000000..ffb2681
--- /dev/null
+++ b/grub-core/tests/sleep_test.c
@@ -0,0 +1,51 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/time.h>
+#include <grub/misc.h>
+#include <grub/dl.h>
+#include <grub/command.h>
+#include <grub/env.h>
+#include <grub/test.h>
+#include <grub/mm.h>
+#include <grub/datetime.h>
+#include <grub/time.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static void
+sleep_test (void)
+{
+ struct grub_datetime st, en;
+ grub_int64_t stu = 0, enu = 0;
+ int is_delayok;
+ grub_test_assert (!grub_get_datetime (&st), "Couldn't retrieve start time");
+ grub_millisleep (10000);
+ grub_test_assert (!grub_get_datetime (&en), "Couldn't retrieve end time");
+ grub_test_assert (grub_datetime2unixtime (&st, &stu), "Invalid date");
+ grub_test_assert (grub_datetime2unixtime (&en, &enu), "Invalid date");
+ is_delayok = (enu - stu >= 9 && enu - stu <= 11);
+#ifdef __arm__
+ /* Ignore QEMU bug */
+ if (enu - stu >= 15 && enu - stu <= 17)
+ is_delayok = 1;
+#endif
+ grub_test_assert (is_delayok, "Interval out of range: %" PRIdGRUB_INT64_T, enu - stu);
+}
+
+GRUB_FUNCTIONAL_TEST (sleep_test, sleep_test);
diff --git a/grub-core/tests/strtoull_test.c b/grub-core/tests/strtoull_test.c
new file mode 100644
index 0000000..5488ab2
--- /dev/null
+++ b/grub-core/tests/strtoull_test.c
@@ -0,0 +1,63 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2016 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/test.h>
+#include <grub/dl.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static void
+strtoull_testcase (const char *input, int base, unsigned long long expected,
+ int num_digits, grub_err_t error)
+{
+ const char *output;
+ unsigned long long value;
+ grub_errno = 0;
+ value = grub_strtoull(input, &output, base);
+ grub_test_assert (grub_errno == error,
+ "unexpected error. Expected %d, got %d. Input \"%s\"",
+ error, grub_errno, input);
+ if (grub_errno)
+ {
+ grub_errno = 0;
+ return;
+ }
+ grub_test_assert (input + num_digits == output,
+ "unexpected number of digits. Expected %d, got %d, input \"%s\"",
+ num_digits, (int) (output - input), input);
+ grub_test_assert (value == expected,
+ "unexpected return value. Expected %llu, got %llu, input \"\%s\"",
+ expected, value, input);
+}
+
+static void
+strtoull_test (void)
+{
+ strtoull_testcase ("9", 0, 9, 1, GRUB_ERR_NONE);
+ strtoull_testcase ("0xaa", 0, 0xaa, 4, GRUB_ERR_NONE);
+ strtoull_testcase ("0xff", 0, 0xff, 4, GRUB_ERR_NONE);
+ strtoull_testcase ("0", 10, 0, 1, GRUB_ERR_NONE);
+ strtoull_testcase ("8", 8, 0, 0, GRUB_ERR_BAD_NUMBER);
+ strtoull_testcase ("38", 8, 3, 1, GRUB_ERR_NONE);
+ strtoull_testcase ("7", 8, 7, 1, GRUB_ERR_NONE);
+ strtoull_testcase ("1]", 16, 1, 1, GRUB_ERR_NONE);
+ strtoull_testcase ("18446744073709551616", 10, 0, 0, GRUB_ERR_OUT_OF_RANGE);
+}
+
+
+GRUB_FUNCTIONAL_TEST (strtoull_test, strtoull_test);
diff --git a/grub-core/tests/test_blockarg.c b/grub-core/tests/test_blockarg.c
new file mode 100644
index 0000000..88bd968
--- /dev/null
+++ b/grub-core/tests/test_blockarg.c
@@ -0,0 +1,55 @@
+/* test_blockarg.c - print and execute block argument */
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/dl.h>
+#include <grub/err.h>
+#include <grub/misc.h>
+#include <grub/i18n.h>
+#include <grub/extcmd.h>
+#include <grub/script_sh.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static grub_err_t
+test_blockarg (grub_extcmd_context_t ctxt, int argc, char **args)
+{
+ if (! ctxt->script)
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "no block parameter");
+
+ grub_printf ("%s\n", args[argc - 1]);
+ grub_script_execute (ctxt->script);
+ return GRUB_ERR_NONE;
+}
+
+static grub_extcmd_t cmd;
+
+GRUB_MOD_INIT(test_blockarg)
+{
+ cmd = grub_register_extcmd ("test_blockarg", test_blockarg,
+ GRUB_COMMAND_FLAG_BLOCKS,
+ N_("BLOCK"),
+ /* TRANSLATORS: this is the BLOCK-argument, not
+ environment block. */
+ N_("Print and execute block argument."), 0);
+}
+
+GRUB_MOD_FINI(test_blockarg)
+{
+ grub_unregister_extcmd (cmd);
+}
diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c
new file mode 100644
index 0000000..44d0810
--- /dev/null
+++ b/grub-core/tests/video_checksum.c
@@ -0,0 +1,813 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* All tests need to include test.h for GRUB testing framework. */
+
+#include <config.h>
+
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/video.h>
+#include <grub/lib/crc.h>
+#include <grub/mm.h>
+#include <grub/term.h>
+#ifdef GRUB_MACHINE_EMU
+#include <grub/emu/hostdisk.h>
+#include <grub/emu/misc.h>
+#endif
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static int ctr;
+static int nchk;
+static char *basename;
+static const grub_uint32_t *checksums;
+static struct grub_video_mode_info capt_mode_info;
+
+struct grub_video_mode_info grub_test_video_modes[GRUB_TEST_VIDEO_ALL_N_MODES] = {
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640 * 4,
+ GRUB_VIDEO_MI_RGBA8888()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800 * 4,
+ GRUB_VIDEO_MI_RGBA8888()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024 * 4,
+ GRUB_VIDEO_MI_RGBA8888()
+ },
+ {
+ .width = 2560,
+ .height = 1440,
+ .pitch = 2560 * 4,
+ GRUB_VIDEO_MI_RGBA8888()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS
+ },
+
+
+
+
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 1280,
+ GRUB_VIDEO_MI_RGB555 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 1600,
+ GRUB_VIDEO_MI_RGB555 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 2048,
+ GRUB_VIDEO_MI_RGB555 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 1280,
+ GRUB_VIDEO_MI_RGB565 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 1600,
+ GRUB_VIDEO_MI_RGB565 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 2048,
+ GRUB_VIDEO_MI_RGB565 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640 * 3,
+ GRUB_VIDEO_MI_RGB888 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800 * 3,
+ GRUB_VIDEO_MI_RGB888 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024 * 3,
+ GRUB_VIDEO_MI_RGB888 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 1280,
+ GRUB_VIDEO_MI_BGR555 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 1600,
+ GRUB_VIDEO_MI_BGR555 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 2048,
+ GRUB_VIDEO_MI_BGR555 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 1280,
+ GRUB_VIDEO_MI_BGR565 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 1600,
+ GRUB_VIDEO_MI_BGR565 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 2048,
+ GRUB_VIDEO_MI_BGR565 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640 * 3,
+ GRUB_VIDEO_MI_BGR888 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800 * 3,
+ GRUB_VIDEO_MI_BGR888 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024 * 3,
+ GRUB_VIDEO_MI_BGR888 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640 * 4,
+ GRUB_VIDEO_MI_BGRA8888()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800 * 4,
+ GRUB_VIDEO_MI_BGRA8888()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024 * 4,
+ GRUB_VIDEO_MI_BGRA8888()
+ },
+};
+
+#ifdef GRUB_MACHINE_EMU
+#include <grub/emu/hostfile.h>
+
+struct bmp_header
+{
+ grub_uint8_t magic[2];
+ grub_uint32_t filesize;
+ grub_uint32_t reserved;
+ grub_uint32_t bmp_off;
+ grub_uint32_t head_size;
+ grub_uint16_t width;
+ grub_uint16_t height;
+ grub_uint16_t planes;
+ grub_uint16_t bpp;
+} GRUB_PACKED;
+
+static void
+grub_video_capture_write_bmp (const char *fname,
+ void *ptr,
+ const struct grub_video_mode_info *mode_info)
+{
+ grub_util_fd_t fd = grub_util_fd_open (fname, GRUB_UTIL_FD_O_WRONLY | GRUB_UTIL_FD_O_CREATTRUNC);
+ struct bmp_header head;
+
+ if (!GRUB_UTIL_FD_IS_VALID (fd))
+ {
+ grub_printf (_("cannot open `%s': %s"),
+ fname, grub_util_fd_strerror ());
+ }
+
+ grub_memset (&head, 0, sizeof (head));
+
+ head.magic[0] = 'B';
+ head.magic[1] = 'M';
+
+ if (mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB)
+ {
+ head.filesize = grub_cpu_to_le32 (sizeof (head) + mode_info->width * mode_info->height * 3);
+ head.bmp_off = grub_cpu_to_le32_compile_time (sizeof (head));
+ head.bpp = grub_cpu_to_le16_compile_time (24);
+ }
+ else
+ {
+ head.filesize = grub_cpu_to_le32 (sizeof (head) + 3 * 256 + mode_info->width * mode_info->height);
+ head.bmp_off = grub_cpu_to_le32_compile_time (sizeof (head) + 3 * 256);
+ head.bpp = grub_cpu_to_le16_compile_time (8);
+ }
+ head.head_size = grub_cpu_to_le32_compile_time (sizeof (head) - 14);
+ head.width = grub_cpu_to_le16 (mode_info->width);
+ head.height = grub_cpu_to_le16 (mode_info->height);
+ head.planes = grub_cpu_to_le16_compile_time (1);
+
+ head.width = grub_cpu_to_le16 (mode_info->width);
+ head.height = grub_cpu_to_le16 (mode_info->height);
+
+ grub_util_fd_write (fd, (char *) &head, sizeof (head));
+
+ if (!(mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB))
+ {
+ struct grub_video_palette_data palette_data[256];
+ int i;
+ int palette_len = mode_info->number_of_colors;
+ grub_memset (palette_data, 0, sizeof (palette_data));
+ if (palette_len > 256)
+ palette_len = 256;
+ grub_video_get_palette (0, palette_len, palette_data);
+ for (i = 0; i < 256; i++)
+ {
+ grub_uint8_t r, g, b;
+ r = palette_data[i].r;
+ g = palette_data[i].g;
+ b = palette_data[i].b;
+
+ grub_util_fd_write (fd, (char *) &b, 1);
+ grub_util_fd_write (fd, (char *) &g, 1);
+ grub_util_fd_write (fd, (char *) &r, 1);
+ }
+ }
+
+ /* This does essentialy the same as some fbblit functions yet using
+ them would mean testing them against themselves so keep this
+ implemetation separate. */
+ switch (mode_info->bytes_per_pixel)
+ {
+ case 4:
+ {
+ grub_uint8_t *buffer = xcalloc (3, mode_info->width);
+ grub_uint32_t rmask = ((1 << mode_info->red_mask_size) - 1);
+ grub_uint32_t gmask = ((1 << mode_info->green_mask_size) - 1);
+ grub_uint32_t bmask = ((1 << mode_info->blue_mask_size) - 1);
+ int rshift = mode_info->red_field_pos;
+ int gshift = mode_info->green_field_pos;
+ int bshift = mode_info->blue_field_pos;
+ int mulrshift = (8 - mode_info->red_mask_size);
+ int mulgshift = (8 - mode_info->green_mask_size);
+ int mulbshift = (8 - mode_info->blue_mask_size);
+ int y;
+
+ for (y = mode_info->height - 1; y >= 0; y--)
+ {
+ grub_uint32_t *iptr = (grub_uint32_t *) ptr + (mode_info->pitch / 4) * y;
+ int x;
+ grub_uint8_t *optr = buffer;
+ for (x = 0; x < (int) mode_info->width; x++)
+ {
+ grub_uint32_t val = *iptr++;
+ *optr++ = ((val >> bshift) & bmask) << mulbshift;
+ *optr++ = ((val >> gshift) & gmask) << mulgshift;
+ *optr++ = ((val >> rshift) & rmask) << mulrshift;
+ }
+ grub_util_fd_write (fd, (char *) buffer, mode_info->width * 3);
+ }
+ grub_free (buffer);
+ break;
+ }
+ case 3:
+ {
+ grub_uint8_t *buffer = xcalloc (3, mode_info->width);
+ grub_uint32_t rmask = ((1 << mode_info->red_mask_size) - 1);
+ grub_uint32_t gmask = ((1 << mode_info->green_mask_size) - 1);
+ grub_uint32_t bmask = ((1 << mode_info->blue_mask_size) - 1);
+ int rshift = mode_info->red_field_pos;
+ int gshift = mode_info->green_field_pos;
+ int bshift = mode_info->blue_field_pos;
+ int mulrshift = (8 - mode_info->red_mask_size);
+ int mulgshift = (8 - mode_info->green_mask_size);
+ int mulbshift = (8 - mode_info->blue_mask_size);
+ int y;
+
+ for (y = mode_info->height - 1; y >= 0; y--)
+ {
+ grub_uint8_t *iptr = ((grub_uint8_t *) ptr + mode_info->pitch * y);
+ int x;
+ grub_uint8_t *optr = buffer;
+ for (x = 0; x < (int) mode_info->width; x++)
+ {
+ grub_uint32_t val = 0;
+#ifdef GRUB_CPU_WORDS_BIGENDIAN
+ val |= *iptr++ << 16;
+ val |= *iptr++ << 8;
+ val |= *iptr++;
+#else
+ val |= *iptr++;
+ val |= *iptr++ << 8;
+ val |= *iptr++ << 16;
+#endif
+ *optr++ = ((val >> bshift) & bmask) << mulbshift;
+ *optr++ = ((val >> gshift) & gmask) << mulgshift;
+ *optr++ = ((val >> rshift) & rmask) << mulrshift;
+ }
+ grub_util_fd_write (fd, (char *) buffer, mode_info->width * 3);
+ }
+ grub_free (buffer);
+ break;
+ }
+ case 2:
+ {
+ grub_uint8_t *buffer = xcalloc (3, mode_info->width);
+ grub_uint16_t rmask = ((1 << mode_info->red_mask_size) - 1);
+ grub_uint16_t gmask = ((1 << mode_info->green_mask_size) - 1);
+ grub_uint16_t bmask = ((1 << mode_info->blue_mask_size) - 1);
+ int rshift = mode_info->red_field_pos;
+ int gshift = mode_info->green_field_pos;
+ int bshift = mode_info->blue_field_pos;
+ int mulrshift = (8 - mode_info->red_mask_size);
+ int mulgshift = (8 - mode_info->green_mask_size);
+ int mulbshift = (8 - mode_info->blue_mask_size);
+ int y;
+
+ for (y = mode_info->height - 1; y >= 0; y--)
+ {
+ grub_uint16_t *iptr = (grub_uint16_t *) ptr + (mode_info->pitch / 2) * y;
+ int x;
+ grub_uint8_t *optr = buffer;
+ for (x = 0; x < (int) mode_info->width; x++)
+ {
+ grub_uint16_t val = *iptr++;
+ *optr++ = ((val >> bshift) & bmask) << mulbshift;
+ *optr++ = ((val >> gshift) & gmask) << mulgshift;
+ *optr++ = ((val >> rshift) & rmask) << mulrshift;
+ }
+ grub_util_fd_write (fd, (char *) buffer, mode_info->width * 3);
+ }
+ grub_free (buffer);
+ break;
+ }
+ case 1:
+ {
+ int y;
+
+ for (y = mode_info->height - 1; y >= 0; y--)
+ grub_util_fd_write (fd, ((char *) ptr + mode_info->pitch * y),
+ mode_info->width);
+ break;
+ }
+ }
+ grub_util_fd_close (fd);
+}
+
+#endif
+
+const char *
+grub_video_checksum_get_modename (void)
+{
+ static char buf[40];
+ if (capt_mode_info.mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR)
+ {
+ grub_snprintf (buf, sizeof (buf), "i%d", capt_mode_info.number_of_colors);
+ return buf;
+ }
+ if (capt_mode_info.red_field_pos == 0)
+ {
+ grub_snprintf (buf, sizeof (buf), "bgra%d%d%d%d", capt_mode_info.blue_mask_size,
+ capt_mode_info.green_mask_size,
+ capt_mode_info.red_mask_size,
+ capt_mode_info.reserved_mask_size);
+ return buf;
+ }
+ grub_snprintf (buf, sizeof (buf), "rgba%d%d%d%d", capt_mode_info.red_mask_size,
+ capt_mode_info.green_mask_size,
+ capt_mode_info.blue_mask_size,
+ capt_mode_info.reserved_mask_size);
+ return buf;
+}
+
+#define GENERATE_MODE 1
+//#define SAVE_ALL_IMAGES
+//#define COLLECT_TIME_STATISTICS 1
+
+#if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU)
+grub_util_fd_t genfd = GRUB_UTIL_FD_INVALID;
+#endif
+
+#include <grub/time.h>
+
+static void
+write_time (void)
+{
+#if defined (GRUB_MACHINE_EMU) && defined (COLLECT_TIME_STATISTICS)
+ char buf[60];
+ static grub_uint64_t prev;
+ grub_uint64_t cur;
+ static grub_util_fd_t tmrfd = GRUB_UTIL_FD_INVALID;
+ if (!GRUB_UTIL_FD_IS_VALID (tmrfd))
+ tmrfd = grub_util_fd_open ("time.txt", GRUB_UTIL_FD_O_WRONLY
+ | GRUB_UTIL_FD_O_CREATTRUNC);
+
+ cur = grub_util_get_cpu_time_ms ();
+ grub_snprintf (buf, sizeof (buf), "%s_%dx%dx%s:%d: %" PRIuGRUB_UINT64_T " ms\n",
+ basename,
+ capt_mode_info.width,
+ capt_mode_info.height,
+ grub_video_checksum_get_modename (), ctr,
+ cur - prev);
+ prev = cur;
+ if (GRUB_UTIL_FD_IS_VALID (tmrfd))
+ grub_util_fd_write (tmrfd, buf, grub_strlen (buf));
+#endif
+}
+
+
+static void
+checksum (void)
+{
+ void *ptr;
+ grub_uint32_t crc = 0;
+
+ ptr = grub_video_capture_get_framebuffer ();
+
+ write_time ();
+
+#ifdef GRUB_CPU_WORDS_BIGENDIAN
+ switch (capt_mode_info.bytes_per_pixel)
+ {
+ case 1:
+ crc = grub_getcrc32c (0, ptr, capt_mode_info.pitch
+ * capt_mode_info.height);
+ break;
+ case 2:
+ {
+ unsigned x, y, rowskip;
+ grub_uint8_t *iptr = ptr;
+ crc = 0;
+ rowskip = capt_mode_info.pitch - capt_mode_info.width * 2;
+ for (y = 0; y < capt_mode_info.height; y++)
+ {
+ for (x = 0; x < capt_mode_info.width; x++)
+ {
+ crc = grub_getcrc32c (crc, iptr + 1, 1);
+ crc = grub_getcrc32c (crc, iptr, 1);
+ iptr += 2;
+ }
+ crc = grub_getcrc32c (crc, iptr, rowskip);
+ iptr += rowskip;
+ }
+ break;
+ }
+ case 3:
+ {
+ unsigned x, y, rowskip;
+ grub_uint8_t *iptr = ptr;
+ crc = 0;
+ rowskip = capt_mode_info.pitch - capt_mode_info.width * 3;
+ for (y = 0; y < capt_mode_info.height; y++)
+ {
+ for (x = 0; x < capt_mode_info.width; x++)
+ {
+ crc = grub_getcrc32c (crc, iptr + 2, 1);
+ crc = grub_getcrc32c (crc, iptr + 1, 1);
+ crc = grub_getcrc32c (crc, iptr, 1);
+ iptr += 3;
+ }
+ crc = grub_getcrc32c (crc, iptr, rowskip);
+ iptr += rowskip;
+ }
+ break;
+ }
+ case 4:
+ {
+ unsigned x, y, rowskip;
+ grub_uint8_t *iptr = ptr;
+ crc = 0;
+ rowskip = capt_mode_info.pitch - capt_mode_info.width * 4;
+ for (y = 0; y < capt_mode_info.height; y++)
+ {
+ for (x = 0; x < capt_mode_info.width; x++)
+ {
+ crc = grub_getcrc32c (crc, iptr + 3, 1);
+ crc = grub_getcrc32c (crc, iptr + 2, 1);
+ crc = grub_getcrc32c (crc, iptr + 1, 1);
+ crc = grub_getcrc32c (crc, iptr, 1);
+ iptr += 4;
+ }
+ crc = grub_getcrc32c (crc, iptr, rowskip);
+ iptr += rowskip;
+ }
+ break;
+ }
+ }
+#else
+ crc = grub_getcrc32c (0, ptr, capt_mode_info.pitch * capt_mode_info.height);
+#endif
+
+#if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU)
+ if (GRUB_UTIL_FD_IS_VALID (genfd))
+ {
+ char buf[20];
+ grub_snprintf (buf, sizeof (buf), "0x%x, ", crc);
+ grub_util_fd_write (genfd, buf, grub_strlen (buf));
+ }
+#endif
+
+ if (!checksums || ctr >= nchk)
+ {
+ grub_test_assert (0, "Unexpected checksum %s_%dx%dx%s:%d: 0x%x",
+ basename,
+ capt_mode_info.width,
+ capt_mode_info.height,
+ grub_video_checksum_get_modename (), ctr, crc);
+ }
+ else if (crc != checksums[ctr])
+ {
+ grub_test_assert (0, "Checksum %s_%dx%dx%s:%d failed: 0x%x vs 0x%x",
+ basename,
+ capt_mode_info.width,
+ capt_mode_info.height,
+ grub_video_checksum_get_modename (),
+ ctr, crc, checksums[ctr]);
+ }
+#if !(defined (SAVE_ALL_IMAGES) && defined (GRUB_MACHINE_EMU))
+ else
+ {
+ write_time ();
+ ctr++;
+ return;
+ }
+#endif
+#ifdef GRUB_MACHINE_EMU
+ char *name = grub_xasprintf ("%s_%dx%dx%s_%d.bmp", basename,
+ capt_mode_info.width,
+ capt_mode_info.height,
+ grub_video_checksum_get_modename (),
+ ctr);
+ grub_video_capture_write_bmp (name, ptr, &capt_mode_info);
+ grub_free (name);
+#endif
+
+ write_time ();
+
+ ctr++;
+}
+
+struct checksum_desc
+{
+ const char *name;
+ unsigned width;
+ unsigned height;
+ unsigned mode_type;
+ unsigned number_of_colors;
+ unsigned bpp;
+ unsigned bytes_per_pixel;
+ unsigned red_field_pos;
+ unsigned red_mask_size;
+ unsigned green_field_pos;
+ unsigned green_mask_size;
+ unsigned blue_field_pos;
+ unsigned blue_mask_size;
+ unsigned reserved_field_pos;
+ unsigned reserved_mask_size;
+ const grub_uint32_t *checksums;
+ int nchk;
+};
+
+const struct checksum_desc checksum_table[] = {
+#include "checksums.h"
+};
+
+void
+grub_video_checksum (const char *basename_in)
+{
+ unsigned i;
+
+ grub_video_get_info (&capt_mode_info);
+
+#if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU)
+ if (!GRUB_UTIL_FD_IS_VALID (genfd))
+ genfd = grub_util_fd_open ("checksums.h", GRUB_UTIL_FD_O_WRONLY
+ | GRUB_UTIL_FD_O_CREATTRUNC);
+ if (GRUB_UTIL_FD_IS_VALID (genfd))
+ {
+ char buf[400];
+
+ grub_snprintf (buf, sizeof (buf), "\", %d, %d, 0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d /* %dx%dx%s */, (grub_uint32_t []) { ",
+ capt_mode_info.width,
+ capt_mode_info.height,
+ capt_mode_info.mode_type,
+ capt_mode_info.number_of_colors,
+ capt_mode_info.bpp,
+ capt_mode_info.bytes_per_pixel,
+ capt_mode_info.red_field_pos,
+ capt_mode_info.red_mask_size,
+ capt_mode_info.green_field_pos,
+ capt_mode_info.green_mask_size,
+ capt_mode_info.blue_field_pos,
+ capt_mode_info.blue_mask_size,
+ capt_mode_info.reserved_field_pos,
+ capt_mode_info.reserved_mask_size,
+ capt_mode_info.width,
+ capt_mode_info.height,
+ grub_video_checksum_get_modename ());
+
+ grub_util_fd_write (genfd, " { \"", 5);
+ grub_util_fd_write (genfd, basename_in, grub_strlen (basename_in));
+ grub_util_fd_write (genfd, buf, grub_strlen (buf));
+ }
+#endif
+
+ basename = grub_strdup (basename_in);
+ nchk = 0;
+ checksums = 0;
+ /* FIXME: optimize this. */
+ for (i = 0; i < ARRAY_SIZE (checksum_table); i++)
+ if (grub_strcmp (checksum_table[i].name, basename_in) == 0
+ && capt_mode_info.width == checksum_table[i].width
+ && capt_mode_info.height == checksum_table[i].height
+ && capt_mode_info.mode_type == checksum_table[i].mode_type
+ && capt_mode_info.number_of_colors == checksum_table[i].number_of_colors
+ && capt_mode_info.bpp == checksum_table[i].bpp
+ && capt_mode_info.bytes_per_pixel == checksum_table[i].bytes_per_pixel
+ && capt_mode_info.red_field_pos == checksum_table[i].red_field_pos
+ && capt_mode_info.red_mask_size == checksum_table[i].red_mask_size
+ && capt_mode_info.green_field_pos == checksum_table[i].green_field_pos
+ && capt_mode_info.green_mask_size == checksum_table[i].green_mask_size
+ && capt_mode_info.blue_field_pos == checksum_table[i].blue_field_pos
+ && capt_mode_info.blue_mask_size == checksum_table[i].blue_mask_size
+ && capt_mode_info.reserved_field_pos == checksum_table[i].reserved_field_pos
+ && capt_mode_info.reserved_mask_size == checksum_table[i].reserved_mask_size)
+ {
+ nchk = checksum_table[i].nchk;
+ checksums = checksum_table[i].checksums;
+ break;
+ }
+
+ ctr = 0;
+ grub_video_capture_refresh_cb = checksum;
+}
+
+void
+grub_video_checksum_end (void)
+{
+#if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU)
+ if (GRUB_UTIL_FD_IS_VALID (genfd))
+ {
+ char buf[40];
+ grub_snprintf (buf, sizeof (buf), "}, %d },\n", ctr);
+ grub_util_fd_write (genfd, buf, grub_strlen (buf));
+ }
+#endif
+ grub_test_assert (ctr == nchk, "Not enough checksums %s_%dx%dx%s: %d vs %d",
+ basename,
+ capt_mode_info.width,
+ capt_mode_info.height,
+ grub_video_checksum_get_modename (),
+ ctr, nchk);
+ grub_free (basename);
+ basename = 0;
+ nchk = 0;
+ checksums = 0;
+ ctr = 0;
+ grub_video_capture_refresh_cb = 0;
+}
+
+static struct grub_term_output *saved_outputs;
+static struct grub_term_output *saved_gfxnext;
+static struct grub_term_output *gfxterm;
+static int use_gfxterm = 0;
+
+int
+grub_test_use_gfxterm (void)
+{
+ FOR_ACTIVE_TERM_OUTPUTS (gfxterm)
+ if (grub_strcmp (gfxterm->name, "gfxterm") == 0)
+ break;
+ if (!gfxterm)
+ FOR_DISABLED_TERM_OUTPUTS (gfxterm)
+ if (grub_strcmp (gfxterm->name, "gfxterm") == 0)
+ break;
+
+ if (!gfxterm)
+ {
+ grub_test_assert (0, "terminal `%s' isn't found", "gfxterm");
+ return 1;
+ }
+
+ if (gfxterm->init (gfxterm))
+ {
+ grub_test_assert (0, "terminal `%s' failed: %s", "gfxterm", grub_errmsg);
+ return 1;
+ }
+
+ saved_outputs = grub_term_outputs;
+ saved_gfxnext = gfxterm->next;
+ grub_term_outputs = gfxterm;
+ gfxterm->next = 0;
+ use_gfxterm = 1;
+
+ return 0;
+}
+
+void
+grub_test_use_gfxterm_end (void)
+{
+ if (!use_gfxterm)
+ return;
+ use_gfxterm = 0;
+ gfxterm->fini (gfxterm);
+ gfxterm->next = saved_gfxnext;
+ grub_term_outputs = saved_outputs;
+ saved_outputs = 0;
+ saved_gfxnext = 0;
+}
diff --git a/grub-core/tests/videotest_checksum.c b/grub-core/tests/videotest_checksum.c
new file mode 100644
index 0000000..a4bff5e
--- /dev/null
+++ b/grub-core/tests/videotest_checksum.c
@@ -0,0 +1,80 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* All tests need to include test.h for GRUB testing framework. */
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/video.h>
+#include <grub/video_fb.h>
+#include <grub/command.h>
+#include <grub/font.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+#define FONT_NAME "Unknown Regular 16"
+
+/* Functional test main method. */
+static void
+videotest_checksum (void)
+{
+ unsigned i;
+ grub_font_t font;
+
+ font = grub_font_get (FONT_NAME);
+ if (font && grub_strcmp (font->name, FONT_NAME) != 0)
+ font = 0;
+ if (!font)
+ font = grub_font_load ("unicode");
+
+ if (!font)
+ {
+ grub_test_assert (0, "unicode font not found: %s", grub_errmsg);
+ return;
+ }
+
+ for (i = 0; i < ARRAY_SIZE (grub_test_video_modes); i++)
+ {
+ grub_err_t err;
+#if defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_IEEE1275)
+ if (grub_test_video_modes[i].width > 1024)
+ continue;
+#endif
+ err = grub_video_capture_start (&grub_test_video_modes[i],
+ grub_video_fbstd_colors,
+ grub_test_video_modes[i].number_of_colors);
+ if (err)
+ {
+ grub_test_assert (0, "can't start capture: %s", grub_errmsg);
+ grub_print_error ();
+ continue;
+ }
+ grub_terminal_input_fake_sequence ((int []) { '\n' }, 1);
+
+ grub_video_checksum ("videotest");
+
+ char *args[] = { 0 };
+ grub_command_execute ("videotest", 0, args);
+
+ grub_terminal_input_fake_sequence_end ();
+ grub_video_checksum_end ();
+ grub_video_capture_end ();
+ }
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (videotest_checksum, videotest_checksum);
diff --git a/grub-core/tests/xnu_uuid_test.c b/grub-core/tests/xnu_uuid_test.c
new file mode 100644
index 0000000..d500145
--- /dev/null
+++ b/grub-core/tests/xnu_uuid_test.c
@@ -0,0 +1,58 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/time.h>
+#include <grub/misc.h>
+#include <grub/dl.h>
+#include <grub/command.h>
+#include <grub/env.h>
+#include <grub/test.h>
+#include <grub/mm.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static void
+xnu_uuid_test (void)
+{
+ grub_command_t cmd;
+ cmd = grub_command_find ("xnu_uuid");
+ char *args[] = { (char *) "fedcba98", (char *) "tstvar", NULL };
+ const char *val;
+
+ if (!cmd)
+ {
+ grub_test_assert (0, "can't find command `%s'", "xnu_uuid");
+ return;
+ }
+ if ((cmd->func) (cmd, 2, args))
+ {
+ grub_test_assert (0, "%d: %s", grub_errno, grub_errmsg);
+ return;
+ }
+
+ val = grub_env_get ("tstvar");
+ if (!val)
+ {
+ grub_test_assert (0, "tstvar isn't set");
+ return;
+ }
+ grub_test_assert (grub_strcmp (val, "944F9DED-DBED-391C-9402-77C8CEE04173")
+ == 0, "UUIDs don't match");
+}
+
+GRUB_FUNCTIONAL_TEST (xnu_uuid_test, xnu_uuid_test);