merge with mainline

This commit is contained in:
BVK Chaitanya 2010-06-13 09:48:47 +05:30
commit 49e38cf475
227 changed files with 8548 additions and 14999 deletions

View file

@ -0,0 +1,86 @@
#! @builddir@/grub-shell-tester
#
# 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/>.
# break without any arguments
for i in 1 2 3 4 5 6 7 8 9 10
do
echo $i
if test "$i" = 5
then
break
fi
done
# break with one
for i in 1 2 3 4 5 6 7 8 9 10
do
echo $i
if test "$i" = 5
then
break 1
fi
done
# break with loop count
for i in 1 2 3 4 5
do
for j in a b c d e f
do
echo "$i $j"
if test "$i" = 3
then
if test "$j" = d
then
break 2
fi
fi
done
done
# break into middle loop
for i in 1 2 3 4 5
do
for j in a b c d e f
do
echo "$i $j"
if test "$i" = 3
then
if test "$j" = d
then
break 1
fi
fi
done
done
# while and until loops
a=
while test "$a" != "aaaaaaa"
do
a="a$a"
for i in 1 2 3 4
do
b=
until test "$b" = "bbbbb"
do
b="b$b"
echo "$a $i $b"
if test "$i" = 3; then echo "break 2"; break 2; fi
done
done
done

View file

@ -0,0 +1,86 @@
#! @builddir@/grub-shell-tester
#
# 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/>.
# continue without any arguments
for i in 1 2 3 4 5 6 7 8 9 10
do
if test "$i" = 5
then
continue
fi
echo $i
done
# continue with one
for i in 1 2 3 4 5 6 7 8 9 10
do
if test "$i" = 5
then
continue 1
fi
echo $i
done
# continue with loop count
for i in 1 2 3 4 5
do
for j in a b c d e f
do
if test "$i" = 3
then
if test "$j" = d
then
continue 2
fi
echo "$i $j"
fi
done
done
# continue into middle loop
for i in 1 2 3 4 5
do
for j in a b c d e f
do
if test "$i" = 3
then
if test "$j" = d
then
continue 1
fi
echo "$i $j"
fi
done
done
# while and until loops
a=
while test "$a" != "aaaaaaa"
do
a="a$a"
for i in 1 2 3 4
do
b=
until test "$b" = "bbbbb"
do
b="b$b"
if test "$i" = 3; then echo "continue 2"; continue 2; fi
echo "$a $i $b"
done
done
done

View file

@ -26,15 +26,10 @@ grub_functional_test (struct grub_extcmd *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
{
auto int run_test (grub_test_t test);
int run_test (grub_test_t test)
{
grub_test_run (test);
return 0;
}
grub_test_t test;
grub_list_iterate (GRUB_AS_LIST (grub_test_list),
(grub_list_hook_t) run_test);
FOR_LIST_ELEMENTS (test, grub_test_list)
grub_test_run (test);
return GRUB_ERR_NONE;
}

View file

@ -66,8 +66,10 @@ free_failures (void)
{
grub_test_failure_t item;
while ((item = grub_list_pop (GRUB_AS_LIST_P (&failure_list))) != 0)
while (failure_list)
{
item = failure_list;
failure_list = item->next;
if (item->message)
grub_free (item->message);
@ -134,23 +136,17 @@ grub_test_unregister (const char *name)
int
grub_test_run (grub_test_t test)
{
auto int print_failure (grub_test_failure_t item);
int print_failure (grub_test_failure_t item)
{
grub_test_failure_t failure = (grub_test_failure_t) item;
grub_printf (" %s:%s:%u: %s\n",
(failure->file ? : "<unknown_file>"),
(failure->funp ? : "<unknown_function>"),
failure->line, (failure->message ? : "<no message>"));
return 0;
}
grub_test_failure_t failure;
test->main ();
grub_printf ("%s:\n", test->name);
grub_list_iterate (GRUB_AS_LIST (failure_list),
(grub_list_hook_t) print_failure);
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);
else

View file

@ -34,16 +34,12 @@ main (int argc __attribute__ ((unused)),
extern void grub_unit_test_init (void);
extern void grub_unit_test_fini (void);
auto int run_test (grub_test_t test);
int run_test (grub_test_t test)
{
status = grub_test_run (test) ? : status;
return 0;
}
grub_test_t test;
grub_unit_test_init ();
grub_list_iterate (GRUB_AS_LIST (grub_test_list),
(grub_list_hook_t) run_test);
FOR_LIST_ELEMENTS (test, grub_test_list)
status = grub_test_run (test) ? : status;
grub_unit_test_fini ();
exit (status);

View file

@ -124,7 +124,8 @@ halt
EOF
isofile=`mktemp`
grub-mkrescue --output=${isofile} --override-directory=${builddir} \
grub-mkrescue --grub-mkimage=${builddir}/grub-mkimage --output=${isofile} \
--override-directory=${builddir} \
/boot/grub/grub.cfg=${cfgfile} /boot/grub/testcase.cfg=${source} \
>/dev/null 2>&1