2010-01-17 17:29:57 +00:00
|
|
|
/*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2010-01-08 09:49:10 +00:00
|
|
|
#include <grub/mm.h>
|
|
|
|
#include <grub/misc.h>
|
|
|
|
#include <grub/extcmd.h>
|
|
|
|
#include <grub/test.h>
|
2011-04-11 21:01:51 +00:00
|
|
|
#include <grub/dl.h>
|
|
|
|
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
2010-01-08 09:49:10 +00:00
|
|
|
|
|
|
|
static grub_err_t
|
2010-06-10 06:42:03 +00:00
|
|
|
grub_functional_test (grub_extcmd_context_t ctxt __attribute__ ((unused)),
|
2010-01-08 09:49:10 +00:00
|
|
|
int argc __attribute__ ((unused)),
|
|
|
|
char **args __attribute__ ((unused)))
|
|
|
|
{
|
2010-03-26 18:23:19 +00:00
|
|
|
grub_test_t test;
|
2013-05-02 12:39:03 +00:00
|
|
|
int ok = 1;
|
2010-01-08 09:49:10 +00:00
|
|
|
|
2010-03-26 18:32:21 +00:00
|
|
|
FOR_LIST_ELEMENTS (test, grub_test_list)
|
2013-05-04 11:54:08 +00:00
|
|
|
{
|
|
|
|
grub_errno = 0;
|
|
|
|
ok = ok && !grub_test_run (test);
|
|
|
|
grub_errno = 0;
|
|
|
|
}
|
2013-05-02 12:39:03 +00:00
|
|
|
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;
|
|
|
|
|
2013-11-12 17:44:58 +00:00
|
|
|
grub_dl_load ("legacy_password_test");
|
|
|
|
grub_errno = GRUB_ERR_NONE;
|
2013-05-02 12:39:03 +00:00
|
|
|
grub_dl_load ("exfctest");
|
|
|
|
grub_dl_load ("videotest_checksum");
|
2013-05-03 12:09:55 +00:00
|
|
|
grub_dl_load ("gfxterm_menu");
|
2013-05-07 10:28:59 +00:00
|
|
|
grub_dl_load ("setjmp_test");
|
2013-05-08 09:49:25 +00:00
|
|
|
grub_dl_load ("cmdline_cat_test");
|
2013-11-08 14:01:59 +00:00
|
|
|
grub_dl_load ("div_test");
|
2013-11-12 00:18:27 +00:00
|
|
|
grub_dl_load ("xnu_uuid_test");
|
2013-11-12 00:51:36 +00:00
|
|
|
grub_dl_load ("pbkdf2_test");
|
2013-11-12 15:05:57 +00:00
|
|
|
grub_dl_load ("signature_test");
|
2013-05-02 12:39:03 +00:00
|
|
|
|
|
|
|
FOR_LIST_ELEMENTS (test, grub_test_list)
|
2013-05-03 12:09:55 +00:00
|
|
|
ok = !grub_test_run (test) && ok;
|
2013-05-02 12:39:03 +00:00
|
|
|
if (ok)
|
|
|
|
grub_printf ("ALL TESTS PASSED\n");
|
|
|
|
else
|
|
|
|
grub_printf ("TEST FAILURE\n");
|
2010-01-08 11:05:32 +00:00
|
|
|
return GRUB_ERR_NONE;
|
2010-01-08 09:49:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static grub_extcmd_t cmd;
|
|
|
|
|
|
|
|
GRUB_MOD_INIT (functional_test)
|
|
|
|
{
|
2010-09-14 21:06:01 +00:00
|
|
|
cmd = grub_register_extcmd ("functional_test", grub_functional_test, 0, 0,
|
2013-05-02 12:39:03 +00:00
|
|
|
"Run all loaded functional tests.", 0);
|
|
|
|
cmd = grub_register_extcmd ("all_functional_test", grub_functional_all_tests, 0, 0,
|
2010-01-08 09:49:10 +00:00
|
|
|
"Run all functional tests.", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
GRUB_MOD_FINI (functional_test)
|
|
|
|
{
|
|
|
|
grub_unregister_extcmd (cmd);
|
|
|
|
}
|